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

Return Primero services where `service_implementing_agency_individual === 'unhcr_cw'` #15

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

Request

Currently we check if the first service has service_implementing_agency_individual === 'unhcr_cw'. https://github.com/OpenFn/primero-progres/blob/9803138de5de47809f2904320a474ece8aed2f87/jobs/2.a.getCases.js#L11-L12

Please change the logic to check ALL service items in the services_section array for this criteria.

Note that some cases may have an empty services_section[...] and some cases may only have 1 service that matches this criteria. Only if service_implementing_agency_individual === 'unhcr_cw', should we consider this service a "referral" to send to UNHCR. We can discard all services that do not match this criteria.

Remember 1 Primero service_section item = 1 DTP referral.

expression

https://github.com/OpenFn/primero-progres/blob/master/jobs/2.a.getCases.js

state

See LP for Primero Dadaab. This job 2-1 (https://openfn.org/projects/p5am6e/jobs/jv7rnp) will trigger job 2-2 to send the referral to DTP: https://openfn.org/projects/p5am6e/jobs/jydbjq

To test

See this sample case returned by Primero. It has 2 services... 1 service that matches this criteria, 1 that doesn't (no service_implementing_agency_individual exists)... so I'd expect only 1 referral to be sent to DTP/

Please run this on prod to make sure this works: https://openfn.org/projects/p5am6e/jobs/jv7rnp

lakhassane commented 3 years ago

@aleksa-krolls I made the change both in getCasesand in uploadReferrals.

It's ready for testing considering my slack question on uploadReferrals

aleksa-krolls commented 3 years ago

Looking great so far, thanks @lakhassane !