Closed aleksa-krolls closed 3 years ago
@lakhassane please prioritize this today... we hope to use in a testing session @ 2p
@aleksa-krolls I changed the mapping at service level. For line 48 it was already the case because inside the each, whatever was in services_section
is now inside state.data
@lakhassane quick feedback re: https://github.com/OpenFn/primero-progres/blob/master/jobs/1.b.sendReferrals.js#L52
case_id
(see L596 in run log) needs to have the substring last 12 digits of the service uid appended after a hashtag... like we do in this job here.
@aleksa-krolls I updated the case_id
. see L185 and 194
@lakhassane For Monday... if I look at this run log (https://www.openfn.org/projects/p5am6e/runs/0616911c-28d4-70d4-a9d2-fd81c2088f3b), it appears we're sending pending
decisions (when we should only send accepted
or rejected
. Is that the case?
Decision to send to DTP: {
"case_id": "9acf68e3-3adc-45b9-91cb-61dc902d0aaa#59a817caacfb",
"primero_user": "unhcr_cw",
"progres_interventionnumber": "612-21-PRTITV-0000009",
"status": "pending",
"closure_reason": "No reason specified.",
"request_type": "ReceiveDecisionOutgoingReferral"
}
This log Number of matching referrals: 2
looks correct... I see 2 rejected
referrals, but want to make sure that's indeed what is being sent to DTP. Please update the logs accordingly.
@aleksa-krolls feedback here:
From what I see there are multiple services_section
that matched the filter we did. And for 2 of them we have unhcr_referral_status: rejected
and for the others it is equal to pending
. However, since we use unhcr_referral_status
to map status
, that's why we are seeing pending
.
Should we ignore values that are different from accepted
/rejected
?
@aleksa-krolls correction done! I re-run but no match for now: https://www.openfn.org/projects/p5am6e/runs/0616d4d6-bf3c-7374-a381-910506b1ab04
Background, context, and business value
Related to Flow 1 where Progres sends a referral to Primero --> this upserts a case and individual service. (1 Progres referral = 1 Primero service)
Primero users will review the referral and update the individual service's "unhcr_referral_status" to accept/reject. We then need to send this decision back to Progres.
The specific request, in as few words as possible
Update Flow1-2 to ensure the
decision
mappings map to the service with theunhcr_referral_status
referral decision. (It looks like decision is mapping case-level data only instead of service-level)Currently the job correctly fetches case
id: f0b43ee6-bedc-42be-b785-86929bc603c9
that looks like this... (see run L97: https://www.openfn.org/projects/p5am6e/runs/061644bc-8480-7d03-a3c3-d751a86f315e)However, this service isn't recognized as a decision to send to UNHCR even though
"unhcr_referral_status": "rejected"
.MAKE SURE: For every 1 service in the
service_section
that meets the criteria below... send 1decision
notification to DTP. So if there are multiple services that match this criteria, send 1 request to DTP to each matching service. https://github.com/OpenFn/primero-progres/blob/e5e365803d8e0d72eac9ecc7a717500cfbf2ceb5/jobs/1.b.sendReferrals.js#L18-L29state.json
See LP for
Primero Gambella open_function
Run job Flow1-2 to extract from Primero (manual cursor is set to today): https://www.openfn.org/projects/p5am6e/jobs/jv89rxadaptor
http
expression.js
L48 and L49 should map from the individual service... not case-level. https://github.com/OpenFn/primero-progres/blob/7c75818e9f259c65ba4244d532e97e646b89cfac/jobs/1.b.sendReferrals.js#L43-L52
output.json
Send decision to DTP endpoint.