Closed daissatou2 closed 2 years ago
Please use this case today: global_id
: 01FP7XDMY4DJMMBAQEEW8KZYN0
Run 1 to upsert case in Primero: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061ae0ac-997d-7cd5-b6cc-e166cec29bb6
Run 2 to upsert services: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061ae0be-167a-720c-8ccb-adf402f4867b
Case in Primero: https://demo-kh.primero.org/v2/cases/41b4f655-94b1-422a-9efc-a501ceffb097
UNICEF refreshed the data in this system, so we don’t know for sure if anything else changed… but this is failing again in our latest test. The fourth referral is showing in the logs but not in Primero.
The run log here is saying that we recieved 4 services from Oscar AND are uploading 4 services to Primero for "external_id": "b9f7d70f-cc68-4e26-969b-3514adbcbd32"
.
But I still only see 3 referrals in Primero (These three were synced beforehand and NOT by the run above).
FYI...I am seeing that other Primero fields such as risk_level
and notes
are being updated by this run but not services?
You can replicate by running jobs/V2/f2-j1-getOscarCases.js
and using that output for jobs/V2/f2-j2-upsertCasesToPrimero.js
. The case_id
in question is b9f7d70f-cc68-4e26-969b-3514adbcbd32.
@lakhassane @taylordowns2000
Hey @lakhassane and @daissatou2 , if line 88
from Aicha's logs shows 4 services in the body being sent to upsertCase
and Aicha is 100% certain that there are only 3 cases in Primero for this record after the run succeeds, then we've got to look at what happens between that log and Primero.
This block (line 391-410 in the adaptor) looks complex—and therefore suspect!
@lakhassane , you should make sure you are 100% clear on what happening in that block. @daissatou2 , you should make sure that there aren't any business rules on primero that prevent certain types of services from being added.
Once we 100% on those two things, you could test by hand again using the same payload on a quick call. (Same as we did last time.)
@taylordowns2000 issue solved here with Aicha. That block you highlighted in the adaptor was using oldService from case found without adding the new services. Thanks for flagging this. I will be releasing a new version now and run on prod.
Bug Report
Background, context, and business value
I created a case in OSCaR and ran the Flow 2 OSCaR->Primero jobs to sync the case. Then I added services to it in OSCaR and ran flow 2 again to sync the services. Why are we not syncing the services for case with "oscar_short_id": "fmpq-1863" in the run below? https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061a8960-b171-74ab-8c5d-afa794f5673b
This image shows that the "referral notes" field is being updated but the services recieved from OSCaR are not being added.![image](https://user-images.githubusercontent.com/80456839/144401643-5ad9199e-e0c2-4f54-a145-2d3316a19c5b.png)
state.json
Primero V2 Cambodia Demo API user Oscar Staging (api only user)
expression.js
https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/V2/f2-j2-upsertCasesToPrimero.js