f2-j2: upload to Primero fails because of age range validation error
aleksa-krolls opened this issue · 3 comments
Issue
In this "f2" flow, we get case data from OSCaR and upload to Primero. This recent run failed on prod because the calculated age
was not within the range of 0 and 130: https://www.openfn.org/projects/pdngk6/runs/r89r3g3e
This could have been because we received a bad quality date value for date_of_birth
or because the validation was only recently added.
unicef-cambodia/jobs/f2-j2-upsertCasesToPrimero.js
Lines 352 to 361 in 07a7a13
Please modify this age calculation logic to return 0
as a default value if age > 30 || age < 1 || date_of_birth === undefined
.
- See solution docs here: https://github.com/OpenFn/unicef-cambodia/blob/master/docs/index.md
- Mapping specs: https://docs.google.com/spreadsheets/d/1x-KUJgOhaZlZYzJ935q9QXhPM0yobjEEuN-IJgIvmwA/edit#gid=112592766
adaptor
UPDATE: Note that this is Primero v1
so use language-primero@v1.2.0
expression
Flow job triggered by f2-j1
...
https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f2-j2-upsertCasesToPrimero.js
state
Please be careful to only use these credentials for testing...
f2-j1
to get data: Oscar Staging API user
f2-j2
to upload to primero: Primero Alpha Cambodia - Staging API user
See here for f2-j1
state ... this is sample output.json
from f2-j1
that you can use as state for f2-j2
.
https://github.com/OpenFn/unicef-cambodia/blob/master/sample_data/sample-f2-j1-output.json
NOTE that this state includes 3 cases: 1 with valid date_of_birth
, 1 with very old out of range dob, and 1 with null
dob.
@lakhassane please prioritize this today, and lmk if any questions!
@aleksa-krolls I added the conditions to return 0 on dob.
@lakhassane looks like it's working now, thanks!