Closed aleksa-krolls closed 3 years ago
@aleksa-krolls is the sample data correct?
e.g for service type I see this in the data "progres_interventiontype2": "a8b00885-b3c3-e611-xxxx-xxxxxxx"
, but the mapping object you used (serviceMap
) looks like this
const serviceMap = {
alternative_care: 'BIA', //TESTING: DO NOT USE
security: 'Protection',
education: 'Education',
};
So this instruction serviceMap[data.progres_interventiontype2]
will never map
Or eventually are those the right mapping objects you need?
@aleksa-krolls I checked the TODOs with the sample data. Note that I still doubt about the mapping objects but I left a note on how they should be formatted on Line 14.
@lakhassane Quick feedback on item 3. If the progres languages.progres_languagecodeid.Name
listed in state is not in the languageMap
, please return the value other
.
https://github.com/OpenFn/primero-progres/blob/master/jobs/1.upsertExtracts.js#L98
Here's the sample state again: https://www.openfn.org/projects/p5am6e/messages/mgk5er9q
@aleksa-krolls ready for testing
Background, context, and business value
See issue #3 for the original specs, and see issue #8 where similar mappings were implemented for services, protection concerns, and languages. I tried to borrow this logic from
2.b.uploadReferrals.js
and implement these transformations in this job... but not successful.The specific request, in as few words as possible
Check the job for the
TODO
comments, which include:service_type
- please use theserviceMap
in the job to output the correct service value based on the valuedata.progres_interventiontype2
. Output should be a string value.protection_concerns
- please use theprotectionMap
in the job to output the correct service value based on the valuedata.specificneeds.progres_spncategory2.Id
. Output should be an array of strings, even if there's only 1 value.languages
- please use thelanguageMap
in the job to output the correct service value based on the valuedata.languages.progres_languagecodeid.Name
.address_current
- please return a concatenated comma-separated string of the valuesdata.individuals.progres_coalocationlevel1.Name, level2, level3, level4, level5
+data.individuals.progres_coalocationlevel6
state.json
Use this and pls run on prod to make sure it works: https://www.openfn.org/projects/p5am6e/messages/mgk5er9q
adaptor
primero
used on production -example:
{form: "form-name"}
expression.js
https://github.com/OpenFn/primero-progres/blob/master/jobs/1.upsertExtracts.js
output.json
Successfully upsert this new referral to Primero with all fields mapped.