OpenFn / grassroot-soccer

Grassroot Soccer CommCare-Salesforce integrations
https://openfn.github.io/grassroot-soccer/
0 stars 0 forks source link

Function to clean CommCare choice values #4

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

Background

See issue #1 for original specs.

Request

Add function to clean the state data value by (1) replacing _ with spaces and (2) capitalizing the first character of every word. For example: not_school_related ==> Not School Related excellent ==> Excellent

Start with these 2 jobs and we will copy this data cleaning function and apply throughout other jobs where it is needed.

expressions

  1. Delivery_Method__c --> See run: https://www.openfn.org/projects/pd3yk4/runs/r7xrk7rr https://github.com/OpenFn/grassroot-soccer/blob/5505ac0545b62da43addd4435eae7c035f8a2ac1/jobs/2.a.upsertInterventions.js#L36

  2. Introduces_micromove__c --> See run: https://www.openfn.org/projects/pd3yk4/runs/r6grw9n3 https://github.com/OpenFn/grassroot-soccer/blob/5505ac0545b62da43addd4435eae7c035f8a2ac1/jobs/2.e.upsertCoach.js#L126-L128

state

See LP for GRS Sandbox Here's are states you can use and re-run on production:

  1. Intervention: https://www.openfn.org/projects/pd3yk4/messages/m78n66bp
  2. CSV: https://www.openfn.org/projects/pd3yk4/messages/mrb69nr4
aleksa-krolls commented 3 years ago

@chaiwa-berian Can you please go ahead and implement this clean function on L44: https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/2.a.upsertInterventions.js#L44

Then please re-run this on OpenFn.org to make sure it works: https://www.openfn.org/projects/pd3yk4/runs/r7xrk7rr

chaiwa-berian commented 3 years ago

@aleksa-krolls This is already implemented for upsertIntervention. The logic is here. Here is the re-run. It won't be easy for me to figure out where else this function is needed. Would you give me a defined list of where else I need to replicate this logic?