From b8df2ca763169248777934b45f0f0d0b4a322422 Mon Sep 17 00:00:00 2001 From: nathan-moore-97 Date: Tue, 6 Feb 2024 11:09:52 -0500 Subject: [PATCH] Adding survey swap group to embedded data --- qualtrix/api.py | 5 +++++ qualtrix/client.py | 3 +++ qualtrix/settings.py | 3 +++ 3 files changed, 11 insertions(+) diff --git a/qualtrix/api.py b/qualtrix/api.py index 365d5bc..75a3156 100644 --- a/qualtrix/api.py +++ b/qualtrix/api.py @@ -35,6 +35,7 @@ class RedirectModel(SurveyModel): targetSurveyId: str RulesConsentID: str # Client dependent SurveyswapID: str # Client dependent + SurveyswapGroup: str # Client dependent utm_campaign: str utm_medium: str utm_source: str @@ -86,6 +87,7 @@ async def intake_redirect(request: RedirectModel): directory_entry["id"], request.RulesConsentID, request.SurveyswapID, + request.SurveyswapGroup, request.utm_campaign, request.utm_medium, request.utm_source, @@ -126,6 +128,7 @@ async def add_user_to_contact_list( contact_id: str, rules_consent_id: str, survey_swap_id: str, + survey_swap_group: str, utm_campaign: str, utm_medium: str, utm_source: str, @@ -140,6 +143,8 @@ async def add_user_to_contact_list( client.modify_prefix("FS", "R", rules_consent_id), settings.SURVEY_SWAP_ID_LABEL, survey_swap_id, + settings.SURVEY_SWAP_GROUP_LABEL, + survey_swap_group, contact_id, utm_campaign, utm_medium, diff --git a/qualtrix/client.py b/qualtrix/client.py index a211d2e..43e5e74 100644 --- a/qualtrix/client.py +++ b/qualtrix/client.py @@ -197,6 +197,8 @@ def add_participant_to_contact_list( rules_consent_id: str, survey_swap_id_label: str, survey_swap_id, + survey_swap_group_label: str, + survey_swap_group: str, contact_id: str, utm_campaign: str, utm_medium: str, @@ -213,6 +215,7 @@ def add_participant_to_contact_list( survey_label: survey_link, rules_consent_id_label: rules_consent_id, survey_swap_id_label: survey_swap_id, + survey_swap_group_label: survey_swap_group, "utm_campaign": utm_campaign, "utm_medium": utm_medium, "utm_source": utm_source, diff --git a/qualtrix/settings.py b/qualtrix/settings.py index 889781e..a9eb92d 100644 --- a/qualtrix/settings.py +++ b/qualtrix/settings.py @@ -38,6 +38,7 @@ DEMOGRAPHICS_SURVEY_LABEL = None RULES_CONSENT_ID_LABEL = None SURVEY_SWAP_ID_LABEL = None +SURVEY_SWAP_GROUP_LABEL = None try: vcap_services = os.getenv("VCAP_SERVICES") @@ -65,6 +66,7 @@ DEMOGRAPHICS_SURVEY_LABEL = config["demographics_survey_label"] RULES_CONSENT_ID_LABEL = config["rules_consent_id_label"] SURVEY_SWAP_ID_LABEL = config["survey_swap_id_label"] + SURVEY_SWAP_GROUP_LABEL = config["survey_swap_group_label"] else: API_TOKEN = os.getenv("QUALTRIX_API_TOKEN") @@ -83,6 +85,7 @@ DEMOGRAPHICS_SURVEY_LABEL = os.getenv("QUALTRIX_DEMOGRAPHICS_SURVEY_LABEL") RULES_CONSENT_ID_LABEL = os.getenv("QUALTRIX_RULES_CONSENT_ID_LABEL") SURVEY_SWAP_ID_LABEL = os.getenv("QUALTRIX_SURVEY_SWAP_ID_LABEL") + SURVEY_SWAP_GROUP_LABEL = os.getenv("QUALTRIX_SURVEY_SWAP_GROUP_LABEL") except (json.JSONDecodeError, KeyError, FileNotFoundError) as err: log.warning("Unable to load credentials from VCAP_SERVICES")