Closed aleksa-krolls closed 4 years ago
hey @aleksa-krolls , i see a lot of datetimes in primero that use this format:
registration_date: oscarValue(c.external_id)
? null
: now.toISOString().split('T')[0].replace(/-/g, '/'),
that's an ISO string '2020-07-22T22:59:41.420Z'
with the T
pulled out and then the -
's turned to /
s. Do we want that, or that dd-mmm-yyyy hh:mm
format?
@taylordowns2000 Alberto says dd-mmm-yyyy hh:mm
so let's go with that.
OK, happy to do this, but are they asking us to forge the hh:mm
part if it's not present in the source data? If so, what time do they want us to pretend the case was enrolled? I'll assume 00:00
for now. (This raises so many red flags, but nothing we haven't warned them repeatedly about thus far.)
oh wow, sorry, just realizing that they want month spelled out as a three letter abbreviation. reopening this to work on it.
I've changed this to use lower-case-only three letter abbreviations for the month, per Alberto's request:
@taylordowns2000 OpenFn jobs are sometimes returning "service_implemented_day_time": "NaN-undefined-NaN 00:00",
.
See run failure here.
Looks like this is happening in scenarios where we do not receive anything from Oscar... see below where enrollment_date
key is not included. Please handle for these scenarios as Oscar is still implementing enrollment_date
.
Data provided by Oscar (ON: 01EDT83PVP3FNVT9DK67QHGZ2W / extId: d137d491-e0e9-483b-9d9d-d416a9211e90) : {
"oscar_short_id": "jvxu-1778",
"address_current_village_code": "",
"external_case_worker_id": "",
"external_case_worker_name": "primero",
"external_id": "d137d491-e0e9-483b-9d9d-d416a9211e90",
"external_id_display": "9211e90",
"global_id": "01EDT83PVP3FNVT9DK67QHGZ2W",
"is_referred": false,
"location_current_village_code": "",
"mosvy_number": "",
"organization_id": 46,
"organization_name": "cif",
"services": [
{
"uuid": "11226c6d-d7b8-4272-b45e-85cf635b9fba"
},
{
"uuid": "21905571-81c2-4870-ab33-db6cde56bbbe"
}
],
"status": "Active"
}
@taylordowns2000 I think is was resolved, no related errors recently popping up. Please confirm no outstanding questions? See my last comment above.
This is now handled in convertDate
lines 278-301... if Oscar does not send a date (by oscarValue
standards) we return null rather than trying to parse the date string and returning those NaN
s
We need to add a new
service_implemented_day_time
mapping when we upload Primero service data.... https://github.com/OpenFn/unicef-cambodia/blob/2ad697d0e35eb8fd4bbc38832b6085d17cd4b2c3/jobs/f2-j2-upsertCasesToPrimero.js#L280-L306Oscar will respond to f2-j1 with this state where
enrollment_date
will be added to Services.Update Primero mappings so that the
enrollment_date
is converted to the Primero formatdd-mmm-yyyy hh:mm
:*Keep in mind that Oscar is still implementing
enrollment_date
, so I'm not confident it will be included in historical data... so please handle for this key not existing or returning undefined or empty string.