OpenFn / unicef-cambodia

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

Oscar -> Primero flow: Update 'f1-j2-casesToOscar' job to include syncing of referral decision from flow 1 #91

Closed daissatou2 closed 2 years ago

daissatou2 commented 2 years ago

Feature Request

Background, context, and business value

The Primero and Oscar teams have agreed to include a decision flow in the solution. So we will now be syncing referral decisions back and forth between the two systems.

The specific request, in as few words as possible

Make updates in the f1-j2-casesToOscar job to sync the decisions received from the parent job.

For all cases in the nonreferrals array,

  1. use the status in the services_section[*].referral_status_5fe9c1a field in the Primero response to update the referral_status field in Oscar:

    • if we get accepted_270501 from Primero, send Accepted to Oscar
    • if we get rejected_412652 from Primero, send Exited to Oscar
  2. send "is_referred: false"

See the data flow diagram here.

state.json

Primero (to generate state):

{
  "configuration": "Primero V2 Cambodia Demo API user",
  "data": "Data will be generated from this job"
}

Oscar:

{
  "configuration": "Oscar Staging (api only user)",
  "data": "Run F1-J1 to generate state"
}

adaptor

language-http

expression.js

f1-j2-casesToOscar

aleksa-krolls commented 2 years ago

@daissatou2 Overall looking good... but quick feedback:

Re: your point 1...

  1. let's change referral_status --> services_section[*].referral_status to be specific that we expect this field to be in the services subform.
  2. It's not clear what the Oscar field name is that will hold the Accepted/Exited decision. Is there a field called Status or something like that?

Then, once we get updates from UNICEF and OSCaR, let's try to extract & then link to sample JSON responses to help Mamadou out.

lakhassane commented 2 years ago

@daissatou2 as discussed, the new fields are adding in the mapping for nonreferrals array.