OpenFn / unicef-cambodia

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

Add service_response_type mapping #66

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

Request

In Primero, update the service_response_type to 'service_being_provided_by_oscar_partner_47618' if Oscar provides a service enrollment date. Otherwise return 'referral_from_oscar' for any services where enrollment_date is not specified.

service_response_type: s.enrollment_date ? 'service_being_provided_by_oscar_partner_47618 ' : 'referral_from_oscar'

state

See LP for UNICEF Primero Alpha API. See sample_data/oscarNewReferral.json. https://github.com/OpenFn/unicef-cambodia/blob/acf18b13c041a42af24c90066aad9ca7f7603f07/sample_data/oscarNewReferral.json#L31-L51

expression

This should be mapped to the service-level in Primero... every service has 1 service_response_type https://github.com/OpenFn/unicef-cambodia/blob/7dd6aae7c5cdd5d0b54e2492c42739ddb4e5098b/jobs/f2-j2-upsertCasesToPrimero.js#L500-L504

output

The last service in this sample state has no enrollment_date (see L45 --> therefore this service should return service_response_type: 'referral_from_oscar'.

The other 3 services should return service_response_type: 'service_being_provided_by_oscar_partner_47618'.

taylordowns2000 commented 3 years ago

Tested with empty services array, and with no services key at all.

aleksa-krolls commented 3 years ago

@taylordowns2000 so far working great, thank you! keep you posted with final round of testing next week.