OpenFn / unicef-cambodia

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

f2-j2: Oscar services not being mapped to Primero #57

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

The issue

Oscar services are not being mapped to Primero in f2-j2 when we have cases with referrals. See run 9992125 that shows no Oscar services, when I know there are services available to upload to Primero.

state.json

See below for the output when I run f2-j1-getOscarCases.js locally with the LP cred Oscar Production Demo where since_date: '2020-09-29 00:00:00'.
I see services in the below response to f2-j1... but I don't see these services logged nor uploaded in the next f2-j2 (see run here where services are not being uploaded).


{
  "references": [
    {},
    {
      "__cookie": "",
      "__headers": {
        "content-type": "application/json; charset=utf-8",
        "transfer-encoding": "chunked",
        "connection": "close",
        "status": "200 OK",
        "cache-control": "max-age=0, private, must-revalidate",
        "vary": "Origin",
        "x-xss-protection": "1; mode=block",
        "access-token": "gH-N8oZAWbXeiE15Q3nA6A",
        "x-request-id": "f1c0ad1b-56c7-4378-9770-78410ff94622",
        "token-type": "Bearer",
        "expiry": "1602021288",
        "uid": "api.user@childreninfamilies.org",
        "client": "iFd5Jnpp5xdsnJjfmgWyqg",
        "x-frame-options": "SAMEORIGIN",
        "etag": "W/\"12c8f77b7e2523f98bc84e8ae88d02ed\"",
        "x-content-type-options": "nosniff",
        "x-runtime": "0.484745",
        "date": "Tue, 29 Sep 2020 21:54:49 GMT",
        "x-powered-by": "Phusion Passenger 5.1.0",
        "server": "nginx/1.10.2 + Phusion Passenger 5.1.0"
      },
      "body": {
        "data": {
          "id": 26,
          "first_name": "Integrate User",
          "last_name": "Integrated User",
          "roles": "case worker",
          "start_date": null,
          "job_title": "",
          "mobile": "",
          "date_of_birth": null,
          "archived": false,
          "province_id": null,
          "department_id": null,
          "email": "api.user@childreninfamilies.org",
          "clients_count": 0,
          "cases_count": 0,
          "tasks_count": 0,
          "provider": "email",
          "uid": "api.user@childreninfamilies.org",
          "admin": false,
          "changelogs_count": 0,
          "organization_id": null,
          "disable": false,
          "expires_at": null,
          "task_notify": true,
          "manager_id": null,
          "calendar_integration": false,
          "pin_number": null,
          "manager_ids": [],
          "program_warning": false,
          "staff_performance_notification": true,
          "pin_code": "",
          "domain_warning": false,
          "referral_notification": false,
          "gender": "other",
          "enable_gov_log_in": false,
          "enable_research_log_in": false,
          "deleted_at": null,
          "activated_at": null,
          "deactivated_at": null,
          "preferred_language": "en",
          "organization_name": null,
          "profile": null
        }
      }
    }
  ],
  "data": {
    "__cookie": "_cif-web_session=OXNTSUJ4aEJYOWw0UENaMzlNbTd1Vnc5Z2FRcmEzWUFrRjRqK1Rja0dLeXlPVVozN2w3ck9IUHhNVjJKOEtIUmJ4SzMxYVhVRDFwbGZ5cy9GWnZ4ZjgrRW9sQTlUOHcreno0NzFZYW9mdUtUYzRwUHBVMWpDcXBWOG1qdGlEYnQwTDVsS0FhejR3WFNOenpmMWkvYVpnPT0tLWlzS3Z0ZkE4LzNoeXdJWWFIQk5KZnc9PQ%3D%3D--7c38f8ee561270158c15cfd44572c6362e7bbae2",
    "__headers": {
      "content-type": "application/json; charset=utf-8",
      "transfer-encoding": "chunked",
      "connection": "close",
      "status": "200 OK",
      "cache-control": "max-age=0, private, must-revalidate",
      "vary": "Origin",
      "x-xss-protection": "1; mode=block",
      "x-request-id": "ae514d0f-50dc-4d8d-88d6-6ed875442d54",
      "etag": "W/\"d6076cce91c12165a5b6e36702c8867c\"",
      "x-frame-options": "SAMEORIGIN",
      "x-runtime": "0.383120",
      "x-content-type-options": "nosniff",
      "date": "Tue, 29 Sep 2020 21:54:50 GMT",
      "set-cookie": [
        "_cif-web_session=OXNTSUJ4aEJYOWw0UENaMzlNbTd1Vnc5Z2FRcmEzWUFrRjRqK1Rja0dLeXlPVVozN2w3ck9IUHhNVjJKOEtIUmJ4SzMxYVhVRDFwbGZ5cy9GWnZ4ZjgrRW9sQTlUOHcreno0NzFZYW9mdUtUYzRwUHBVMWpDcXBWOG1qdGlEYnQwTDVsS0FhejR3WFNOenpmMWkvYVpnPT0tLWlzS3Z0ZkE4LzNoeXdJWWFIQk5KZnc9PQ%3D%3D--7c38f8ee561270158c15cfd44572c6362e7bbae2; path=/; HttpOnly"
      ],
      "x-powered-by": "Phusion Passenger 5.1.0",
      "server": "nginx/1.10.2 + Phusion Passenger 5.1.0"
    },
    "data": [
      {
        "slug": "saki-1306",
        "global_id": "01EKDWDA7S4X0FMA36BXWRXQ3E",
        "external_id": "",
        "external_id_display": "",
        "mosvy_number": "",
        "given_name": "Ron",
        "family_name": "Weasley",
        "gender": "male",
        "date_of_birth": "2014-07-29",
        "location_current_village_code": "01040202",
        "address_current_village_code": "01040202",
        "organization_id": 7,
        "organization_name": "demo",
        "external_case_worker_name": null,
        "external_case_worker_id": null,
        "reason_for_referral": "reason",
        "services": [
          {
            "enrollment_date": "2020-09-30",
            "uuid": "042ffb1c-51de-404b-b69b-fdb9e15c9d36",
            "name": "Generalist social work / case work"
          },
          {
            "enrollment_date": "2020-09-30",
            "uuid": "155c6b46-ac10-4226-b9fd-6e117111b08c",
            "name": "Emergency foster care"
          },
          {
            "enrollment_date": "2020-09-30",
            "uuid": "7b97ef20-4c25-4d83-b2cb-60efc1ba300f",
            "name": "Support to access care"
          },
          {
            "enrollment_date": "2020-09-30",
            "uuid": "1f9219fd-39fb-4f78-be49-6d49e65e3a82",
            "name": "Family preservation"
          },
          {
            "enrollment_date": "2020-09-30",
            "uuid": "a5647de9-4849-4106-a85c-6dbc0ac0ba50",
            "name": "School support"
          },
          {
            "enrollment_date": "2020-09-30",
            "uuid": "b3109dcc-cd03-44cd-b6cf-811dcfc246ff",
            "name": "Scholarships or financial support"
          }
        ],
        "status": "Active",
        "case_worker_name": "ABLE Test",
        "case_worker_mobile": "+61433736766",
        "is_referred": true,
        "referral_consent_form": [
          "https://cif-web-assets-production.s3.amazonaws.com/uploads/referral/consent_form/537/Blank_diagram.png"
        ],
        "organization_address_code": ""
      }
    ]
  },
  "configuration": {
    "baseUrl": "https://start.oscarhq.com",
    "username": "api.user@childreninfamilies.org",
    "password": "see-LP"
  },
  "thisQueryDate": "2020-09-29 21:54:47",
  "lastQueryDate": "2020-09-29 21:54:47"
}