diff --git a/compendium_v2/conversion/conversion.py b/compendium_v2/conversion/conversion.py index 74bb087780717054cd2c8dbe3d2bf7127ec621a7..dba24a7c8dc7d4a6bcb2b108eda978ea7eed588b 100644 --- a/compendium_v2/conversion/conversion.py +++ b/compendium_v2/conversion/conversion.py @@ -56,6 +56,9 @@ def convert_answers(answers): mapped_answer.append(mapping.VALUE_TO_CODE_MAPPING[id][entry]) answer = mapped_answer + if id == 16504: + answer = '\n'.join(answer) + # code to convert my description in the mapping to a json structure question_names = question_name.split(":") subdict = data @@ -125,6 +128,8 @@ def _cli(app): for nren, answers in nren_surveys.items(): survey_dict = convert_answers(answers) + survey_dict["page"] = 0 + survey_dict["verification_status"] = {} response = SurveyResponse( nren=nren, nren_id=nren.id, diff --git a/compendium_v2/conversion/mapping.py b/compendium_v2/conversion/mapping.py index 35bbe0d15895af36011630291120e1ebe2a52d50..00c69e2ab26e9382041d6478a8848cc5e0b21ddf 100644 --- a/compendium_v2/conversion/mapping.py +++ b/compendium_v2/conversion/mapping.py @@ -183,7 +183,7 @@ ID_TO_NAME = { 16501: "business_continuity_plans", # "Yes" "No" 16502: "business_continuity_plans_specifics", 16503: "security_controls", # json list with double quotes - 16504: "security_controls-Comment", + 16504: "security_controls-Comment", # json list with double quotes that should be mapped to string # 16505: "policy_comments", 16760: "policies:gender_equality_policy:available", # "Yes" "No" 16761: "policies:gender_equality_policy:url", @@ -452,6 +452,16 @@ CONNECTION = { "No - other reason / unsure": "no_other" } +COVERED = { + "Yes - including transit to other networks": "yes_incl_other", + "Yes - national NREN access": "yes_national_nren", + "In some circumstances ": "sometimes", + "No - not eligible for policy reasons": "no_policy", + "No - financial restrictions (NREN is unable to charge/cover costs)": "no_financial", + "No - other reason": "no_other", + "Unsure/unclear": "unsure" +} + CHARGING_LEVELS = { "Charges typically higher than for R+E users": "higher_than_r_e_charges", "Same charging model as for R+E users": "same_as_r_e_charges", @@ -496,6 +506,16 @@ VALUE_TO_CODE_MAPPING = { "Integrity checking": "integrity_checking", "Other": "other" }, + 16539: COVERED, + 16540: COVERED, + 16541: COVERED, + 16542: COVERED, + 16543: COVERED, + 16544: COVERED, + 16545: COVERED, + 16546: COVERED, + 16547: COVERED, + 16548: COVERED, 16763: { "We participate in GEANT Crisis workshops such as CLAW": "geant_workshops", "No, we have not done any crisis exercises or trainings": "none", diff --git a/test/test_conversion.py b/test/test_conversion.py index 73453cf88ad1c5f8bcca067cd4d489bf0ab2a30c..5d67a98a8ff78065f8c99fb3508b83cbaec0ce7c 100644 --- a/test/test_conversion.py +++ b/test/test_conversion.py @@ -32,7 +32,7 @@ def test_queries(app_with_survey_db, mocker): responses = db.session.scalars(select(SurveyResponse).order_by(SurveyResponse.nren_id)).all() assert len(responses) == 1 - assert responses[0].answers == {"data": {}} + assert responses[0].answers == {"data": {}, "page": 0, "verification_status": {}} def test_conversion():