OpenFn / unicef-cambodia

UNICEF Cambodia - Primero Interoperability
https://openfn.github.io/unicef-cambodia/
1 stars 2 forks source link

Move case worker details inside "services_section":[...] #33

Closed aleksa-krolls closed 4 years ago

aleksa-krolls commented 4 years ago

Move these 3 mappings to the services_section array: https://github.com/OpenFn/unicef-cambodia/blob/3cbda8cbd857ee6778f625525a8e1728c61d5c80/jobs/f2-j2-upsertCasesToPrimero.js#L345-L347

In current output, these 3 fields are in the "child":{} object...

Data provided to Primero `upsertCase`:  {
  "remote": true,
  "oscar_number": "01EC0XW85GEFC7SJNVDP3SWW0N",
  "case_id": "17bce806-1118-4ebb-b01e-f4923a2ab922",
  "child": {
    "case_id": "17bce806-1118-4ebb-b01e-f4923a2ab922",
    "oscar_number": "01EC0XW85GEFC7SJNVDP3SWW0N",
    "mosvy_number": "4444",
    "name_first": "Aleksa",
    "name_last": "Newtest",
    "sex": "female",
    "date_of_birth": "2011-06-01",
    "location_current": null,
    "address_current": "",
    "oscar_status": "Active",
    "protection_status": "oscar_referral",
    "protection_status_oscar": "",
    "owned_by": "agency-cif-user",
    "has_referral": false,
    "consent_for_services": true,
    "disclosure_other_orgs": true,
    "module_id": "primeromodule-cp",
    "registration_date": "2020/06/29",
    "oscar_case_worker_name": "លី រ៉ាស៊ី",
    "oscar_referring_organization": "cif",
    "oscar_case_worker_telephone": "0963052453",
    "services_section": [
      {
        "unique_id": "827ba321-5ed9-49ce-8494-b70993934733",
        "service_subtype": [
          "mental_health_support_therapeutic_interventions"
        ],
        "service_type": "mental_health_support",
        "service_type_text": "mental_health_support",
        "service_type_details_text": "n/a",
        "service_response_type": "referral_from_oscar"
      }

In the expected output, these are in the "services_section"...


"services_section": [
      {
        "unique_id": "81544ee2-f17e-4970-9b8f-3ad20618cd7c",
        "service_response_type": "referral_from_oscar",
        "service_type": "counselling",
        "service_type_text": "Counselling",
        "service_type_details_text": "Family counselling / mediation",
        "oscar_case_worker_name": "Name OSCaR case worker",
        "oscar_referring_organization": "OSCaR Organization",
        "oscar_case_worker_telephone": "0123456789"
      }