OpenFn / primero-progres

Interoperability solution for UNICEF <> UNHCR interagency referrals between Primero and Progres v4 systems.
https://openfn.github.io/primero-progres/
0 stars 2 forks source link

Flow1: Update mappings sent from Primero to Progres #44

Closed aleksa-krolls closed 2 years ago

aleksa-krolls commented 2 years ago

Request

We need to make some mapping updated based on the data received from Primero before we send decisions to Progres.

1. In Flow1-1 catch and success jobs, update case_id mapping to include #{service-12-digit-substring} The case_id syntax is correct in Flow1-2 (see here where we combine the Primero case_id and substring of the service unique_id. This needs to be applied in Flow1-1 (success) and Flow1-1 (catch) to follow the same syntax. See issue #34 for the original spec.

2. Map service-level progres_interventionnumber field in Decision sent to Progres Currently when we send decisions to Progres, we are trying to map progres_interventionnumber from the case-level. https://github.com/OpenFn/primero-progres/blob/d4666cd406146eb08f305b77291d3583708c5a62/jobs/1.b.sendReferrals.js#L59

However, this field is actually captured on the service-level within the services_section array. Please update this mapping to pull the value from the correct source key. See JSON we expect to see in state.data: https://github.com/OpenFn/primero-progres/blob/master/sampleData/getPrimeroCases.json#L66

state

For Flow1-1, run this first Flow1-1. Send Referrals to Primero job to generate state for the other 2 flow jobs Flow1-1 (catch) and Flow1-1 (success)...

Screen Shot 2021-12-02 at 5 28 51 PM

For Flow1-2, run this job to generate state and use a date manual cursor in order to find referrals in the request results: last_updated_at=2021-11-02T15%3A00%3A20.709Z..

config

  1. Flow1-1. Send Referrals to Primero See LP for Primero Gambella Demo (open_function)

  2. Flow1-1. Send Upload Error to DTP (catch) See LP DTP - ReceiveDecisionOutgoingReferral (staging)

  3. Flow1-1. Send Upload Success to DTP (success) See LP DTP - ReceiveDecisionOutgoingReferral (staging)

  4. Flow1-2. Send Decision to DTP See OpenFn cred: DTP-sendDecision (open_function)

expression

There are a couple of jobs in this flow where we need to make these changes...

  1. Flow1-1. Send Upload Error to DTP (catch) (update only progres_interventionnumber; we fail to create a Service in Primero in this scenario, so can't change the case_id mapping) https://github.com/OpenFn/primero-progres/blob/master/jobs/1.dtpReferralFails.js#L26-L28

  2. Flow1-1. Send Upload Success to DTP (success) (update both mappings) https://github.com/OpenFn/primero-progres/blob/master/jobs/1.dtpReferralSucceeds.js#L9-L10

  3. Flow1-2. Send Decision to DTP (update progres_interventionnumber mapping) https://github.com/OpenFn/primero-progres/blob/master/jobs/1.b.sendReferrals.js#L59

adaptor

primero

Testing notes

Feel free to run on platform STAGING project: https://www.openfn.org/projects/primero-progres-v4-staging/jobs

lakhassane commented 2 years ago

@aleksa-krolls as discussed I removed the unique_id substring from case_id for 1.b.sendReferrals.js. So what's left is to double check if we actually the unique_id for the error and success flow jobs.