Cint/Lucid
**********

Helpers for recruiting through Cint (formerly Lucid). See CINT (Lucid)
for the full workflow.

psynet.lucid.qualifications.create_lucid_recruitment_config(language_tag, country_tag, question_answer_dict, config_path=None, allow_mobile_devices=None, force_google_chrome=None, unique_ip=True, unique_pid=True, industry_id=30, study_type_id=1, debug=True, qualifications_dict=None, config=None, service=None)

   Build the Lucid (Cint) recruitment config for one language-country
   pair.

   Looks up each qualification and its translated answer options
   through the Lucid API, so it needs the Lucid API credentials. It
   also adds "TIMEOUT v1" (answer "Agree"), mobile and tablet
   exclusions unless "allow_mobile_devices" is true, and a Chrome
   requirement when "force_google_chrome" is true.

   Parameters:
      * **language_tag** (*str*) -- Three-letter Lucid language code
        (not an ISO tag); the API lists valid codes on error.

      * **country_tag** (*str*) -- Two-letter Lucid country code (not
        an ISO code); the API lists valid codes on error.

      * **question_answer_dict** (*dict*) -- Maps qualification names
        on your Lucid account to lists of allowed English answers.
        Modified in place to add "TIMEOUT v1".

      * **config_path** (*str**, **optional*) -- If given, write the
        config to this JSON file and return "None".

      * **allow_mobile_devices** (*bool**, **optional*) -- Defaults to
        the "allow_mobile_devices" config value.

      * **force_google_chrome** (*bool**, **optional*) -- Defaults to
        the "force_google_chrome" config value. Deprecated; see
        "force_google_chrome" in the experiment config docs. Note that
        the Lucid qualification (QuestionID 1035) gates on Chrome
        brand only — Edge, Brave, and Opera participants are excluded
        at the recruitment stage even though PsyNet's entry check
        admits them.

      * **unique_ip** (*bool*) -- Require a unique IP address per
        participant.

      * **unique_pid** (*bool*) -- Require a unique panelist ID per
        participant.

      * **industry_id** (*int*) -- Lucid industry ID; default 30
        (Other). Options: 1 Automotive, 2 Beauty/Cosmetics, 3
        Beverages - Alcoholic, 4 Beverages - Non Alcoholic, 5
        Education, 6 Electronics/Computer/Software, 7 Entertainment
        (Movies, Music, TV, etc), 8 Fashion/Clothing, 9 Financial
        Services/Insurance, 10 Food/Snacks, 11 Gambling/Lottery, 12
        Healthcare/Pharmaceuticals, 13 Home (Utilities, Appliances,
        ...), 14 Home Entertainment (DVD, VHS), 15 Home
        Improvement/Real Estate/Construction, 16 IT (Servers,
        Databases, etc), 17 Personal Care/Toiletries, 18 Pets, 19
        Politics, 20 Publishing (Newspaper, Magazines, Books), 21
        Restaurants, 22 Sports, 23 Telecommunications (phone, cell
        phone, cable), 24 Tobacco (Smokers), 25 Toys, 26
        Transportation/Shipping, 27 Travel, 28 Video Games, 29
        Websites/Internet/E-Commerce, 30 Other, 31 Sensitive Content,
        32 Explicit Content.

      * **study_type_id** (*int*) -- Lucid study type ID; default 1
        (Adhoc). Options: 1 Adhoc, 2 Diary, 5 IHUT, 8 Community Build,
        9 Face to Face, 11 Recruit - Panel, 13 Tracking - Monthly, 14
        Tracking - Quarterly, 15 Tracking - Weekly, 16 Wave Study, 17
        Qualitative Screening, 18 Internal Use, 21 Incidence Check, 22
        Recontact, 23 Ad Effectiveness Research, 24 Proof Exposed, 25
        Proof Control.

      * **debug** (*bool*) -- Print the English and translated text of
        each qualification.

      * **qualifications_dict** (*dict**, **optional*) -- Maps
        qualification names to Lucid question IDs. Fetched from the
        API if omitted; pass it to save time when building several
        configs.

      * **config** (*dallinger.config.Configuration**, **optional*) --
        Experiment config; loaded if omitted.

      * **service** (*LucidService**, **optional*) -- Lucid service;
        created with "psynet.lucid.get_lucid_service()" if omitted.

   Returns:
      The config (with "survey", "qualifications", "country" and
      "language" keys), or "None" if "config_path" is given.

   Return type:
      dict or None

psynet.lucid.qualifications.verify_lucid_qualifications(config_path, question_names=None)

   Re-ask Lucid qualification questions in the experiment, ending it
   for disallowed answers.

   Each question is shown in the participant's language with two
   buttons; choosing an answer not allowed by the qualification
   terminates the experiment.

   Parameters:
      * **config_path** (*str*) -- JSON file written by
        "create_lucid_recruitment_config()".

      * **question_names** (*list** of **str**, **optional*) --
        Qualifications to ask. Defaults to all except the built-in
        "MS_" ones. Each must have exactly two answer options.

   Returns:
      Timeline elements, one page per question.

   Return type:
      list

psynet.lucid.get_lucid_service(config=None, recruitment_config=None)

   Create a "LucidService" client for the Lucid (Cint) API.

   Reads "lucid_api_key" and "lucid_sha1_hashing_key" from the
   experiment config when run in an experiment directory (one with
   "config.txt"), otherwise from "~/.dallingerconfig".

   Parameters:
      * **config** (*dallinger.config.Configuration**, **optional*) --
        Experiment config; loaded if omitted. Ignored outside an
        experiment directory.

      * **recruitment_config** (*dict**, **optional*) -- Lucid
        recruitment config, as returned by "psynet.lucid.qualification
        s.create_lucid_recruitment_config()".

   Return type:
      LucidService

class psynet.lucid.LucidService(api_key, sha1_hashing_key, exp_config, recruitment_config, max_wait_secs=0, default_locale='eng_gb')

   Facade for Lucid Marketplace services provided via its HTTP API.
