Closed daissatou2 closed 2 years ago
@lakhassane Quoin got back to us re: the oscar_number
issue... so hopefully this unblocks us to finish up testing. Given their feedback on how to query (see above)... do we need to make any job changes?
Let @daissatou2 know when she can test the Oscar-to-Primero Flow 2 again :)
@lakhassane I just tested this flow again and seeing this error now: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/0619ceaa-3266-7402-8a7e-bf348474993f
@lakhassane @daissatou2 Looks like the oscar_number
issue is resolved, but now we're encountering this error below. Does that sound right?
/home/app/priv/language_packs/node_modules/@openfn/language-primero-v2.3.6/lib/Adaptor.js:533
var newServices = child.services_section.filter(function (os) {
At a glance, it looks like perhaps an issue with the Primero adaptor...or maybe because we're not sending services to Primero?
We need to handle for Oscar scenarios where (a) sometimes there are services, and (b) sometimes no services are provided (e.g., "services": []
) and only case-level information.
@aleksa-krolls @daissatou2 actually we are having this issue not because of services_section but because we don't have a child
key.
This line you copied here in the adaptor is excepting a child
key and then services_section
thus the error Cannot read property 'services_section' of undefined
(because child is undefined).
I made a check in the adaptor to ignore if there is no child
key but it will break with this new error (see screenshot)
I think it's mandatory to have a child (even if it's en empty array?). Something to add to the job?
Note: btw this last issue is duplicated here https://github.com/OpenFn/unicef-cambodia/issues/85
@lakhassane I think child
is relevant for Primero V1 (not V2). See V2 api docs where there is no mention of the child
key: https://github.com/primeroIMS/primero/blob/development_v2/app/controllers/api/v2/docs/cases/post.md#create-a-new-case
Also... remember how in prior testing, including child
was causing us issues, so we commented it out?
https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/V2/f2-j2-upsertCasesToPrimero.js#L517
Can you please share the output/ exact request body we send to the Primero API? Let @daissatou2 and me know if you want to get on a quick call to work through this.
Bug Report
Background, context, and business value
We are still seeing the 500 error relating to
oscar_number
. Here is the latest run: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061967b0-dd31-7354-a590-607c8e6cb885UPDATE: Primero said they deployed a fix to index
oscar_number
. We should be able to look-up existing cases now.GET requests to check for existing cases should look like they did before, so I don't think this requires any adaptor changes:
GET https://demo-kh.primero.org/api/v2/cases?oscar_number=01FMMRHCMPN7W27FJ638WG7MK1
state
Primero V2 Cambodia Demo API user
Oscar Staging (api only user)
Re-run
F2-J1
to re-trigger... see parent run to retry: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061967b0-7cfd-77a5-9467-d6d25c10fecd https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/061967b0-7cfd-77a5-9467-d6d25c10fecdexpression
Be sure to only edit jobs in the
V2
directoryF2-J2
https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/V2/f2-j2-upsertCasesToPrimero.js