Closed daissatou2 closed 2 years ago
@daissatou2 let's talk through this one in our call tomorrow.
Referral update
- overall looking good, but let's discuss about how we can be more specific on the mappings. Case level update
- the existing job uses upsertCase(...)
. We need to ask to add a services_section[]
mapping for referral_status
here: https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f2-j2-upsertCasesToPrimero.js#L282-L291@daissatou2 I added the new mapping as discussed: https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/V2/f2-j2-upsertCasesToPrimero.js#L294
@daissatou2 this is done for the referral update. We might need more data to be able to test
@lakhassane I am testing syncing only the oscar_number
from Oscar to Primero for case with case_id
= "55647191-e544-4fda-87d8-bd118b21ed32" (so no decision has been made on this case which originated in Primero yet). But this job is failing after completing the upsert: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/0620bbcf-1c14-7492-8edf-c60f7f6c399e
Note: I am seeing the new oscar_number
in Primero after this sync. But why is the job failing?
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. This is similar to the decision flow we implemented for the Primero - Progres project where we (1) get the matching referral, and (2) update the referral with the decision status.
See the data flow diagram here.
The specific request, in as few words as possible
Make updates in the f2-j2-upsertCasesToPrimero job to sync the decisions recieved from the parent job.
1) Referral update:
external_id
(Primerocase_id
) &services[].name
(Primeroservice
type)GET /cases/:id/referrals
. See sample JSON response.No matching Oscar referral found
service_record_id
=services[].uuid
from the Oscar decisionid
onto the next operation...updateReferral(...)
to PATCH an update to the Primerostatus
field with what is in thereferral_status
field from the Oscar response.PATCH /cases/:record_id/referrals/:id
See sample JSON payload for request body2) Add mapping to cases-level update on the services subform:
referral_status_5fe9c1a
here. The source field is thereferral_status
field from the Oscar response. See mappings below.state.json
Primero:
Oscar (to generate state):
adaptor
Primero adaptor Primero API Docs
expression
All changes should be made in the V2 folder f2-j2-upsertCasesToPrimero