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

Additional mapping logic for flow 2 (Primero referrals to DTP) #8

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

Background

See issue #5 for original specs for this Flow 2 where we are uploading referrals to DRP.

Request

Implement the following mapping logic for 3 fields. Note that I've already added the mapping values to the joob.

  1. service_type mapping state provide 1 value https://github.com/OpenFn/primero-progres/blob/0552beb59855c0cb55b3accfc255d92dde233284/sampleData/primero_outboundReferral_e7a9d84.json#L55 desired output: map to progres value (see L30 in job) --> e.g., Documentation

  2. protection_concerns mapping state provides an array of values https://github.com/OpenFn/primero-progres/blob/0552beb59855c0cb55b3accfc255d92dde233284/sampleData/primero_outboundReferral_e7a9d84.json#L84-L87 desired output: map each value in array to progres value (see L58 in job); return as comma-separated string (e.g., 'SC-UC, SM-AD')

  3. language mapping state provides an array of values https://github.com/OpenFn/primero-progres/blob/bf5c9a1dd0ddfd9c4a3bda56ac5c03e349f48b8b/sampleData/primero_outboundReferral_e7a9d84.json#L74-L77 desired output: map each value in array to progres value (see L65 in job); return as comma-separated string (e.g., 'English, Somali')

state

Use this: https://github.com/OpenFn/primero-progres/blob/master/sampleData/primero_outboundReferral_e7a9d84.json

expression

https://github.com/OpenFn/primero-progres/blob/master/jobs/2.b.uploadReferrals.js

adaptor

language-http (sending to DTP)

To test

Please re-run this on production: https://www.openfn.org/projects/p5am6e/runs/rn57gw53 If there are mapping issues, DTP will describe the mapping issues that in the error log. Otherwise I expect the error to fail with 500 and message: Error calling v4.

lakhassane commented 3 years ago

@aleksa-krolls I made the changes for this one.

aleksa-krolls commented 3 years ago

@lakhassane Feedback from client testing...

  1. jobs/2.b.uploadReferrals.js: They now want protection_concerns to output in the format of an array instead of a comma-separated string (e.g., ["SC-UC"] vs. "SC-UC"). See example in L63 of run: https://www.openfn.org/projects/p5am6e/runs/rn57b9dd
  2. jobs/2.c.uploadDecisions.js: Encountering a TypeError while testing Flow 2: https://www.openfn.org/projects/p5am6e/runs/r44m895n
lakhassane commented 3 years ago

@aleksa-krolls changes done for 1. For 2 I made the correction: https://www.openfn.org/projects/p5am6e/runs/rrkzdz4n

However no decisions is sent. maybe a problem with the case_idused?