generated from OpenFn/project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openfn-d78b8cef-95c5-4f94-93e3-5fa28047dc59-state.json
1048 lines (1048 loc) · 333 KB
/
openfn-d78b8cef-95c5-4f94-93e3-5fa28047dc59-state.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"id": "d78b8cef-95c5-4f94-93e3-5fa28047dc59",
"name": "grassroot-soccer",
"description": null,
"inserted_at": "2024-04-30T14:08:17Z",
"updated_at": "2024-12-11T10:30:17Z",
"scheduled_deletion": null,
"project_credentials": {
"[email protected]": {
"id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b",
"name": "GRS Salesforce Prod",
"owner": "[email protected]"
},
"[email protected]": {
"id": "cf9875db-411c-4d35-85b7-efaec895f013",
"name": "GRS CommCare Prod with Webhook URLs",
"owner": "[email protected]"
}
},
"history_retention_period": null,
"dataclip_retention_period": null,
"retention_policy": "retain_all",
"workflows": {
"HIV-Testing-Event-Statistics": {
"id": "e46b3646-ff79-46fa-9f96-8670b8f871e0",
"name": "HIV Testing Event Statistics",
"inserted_at": "2024-11-04T14:36:19.785870Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "b0a2f738-f966-4601-8211-a12d68aa89d7",
"type": "webhook"
}
},
"jobs": {
"HIV-Testing-Event-Statistics": {
"id": "0500eb2a-0984-4086-839d-54f92261e5d9",
"name": "HIV Testing Event Statistics",
"body": "// push to production\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n fields(\n field('Name', dataValue('form.event_name')),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n field('Tested_Negative_Males_0_9__c', dataValue('form.table_1_testing_results.male_hiv_negative.question2')),\n field('Tested_Negative_Males_10_14__c', dataValue('form.table_1_testing_results.male_hiv_negative.question7')),\n field('Tested_Negative_Males_15_19__c', dataValue('form.table_1_testing_results.male_hiv_negative.question13')),\n field('Tested_Negative_Males_20_24__c', dataValue('form.table_1_testing_results.male_hiv_negative.question18')),\n field('Tested_Negative_Males_25_49__c', dataValue('form.table_1_testing_results.male_hiv_negative.question28')),\n field('Tested_Negative_Males_50__c', dataValue('form.table_1_testing_results.male_hiv_negative.question32')),\n field('Tested_Positive_Males_0_9__c', dataValue('form.table_1_testing_results.question33.question36')),\n field('Tested_Positive_Males_10_14__c', dataValue('form.table_1_testing_results.question33.question41')),\n field('Tested_Positive_Males_15_19__c', dataValue('form.table_1_testing_results.question33.question45')),\n field('Tested_Positive_Males_20_24__c', dataValue('form.table_1_testing_results.question33.question50')),\n field('Tested_Positive_Males_25_49__c', dataValue('form.table_1_testing_results.question33.question56')),\n field('Tested_Positive_Males_50__c', dataValue('form.table_1_testing_results.question33.question60')),\n field('Tested_Negative_Females_0_9__c', dataValue('form.table_1_testing_results.question61.question65')),\n field('Tested_Negative_Females_10_14__c', dataValue('form.table_1_testing_results.question61.question69')),\n field('Tested_Negative_Females_15_19__c', dataValue('form.table_1_testing_results.question61.question73')),\n field('Tested_Negative_Females_20_24__c', dataValue('form.table_1_testing_results.question61.question78')),\n field('Tested_Negative_Females_25_49__c', dataValue('form.table_1_testing_results.question61.question84')),\n field('Tested_Negative_Females_50__c', dataValue('form.table_1_testing_results.question61.question88')),\n field('Tested_Positive_Females_0_9__c', dataValue('form.table_1_testing_results.question89.question92')),\n field('Tested_Positive_Females_10_14__c', dataValue('form.table_1_testing_results.question89.question97')),\n field('Tested_Positive_Females_15_19__c', dataValue('form.table_1_testing_results.question89.question101')),\n field('Tested_Positive_Females_20_24__c', dataValue('form.table_1_testing_results.question89.question106')),\n field('Tested_Positive_Females_25_49__c', dataValue('form.table_1_testing_results.question89.question112')),\n field('Tested_Positive_Females_50__c', dataValue('form.table_1_testing_results.question89.question116')),\n field(\n 'Pregnant_Women_Tested_0_9__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question120'\n )\n ),\n field(\n 'Pregnant_Women_Tested_10_14__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question124'\n )\n ),\n field(\n 'Pregnant_Women_Tested_15_19__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question129'\n )\n ),\n field(\n 'Pregnant_Women_Tested_20_24__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question134'\n )\n ),\n field(\n 'Pregnant_Women_Tested_25_49__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question140'\n )\n ),\n field(\n 'Pregnant_Women_Tested_50__c',\n dataValue(\n 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.question144'\n )\n ),\n //field(\n // 'Total_Pregnant_Women_Tested__c',\n // dataValue(\n // 'form.table_3_pregnant_women_tested.enter_the_number_of_pregnant_women_tested_for_each_following_age_group.total_tested_pregnant'\n // )\n //),\n field(\n 'First_Time_Females_0_9__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question65')(state) +\n dataValue('form.table_4_first_time_testers.question89.question92')(state)\n ),\n field(\n 'First_Time_Females_10_14__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question69')(state) +\n dataValue('form.table_4_first_time_testers.question89.question97')(state)\n ),\n field(\n 'First_Time_Females_15_19__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question73')(state) +\n dataValue('form.table_4_first_time_testers.question89.question101')(state)\n ),\n field(\n 'First_Time_Females_20_24__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question78')(state) +\n dataValue('form.table_4_first_time_testers.question89.question106')(state)\n ),\n field(\n 'First_Time_Females_25_49__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question84')(state) +\n dataValue('form.table_4_first_time_testers.question89.question112')(state)\n ),\n field(\n 'First_Time_Females_50__c',\n state =>\n dataValue('form.table_4_first_time_testers.question61.question88')(state) +\n dataValue('form.table_4_first_time_testers.question89.question116')(state)\n ),\n field(\n 'First_Time_Males_0_9__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question2')(state) +\n dataValue('form.table_4_first_time_testers.question33.question36')(state)\n ),\n field(\n 'First_Time_Males_10_14__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question7')(state) +\n dataValue('form.table_4_first_time_testers.question33.question41')(state)\n ),\n field(\n 'First_Time_Males_15_19__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question13')(state) +\n dataValue('form.table_4_first_time_testers.question33.question45')(state)\n ),\n field(\n 'First_Time_Males_20_24__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question18')(state) +\n dataValue('form.table_4_first_time_testers.question33.question50')(state)\n ),\n field(\n 'First_Time_Males_25_49__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question28')(state) +\n dataValue('form.table_4_first_time_testers.question33.question56')(state)\n ),\n field(\n 'First_Time_Males_50__c',\n state =>\n dataValue('form.table_4_first_time_testers.male_hiv_negative.question32')(state) +\n dataValue('form.table_4_first_time_testers.question33.question60')(state)\n ),\n field(\n 'of_Males_Referred_to_Sexual_Abuse__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.abuseviolence_referral'\n )\n ),\n field(\n 'of_Males_Referred_to_Family_Referral__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.family_planning_referral'\n )\n ),\n field(\n 'of_Males_Referred_for_HIV_Positive__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.hiv_positive_referral'\n )\n ),\n field(\n 'of_Males_Referred_to_MMC_Referral__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.medical_male_circumcision_referral'\n )\n ),\n field(\n 'of_Males_Referred_to_STI__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.sexually_transmitted_infection_sti_referral'\n )\n ),\n field(\n 'of_Males_Referred_to_Tuberculosis__c',\n dataValue(\n 'form.table5_referrals.enter_the_number_of_men_and_women_referred_for_each_referral_tye_and_the_or.tuberculosis_tb_referral'\n )\n ),\n field(\n 'of_Females_Referred_to_Sexual_Abuse__c',\n dataValue('form.table5_referrals.women_referred_number.abuseviolence_referral_women')\n ),\n field(\n 'of_Females_Referred_to_Antenatal_Care__c',\n dataValue('form.table5_referrals.women_referred_number.antenatal_care_anc_referral_women')\n ),\n field(\n 'of_Females_Referred_to_Family_Referral__c',\n dataValue('form.table5_referrals.women_referred_number.family_planning_referral_women')\n ),\n field(\n 'of_Females_Referred_for_HIV_Positive__c',\n dataValue('form.table5_referrals.women_referred_number.hiv_positive_referral_women')\n ),\n field(\n 'of_Females_Referred_to_PMTCT__c',\n dataValue('form.table5_referrals.women_referred_number.prevention_of_mother-to-child_transmission_women')\n ),\n field(\n 'of_Females_Referred_to_STI__c',\n dataValue('form.table5_referrals.women_referred_number.sexually_transmitted_infection_sti_referral_women')\n ),\n field(\n 'of_Females_Referred_to_Tuberculosis__c',\n dataValue('form.table5_referrals.women_referred_number.tuberculosis_tb_referral_women')\n ),\n \n field('Community_Members__c', dataValue('form.table_2_tested_profile.enter_the_number_tested_for_each_following_profile.community_members')),\n field('GRS_Coaches__c', dataValue('form.table_2_tested_profile.enter_the_number_tested_for_each_following_profile.skillz_coaches')),\n field('GRS_Participants__c', dataValue('form.table_2_tested_profile.enter_the_number_tested_for_each_following_profile.skillz_participants')),\n field('GRS_Staff__c', dataValue('form.table_2_tested_profile.enter_the_number_tested_for_each_following_profile.staff')),\n //field('Total_Tested__c', dataValue('form.table_2_tested_profile.enter_the_number_tested_for_each_following_profile.total_tested')),\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->HIV-Testing-Event-Statistics": {
"enabled": true,
"id": "3dede7b9-926d-4922-8d43-bb4af43988cd",
"source_trigger_id": "b0a2f738-f966-4601-8211-a12d68aa89d7",
"condition_expression": "state.data.form[\"@name\"] == \"HIV Testing Event Statistics\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "HIV Testing Event Statistics",
"target_job_id": "0500eb2a-0984-4086-839d-54f92261e5d9"
}
}
},
"Outcome-Survey": {
"id": "6a0e9a6f-d891-4614-bc30-72d892623265",
"name": "Outcome Survey",
"inserted_at": "2024-11-04T14:36:55.219320Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "1b6a5cb3-8465-4aba-a718-55eeda0ccb8f",
"type": "webhook"
}
},
"jobs": {
"Outcome-Survey": {
"id": "f440e892-562b-4e5f-8aa4-3ae80ebf2c92",
"name": "Outcome Survey",
"body": "fn((state) => {\n\n \n state.capitalizeFirstLetter = (text) => {\n if (!text) return text; // Return the text if it's empty or undefined\n return text.charAt(0).toUpperCase() + text.slice(1);\n };\n \n state.replaceUnderscoreWithSpace = (text) => {\n if (typeof text !== 'string') {\n return ''; // Return an empty string if input is not a string\n }\n return text.replace(/_/g, ' ');\n}\n\nstate.replaceSpaceWithSemiColon = (text) => {\n if (typeof text !== 'string') {\n return ''; // Return an empty string if input is not a string\n }\n return text.replace(/ /g, ';');\n \n}\n\nstate.HIVtestMap = {\n agree: \"Positive\",\n negative: \"Negative\",\n \"copy-2-of-days\": \"5 - 6 days\",\n \"i_dont_knowdeclined\": \"I don't know / Declined to answer\",\n \"i_dont_knowdeclined_answer\": \"I don't know / Declined to answer\",\n \"i_dont_knowdeclined_to_answer\": \"I don't know / Declined to answer\"\n };\n\n\n\nstate.daysMap = {\n days: \"1 - 2 days\",\n \"copy-1-of-days\": \"3 - 4 days\",\n \"copy-2-of-days\": \"5 - 6 days\",\n \"more_than_6_days\": \"More than 6 days\",\n \"none\": \"None\"\n };\n \n state.agreeDisagreeMap = {\n Agree: 'Yes', //New\n Disagree: 'No', // Continued\n \"I don't know/Declined to answer\": \"Declined to answer\",\n \"I_dont_know_declined_to_answer\": \"Declined to answer\",\n \"I_dont_knowdeclined_to_answer\": \"I don't know\",\n \"choice2\": \"No\"\n };\n \n state.agreeDisagreeMap2 = {\n Agree: 'Yes', //New\n Disagree: 'No', // Continued\n \"I don't know/Declined to answer\": \"Declined to answer\",\n \"I_dont_know_declined_to_answer\": \"Declined to answer\",\n \"I_dont_knowdeclined_to_answer\": \"Declined to answer\",\n \"choice2\": \"No\"\n };\n \n state.timeMap = {\n \"all_of_the_time\": \"All of the time\",\n \"most_of_the_time\": \"Most of the time\", \n \"more_than_half_of_the_time\": \"More than half of the time\",\n \"less_than_half_of_the_time\": \"Less than half of the time\",\n \"some_of_the_time\": \"Some of the time\",\n \"at_no_time\": \"At no time\",\n \"choice10\": \"Less than half of the time\"\n }\n \n state.choiceMapping = {\n \"choice1\": \"Confidentiality concerns\",\n \"choice2\": \"Contraceptives including pills, injections, implants or similar\",\n \"choice3\": \"Condoms – male or female\",\n \"choice4\": \"Voluntary medical male circumcision\",\n \"choice10\": \"Less than half of the time\",\n \"Sexual and reproductive health informationtalks\": \"Sexual and reproductive health information/talks\"\n\n }\n \n state.choiceMapping2 = {\n \"Choice2\": \"Yes\",\n }\n \n state.idkdeclinedtodeclined = {\n \"I_dont_know_declined_to_answer\": \"Declined to answer\",\n }\n \n state.idkdeclinedtoidkdeclined = {\n \"I_dont_know_declined_to_answer\": \"I don't know / Declined to answer\",\n \"I_dont_knowdeclined_to_answer\": \"I don't know / Declined to answer\"\n }\n \n \n // function capitalizeFirstLetter(text) {\n // if (!text) return text; // Return the text if it's empty or undefined\n // return text.charAt(0).toUpperCase() + text.slice(1);\n // }\n\n function transform(value) {\n if (!value) return;\n //console.log(\"value in switch\", value.toString().trim().toLowerCase());\n switch (value.toString().trim().toLowerCase()) {\n case \"Agree\":\n return \"Yes\";\n case \"Disagree\":\n return \"No\";\n case \"I don't know/Declined to answer\":\n return \"Declined to answer\";\n default:\n return value;\n }\n }\n\n state.helperFunctions = { transform };\n\n return state;\n});\n\nfn((state) => {\n const { form } = state.data;\n state.surveyMappings = {\n CommCare_Ext_ID__c: dataValue(\"id\"),\n Name_of_Interviewer__c: form[\"name_of_interviewer\"],\n Date__c: form.date,\n Interview_Start_Time__c: form.interview_start_time,\n Interview_End_Time__c: form.interview_end_time,\n What_was_the_main_reason_the_participant__c:\n form[\n \"copy-1-of-what_was_the_main_reason_the_participant_did_not_consent_to_participate_in_\"\n ],\n Site_Name__c: state.capitalizeFirstLetter(form.site),\n Venue_Name__c: form.venue,\n Group_Name__c: form.group_name,\n //Grade__c: 'form.grade',\n Curriculum_Attended__c: form.curriculum,\n Give_permission_to_participate__c:\n form[\"did_the_individual_give_permission_to_participate_in_the_survey\"],\n Main_reason_of_not_consenting__c: state.choiceMapping[state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(\n form[\"what_was_the_main_reason_the_participant_did_not_consent_to_participate_in_\"]))],\n Participant_Name__c: form.participant_name,\n Participant_Gender__c: state.capitalizeFirstLetter(form.participant_gender),\n Participant_DOB__c: form.participant_date_of_birth,\n Currently_live_with_at_home__c: state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(form[\"who_do_you_currently_live_with_at_home\"])),\n Days_did_you_go_without_food__c: state.daysMap[form[\"in_the_last_week_how_many_days_did_you_go_without_food\"]],\n Ever_been_in_any_kind_of_sexual_relation__c: state.capitalizeFirstLetter(form[\"have_you_ever_been_in_any_kind_of_sexual_relationship_with_someone\"]),\n In_any_form_of_sexual_relationship__c: state.choiceMapping2[state.capitalizeFirstLetter(form[\"are_you_currently_in_any_form_of_sexual_relationship\"])],\n Age_of_your_current_last_sexual_partner__c: state.capitalizeFirstLetter(form[\"what_is_the_age_of_your_currentlast_sexual_partner\"]),\n Ever_had_sexual_intercourse__c: state.capitalizeFirstLetter(form[\"have_you_ever_had_sexual_intercourse\"]),\n Age_at_first_sex__c: state.capitalizeFirstLetter(form[\"how_old_were_you_when_you_had_sexual_intercourse_for_the_first_time\"]),\n La__c: state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(form[\"the_last_time_you_had_sexual_intercourse_why_did_you_do_it\"])),\n Last_2_years_pregnant_or_given_birth__c: state.capitalizeFirstLetter(form[\"in_the_last_2_years_did_you_ever_get_pregnant_or_give_birth_instruction_thi\"]),\n HIV_positive_should_hide_it_from_others__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"people_who_test_hiv_positive_should_hide_it_from_others\"])],\n I_would_rather_not_know_if_I_have_HIV__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_would_rather_not_know_if_i_have_hiv\"])],\n someone_with_HIV_to_stop_taking_their_AR__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"it_is_okay_for_someone_with_hiv_to_stop_taking_their_arv_as_soon_as_they_st\"])],\n People_with_HIV_to_have_unprotected_sex__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"it_is_okay_for_two_people_with_hiv_to_have_unprotected_sex_with_each_other\"])],\n Someone_has_HIV_by_looking_at_him_or_her__c: state.capitalizeFirstLetter(form[\"i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her\"]),\n talk_to_a_partner_about_HIV_STI_testing__c: state.capitalizeFirstLetter(form[\"i_know_how_to_talk_to_a_partner_about_hivsti_testing\"]),\n HIV_testing_is_free_at_government_health__c: state.agreeDisagreeMap2[state.capitalizeFirstLetter(form[\"hiv_testing_is_free_at_government_health_facilities\"])],\n Have_you_ever_tested_for_HIV__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"have_you_ever_tested_for_hiv\"])],\n Result_of_your_last_HIV_test__c: state.HIVtestMap[form[\"what_was_the_result_of_your_last_most_recent_hiv_test\"]],\n Where_to_get_support_services__c: state.capitalizeFirstLetter(form[\"i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related\"]),\n Right_to_access_sexual_health_services__c: state.capitalizeFirstLetter(form[\"i_have_the_right_to_access_sexual_health_services_such_as_sti_and_hiv_testi\"]),\n Where_to_get_support_services_for_GBV__c: state.agreeDisagreeMap[state.capitalizeFirstLetter[form[\"i_know_where_to_get_support_services_for_me_or_someone_else_for_gender-base\"]]],\n Services_accessed_in_the_past_2_years__c: state.choiceMapping[state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(form[\"in_the_last_2_years_which_of_these_services_have_you_accessed_through_the_c\"]))],\n Accessed_the_above_services__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"did_you_access_the_above_services_more_than_once_per_year\"])],\n The_staff_at_my_nearest_clinic_are_frien__c: state.capitalizeFirstLetter(form[\"the_staff_at_my_nearest_clinic_are_friendly\"]),\n Keep_my_personal_information_private__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"the_staff_at_my_nearest_clinic_will_keep_my_personal_information_private\"])],\n Feel_stigmatism_or_judged__c: state.agreeDisagreeMap2[state.capitalizeFirstLetter(form[\"i_do_not_feel_stigmatism_or_judged_when_i_go_to_access_sexual_reproductive_\"])],\n Suggests_using_a_condom__c: state.agreeDisagreeMap[state.capitalizeFirstLetter[form[\"when_a_partner_suggests_using_a_condom_it_means_he_or_she_has_had_sex_with_\"]]],\n //A_condom_would_make_sex_less_pleasing__c: state.agreeDisagreeMap2[state.capitalizeFirstLetter(form[\"using_a_condom_would_make_sex_less_pleasant\"])],\n I_know_how_to_correctly_use_a_condom__c: state.agreeDisagreeMap2[state.capitalizeFirstLetter(form[\"i_know_how_to_correctly_use_a_condom\"])],\n Able_to_refuse_to_have_sex__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_would_be_able_to_refuse_to_have_sex_if_my_partner_did_not_want_to_use_a_c\"])],\n Condoms_are_the_only_contraceptive__c: state.agreeDisagreeMap2[state.capitalizeFirstLetter(form[\"condoms_are_the_only_contraceptive_method_that_protect_against_pregnancy_as\"])],\n Use_a_condom__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"i_should_use_a_condom_even_if_my_girlfriend_is_on_another_form_of_birth_con\"])],\n The_last_time_you_had_sexual_intercourse__c: state.capitalizeFirstLetter(form[\"the_last_time_you_had_sexual_intercourse_did_you_and_your_partner_use_a_con\"]),\n A_girl_woman_can_get_pregnant__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"a_girl_or_woman_can_get_pregnant_the_very_first_time_she_has_sex\"])],\n Sign_of_Pregnancy__c: state.capitalizeFirstLetter(form[\"one_sign_of_pregnancy_is_a_girl_missing_her_period\"]),\n Ever_used_family_planning_method__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"have_you_ever_used_any_type_of_family_planning\"])],\n Recieved_Family_Planning__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"in_the_last_2_years_did_you_ask_for_or_receive_family_planning\"])],\n Type_of_Family_Planning_accessed__c: state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(form[\"in_the_last_2_years_what_type_of_family_planning_services_did_you_access\"])),\n Methods_to_avoid_unwanted_pregnancy__c: state.capitalizeFirstLetter(form[\"i_know_at_least_three_methods_to_avoid_an_unwanted_pregnancy\"]),\n Support_for_prevention_of_teen_pregnancy__c: state.capitalizeFirstLetter(form[\"in_the_last_2_years_did_you_get_support_for_prevention_of_teenage_pregnancy\"]),\n I_have_felt_cheerful_and_in_good_spirits__c: state.timeMap[(form[\"i_have_felt_cheerful_and_in_good_spirits\"])],\n I_have_felt_calm_and_relaxed__c: state.timeMap[form[\"i_have_felt_calm_and_relaxed\"]],\n I_have_felt_active_and_vigorous__c: state.timeMap[form[\"question11\"]],\n I_woke_up_feeling_fresh_and_rested__c: state.timeMap[form[\"i_woke_up_feeling_fresh_and_rested\"]],\n Life_filled_with_things_interesting_me__c: state.replaceUnderscoreWithSpace(state.capitalizeFirstLetter(form[\"my_daily_life_has_been_filled_with_things_that_interest_me\"])),\n Sign_of_personal_weakness__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"a_mental_illness_is_a_sign_of_personal_weakness\"])],\n //Sign_of_personal_weakness__c: state.capitalizeFirstLetter(form[\"seeking_help_for_mental_health_challenges_is_a_sign_of_weakness\"]),\n Expectations_dealing_with_emotions__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"society_expects_boys_and_girls_to_deal_with_their_emotions_differently\"])],\n Self_control_and_smart_decisions__c: state.capitalizeFirstLetter(form[\"self-control_helps_you_make_smart_decisions_when_you_are_angry_or_upset\"]),\n Avoid_using_violent_behaviour__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"when_i_am_angry_i_know_how_to_avoid_using_violent_behaviour\"])],\n Confidence_and_face_to_face_appointments__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_am_confident_attending_face_to_face_appointments_to_seek_information_abou\"])],\n Seek_information_about_mental_illness__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"i_am_confident_that_i_know_where_to_seek_information_about_mental_illness\"])],\n Bounce_back_from_difficult_situations__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_can_bounce_back_from_difficult_situations\"])],\n Avoid_people_with_mental_illness__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"it_is_best_to_avoid_people_with_mental_illness_so_that_you_dont_develop_thi\"])],\n Informed_decisions_about_sexual_health__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_can_make_my_own_informed_decisions_about_my_sexual_healthcare\"])],\n Say_no_to_sex_despite_pressure__c: state.capitalizeFirstLetter(form[\"i_can_say_no_to_sex_even_if_my_boyfriend_or_friends_pressure_me_to_have_sex\"]),\n Make_my_own_decisions_pressure__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others\"])],\n Tell_someone_if_I_were_touched__c: state.capitalizeFirstLetter(form[\"i_would_tell_someone_if_i_were_touched_in_a_manner_that_made_me_uncomfortab\"]),\n Say_no_to_sex_no_matter_who_asks_me__c: state.capitalizeFirstLetter(form[\"i_can_say_no_to_sex_no_matter_who_asks_me\"]),\n How_to_overcome_challenges__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_know_how_to_overcome_challenges_that_i_may_face_in_my_life\"])],\n I_can_achieve_my_goals__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_can_achieve_my_goals_even_if_i_face_challenges\"])],\n Confident_setting_measurable_goals__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"i_feel_confident_setting_measurable_goals\"])],\n Good_reason_to_hit_his_girlfriend_wife__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"sometimes_a_man_or_boyfriend_may_have_a_good_reason_to_hit_his_girlfriend_o\"])],\n Take_part_in_household_chores__c: state.capitalizeFirstLetter(form[\"men_should_take_part_in_household_chores_such_as_washing_plates_and_sweepin\"]),\n Girls_responsibility_on_pregnancy__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"it_is_only_the_girls_responsibility_to_avoid_getting_pregnant\"])],\n Right_to_have_sex__c: state.capitalizeFirstLetter(form[\"a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want\"]),\n Appropriate_for_a_girl_to_carry_condoms__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"it_is_not_appropriate_for_a_girlwoman_to_carry_condoms\"])],\n Where_to_get_support__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"copy-1-of-i_know_where_to_get_support_services_for_me_or_someone_else_for_gender-base\"])],\n Gone_to_seek_support_forself__c: state.agreeDisagreeMap[state.capitalizeFirstLetter(form[\"in_the_last_2_years_have_you_ever_gone_to_seek_support_for_yourself_or_for_\"])],\n People_in_my_life_who_I_can_get_help__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"there_are_people_in_my_life_who_i_can_get_help_from_if_i_need_it\"])],\n People_in_my_life_who_I_can_talk_to__c: state.capitalizeFirstLetter(form[\"there_are_people_in_my_life_who_i_can_talk_to_about_how_to_handle_things\"]),\n Where_to_go_for_support_for_alcohol__c: state.idkdeclinedtoidkdeclined[state.capitalizeFirstLetter(form[\"i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh\"])],\n };\n return state;\n});\n\nupsert(\n \"SKILLZ_Outcome_Monitoring_Survey__c\",\n \"CommCare_Ext_ID__c\",\n (state) => state.surveyMappings\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Outcome-Survey": {
"enabled": true,
"id": "15c4aa81-e3a9-4760-9280-28ac5e3327f4",
"source_trigger_id": "1b6a5cb3-8465-4aba-a718-55eeda0ccb8f",
"condition_expression": "state.data.form[\"@name\"] == \"SKILLZ Outcome Monitoring Survey\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Outcome Survey",
"target_job_id": "f440e892-562b-4e5f-8aa4-3ae80ebf2c92"
}
}
},
"PHQ9": {
"id": "168018bf-173f-4a8b-a892-3a47321877d2",
"name": "PHQ9",
"inserted_at": "2024-11-04T14:37:09.367499Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "1f9f22b7-c94d-4454-81f8-1edc40a1f1f5",
"type": "webhook"
}
},
"jobs": {
"PHQ9": {
"id": "f9425c8e-1459-42a6-9940-ca9fb0534c2d",
"name": "PHQ9",
"body": "alterState(state => {\n function capitalizeFirstLetter(str) {\n if (!str) return;\n let new_str = str.toString().toLowerCase();\n return new_str.slice(0, 1).toUpperCase() + new_str.slice(1);\n }\n\n function transform(value) {\n if (!value) return;\n switch (value.toString().trim()) {\n case 'Daughterson':\n return 'Daughter/Son';\n case 'Other_specify':\n return 'Other';\n case 'Single_never_married':\n return 'Single/Never Married';\n case 'Divorced__separated':\n return 'Divorced/separated';\n default:\n return value;\n }\n }\n\n function getAge(dateString) {\n if (!dateString) return;\n\n const today = new Date();\n const birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n }\n \n state.data.form.begin_interview.what_is_your_marital_status = state.data.form.begin_interview && state.data.form.begin_interview.what_is_your_marital_status ? transform(\n capitalizeFirstLetter(state.data.form.begin_interview.what_is_your_marital_status) \n ): undefined;\n\n state.data.form.begin_interview.position_of_respondent_in_the_household = state.data.form.begin_interview && state.data.form.begin_interview.position_of_respondent_in_the_household ? transform(\n capitalizeFirstLetter(state.data.form.begin_interview.position_of_respondent_in_the_household)\n ): undefined;\n\n state.helperFunctions = { getAge };\n return state;\n});\n\nupsert(\n 'PHQ_9_Strong_Minds__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n \n // relationship('Intervention_Name__r', 'CommCare_Case_ID__c', state => {\n // if (state.data.form.hidden_properties.intervention_id) return state.data.form.hidden_properties.intervention_id;\n // else return \"990221ac-3c05-475d-87c7-24d8a5fcb63e\";\n // }),\n relationship('Intervention_Name__r', 'CommCare_Case_ID__c', dataValue('form.hidden_properties.intervention_id')),\n \n \n //relationship('Participant__r','CommCare_Ext_ID__c', dataValue('form.hidden_properties.participant_fullname')),\n field('Mobile_Contact_Information__c', dataValue('form.hidden_properties.mobile_number')),\n field('Curriculum__c', dataValue('form.hidden_properties.curriculum')),\n //field('Intervention__c', dataValue('form.hidden_properties.intervention')),\n field('Gender__c', dataValue('form.hidden_properties.gender')),\n field('Participant_Name__c', state => {\n const firstname = state.data.form.hidden_properties.participant_first_name;\n const lastname = state.data.form.hidden_properties.participant_surname;\n return firstname + ' ' + lastname;\n }),\n\n field('Coach_Name__c', dataValue('form.hidden_properties.coach_name')),\n relationship(\n 'Venue2__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.hidden_properties.venue')\n ), \n //field('Venue__c', dataValue('form.hidden_properties.venue')), replacing with the lookup\n relationship(\n 'Site2__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.hidden_properties.site')\n ),\n //field('Site__c', dataValue('form.hidden_properties.site')), replacing with the lookup\n field('Interview_Date__c', dataValue('form.interview_date')),\n field('Resident_not_shifting_in_3_months_time__c', dataValue('form.full_time_resident')),\n field('Participant_DOB__c', state => {\n const dob = dataValue('form.hidden_properties.date_of_birth')(state); \n return dob ? dob : null; \n }),\n //field('Area_Center__c', dataValue('form.hidden_properties.venue')), //Can get from Intervention\n field('Age_of_Participant__c', state => {\n const dob = dataValue('form.hidden_properties.date_of_birth')(state);\n\n return dob ? state.helperFunctions.getAge(dob) : null;\n }),\n \n \n field('Marital_Status__c', dataValue('form.begin_interview.what_is_your_marital_status')),\n field(\n 'Position_of_Respondent_in_Household__c',\n dataValue('form.begin_interview.position_of_respondent_in_the_household')\n ),\n field('Q1_Little_interest_pleasure__c', dataValue('form.begin_interview.questions.little_interest')),\n field('Q2_Sad_Down_Depressed_Hopeless__c', dataValue('form.begin_interview.questions.depressed_sad_hopeless')),\n field('Q3_Trouble_sleeping__c', dataValue('form.begin_interview.questions.trouble_sleeping')),\n field('Q4_Feeling_tired__c', dataValue('form.begin_interview.questions.heavy_burden')),\n field('Q5_Appetite_problems__c', dataValue('form.begin_interview.questions.appetite_problems')),\n field('Q6_Failure_Worthless_Guilt__c', dataValue('form.begin_interview.questions.feeling_bad')),\n field('Q7_Trouble_concentrating__c', dataValue('form.begin_interview.questions.trouble_concentrating')),\n field('Q8_Trouble_in_speech__c', dataValue('form.begin_interview.questions.moving_slowly')),\n field('Q9_Suicidal_thoughts__c', dataValue('form.begin_interview.questions.thoughts_suicide'))\n //field('PHQ9_Total_Score__c', dataValue('form.begin_interview.questions.phq9_result.PHQ9_score'))\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->PHQ9": {
"enabled": true,
"id": "f7bc8c29-eab4-47b4-a89f-3a3bc6ee57e0",
"source_trigger_id": "1f9f22b7-c94d-4454-81f8-1edc40a1f1f5",
"condition_expression": "state.data.form[\"@name\"] == \"PHQ9\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "PHQ9",
"target_job_id": "f9425c8e-1459-42a6-9940-ca9fb0534c2d"
}
}
},
"Upsert-Home-Visit-Log-Form": {
"id": "9271f4a5-883c-4449-b421-64afbe23afd7",
"name": "Upsert Home Visit Log Form",
"inserted_at": "2024-11-04T14:39:02.684279Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "aef4f09c-0743-42a7-9df7-5376d7bc1d3c",
"type": "webhook"
}
},
"jobs": {
"Upsert-Home-Visit-Log-Form": {
"id": "33d6409f-6ba5-441d-bfae-6e18ac0b5b88",
"name": "Upsert Home Visit Log Form",
"body": "// push to production\n\nquery(\n `SELECT Participant_Identification_Number_PID__c from Person__c where Participant_Identification_Number_PID__c = '${state.data.form.case['@case_id']}'`\n);\n\nfn(state => {\n const PID = lastReferenceValue('records[0].Participant_Identification_Number_PID__c')(state);\n if (!PID) {\n console.log(\n `Participant not found with Participant_Identification_Number_PID__c: ${state.data.form.case['@case_id']}`\n );\n return state;\n }\n\n return execute(\n fn(state => {\n const { form } = state.data;\n const { basic_information } = form;\n if (basic_information.intervention_hidden) {\n return query(\n `SELECT Id, Event__c, CreatedDate, Person_Attendance__c\n FROM Attendance__c\n WHERE Person_Attendance__r.Participant_Identification_Number_PID__c = '${form.case['@case_id']}'\n ORDER BY CreatedDate DESC LIMIT 1`\n )(state).then(state => {\n const { records } = state.references[0];\n const eventId = records[0].Event__c;\n state.data.eventField = [field('Event__c', eventId)];\n return state;\n });\n // state.data.eventField = [\n // relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('form.basic_information.intervention_hidden')(state)),\n // ];\n // return state;\n } else {\n return query(\n `SELECT Id, Event__c, CreatedDate, Person_Attendance__c\n FROM Attendance__c\n WHERE Person_Attendance__r.Participant_Identification_Number_PID__c = '${form.case['@case_id']}'\n ORDER BY CreatedDate DESC LIMIT 1`\n )(state).then(state => {\n const { records } = state.references[0];\n const eventId = records[0].Event__c;\n state.data.eventField = [field('Event__c', eventId)];\n return state;\n });\n }\n }),\n\n upsert('Home_Visit__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n // relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('form.basic_information.intervention_hidden')),\n relationship('Person_visiting__r', 'Participant_Identification_Number_PID__c', dataValue('form.case.@case_id')),\n //=== NOTE: We do not need to map People information because Home Visit is related to Person. ======//\n //This info already lives on the Person-level.\n // field('First_Name__c', dataValue('form.basic_information.participant_first_name')),\n // field('Surname__c', dataValue('form.basic_information.participant_surname')),\n // field('Sex__c', dataValue('form.basic_information.gender')),\n // field('Date_of_Birth__c', dataValue('form.basic_information.date_of_birth')),\n // field('Physical Address Community City', dataValue('form.basic_information.participant_address')),\n //================\n field('Mobile_Number__c', dataValue('form.basic_information.Mobile_number')),\n field('Consent_Given__c', dataValue('form.basic_information.consent_received')),\n //field('Consent_Given__c', dataValue('form.participant_infomation.visit_information.consent_given')) //Repeated mapping\n //field('From_Venue__c', dataValue('form.basic_information.venue_hidden')),\n field('Reason_for_Home_Visit__c', dataValue('form.participant_infomation.reason_for_home_visit')),\n field('Visit_Date__c', dataValue('form.participant_infomation.visit_information.visit_date')),\n field('Additional_Comments__c', dataValue('form.administrative.visit_notes'))\n ),\n ...fields(...state.data.eventField),\n }))\n )(state);\n});\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Home-Visit-Log-Form": {
"enabled": true,
"id": "6361a12f-2874-4056-a045-c8da6f77b0c2",
"source_trigger_id": "aef4f09c-0743-42a7-9df7-5376d7bc1d3c",
"condition_expression": "state.data.form[\"@name\"] == \"Home Visit Log Form\" && state.data.form[\"basic_information\"][\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Home Visit Log Form",
"target_job_id": "33d6409f-6ba5-441d-bfae-6e18ac0b5b88"
}
}
},
"Upsert-Register-Event": {
"id": "aac1fdfe-a1d0-4eca-8430-d9ea8ff9f5a3",
"name": "Upsert Register Event",
"inserted_at": "2024-11-04T14:39:56.370114Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "939b9dc4-329d-4c67-be12-0de9b5cad492",
"type": "webhook"
}
},
"jobs": {
"Upsert-Register-Event": {
"id": "6401c526-1f9a-4b24-ae1d-e03bdb57a509",
"name": "Upsert Register Event",
"body": "alterState((state) => {\n \n function clean(str) {\n if (!!str)\n return str\n .split('_')\n .map(word => {\n let new_word = word.toString().toLowerCase();\n return new_word.slice(0, 1).toUpperCase() + new_word.slice(1);\n })\n .join(' ');\n }\n \n const coachFieldNames = ['Coach_A__r','Coach_B__r','Coach_C__r','Coach_D__r']\n \n state.data.destinationCoachFields = state.data.form.event_information.coaches\n .split(' ')\n .reduce(\n (accumulator, currentValue, currentIndex) => [\n ...accumulator,\n (currentIndex < coachFieldNames.length && !!currentValue\n ? relationship(coachFieldNames[currentIndex], 'CommCare_Ext_ID__c', currentValue)\n : []),\n ],\n []\n );\n \n const eventtype = state.data.form.event_information.event_type; \n \n const recordtype = eventtype==='community_health_event' || eventtype==='soccer_tournament' ? 'Testing Event' : 'Malaria Testing Event'; \n console.log(recordtype)\n \n state.data.recordtype = recordtype; \n \n return state; \n}); \n\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n state=>({\n ...fields(\n field('Name', dataValue('form.event_information.Event_Name')),\n relationship('RecordType', 'Name', dataValue('recordtype')),\n field('CommCare_Ext_ID__c', state => {\n var event = dataValue('form.event_information.Event_Name')(state);\n return event ? event.replace(/\\//gi, '') : event;\n }),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n field('Business_Unit__c', state => {\n const bu = dataValue('form.event_information.business_unit')(state); \n return bu==='65680f0c4c144b03ad0f86bdc46c1ebc' ? 'GRS Zambia' : \n bu==='04d98397e28046118fade28ced6b65cb' ? 'GRS Zimbabwe' : \n bu==='ed125ab19ec34aacab79585e59eb76f4' ? 'GRS Partnerships': undefined ; \n }),\n relationship('Site__r','CommCare_Ext_ID__c', dataValue('form.event_information.site')),\n relationship('Venue__r', 'CommCare_Ext_ID__c',dataValue('form.event_information.Venue')),\n field('Date__c', dataValue('form.event_information.event_date')),\n field('Event_Type__c', dataValue('recordtype')),\n field('Testing_Event_Type__c', state => {\n const type = dataValue('form.event_information.event_type')(state); \n return type.includes('malaria') ? 'Malaria Testing Event (General Event)' : 'Other';\n }),\n field('Coordinator__c', dataValue('form.event_information.event_coordinator')),\n ),\n ...fields(...state.data.destinationCoachFields)\n })\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Register-Event": {
"enabled": true,
"id": "36cc914e-3852-476d-85ac-04ca77f3292e",
"source_trigger_id": "939b9dc4-329d-4c67-be12-0de9b5cad492",
"condition_expression": "state.data.form[\"@name\"] == \"Register Event\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Register Event",
"target_job_id": "6401c526-1f9a-4b24-ae1d-e03bdb57a509"
}
}
},
"Upsert-Risk-and-Vulnerability-Assessment---Service-Referral": {
"id": "51e36328-5cfb-4063-a2b2-4d11d312ac9d",
"name": "Upsert Risk and Vulnerability Assessment - Service Referral",
"inserted_at": "2024-11-04T14:40:47.589517Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "516c4ea9-c941-4fd8-b86b-0b65fce30250",
"type": "webhook"
}
},
"jobs": {
"Upsert-Risk-and-Vulnerability-Assessment---Service-Referral": {
"id": "3cef6846-e9f4-41ff-967d-e29d76faab0b",
"name": "Upsert Risk and Vulnerability Assessment - Service Referral",
"body": "// Your job goes here.\nalterState(state => {\n function split(str, separator) {\n if (!str) {\n return [];\n } else {\n return str.toString().split(separator);\n }\n }\n function checked(key, str) {\n if (!str) return false;\n return split(str.toString(), ' ').indexOf(key) >= 0;\n }\n\n function capitalizeFirstLetter(str) {\n if (!str) return;\n let new_str = str.toString().toLowerCase();\n return new_str.slice(0, 1).toUpperCase() + new_str.slice(1);\n }\n\n function transformDont(str) {\n if (!str) return str;\n return split(str.toString(), '_')\n .map(word => word.replace(/dont/i, \"don't\"))\n .join('_')\n .toString()\n .trim();\n }\n\n function transformCant(str) {\n if (!str) return str;\n return split(str.toString(), '_')\n .map(word => word.replace(/cant/i, \"can't\"))\n .join('_')\n .toString()\n .trim();\n }\n\n function splitAndJoin(str, splitDelimiter, joinDelimiter) {\n if (!str) return;\n\n return split(str.toString(), splitDelimiter).join(joinDelimiter).toString().trim();\n }\n\n function transformHowOften(str) {\n if (!str) return;\n if (str === 'special_occasions') return 'Special Occasions';\n if (str === 'no_dont_want_to_disclose') return \"Don't want to disclose\";\n if (str === 'dont_want_to_disclose') return \"Don't want to disclose\";\n return transformGenericText(str).toString().trim();\n }\n\n function transformHIVStatus(status) {\n switch (status) {\n case 'yes_negative':\n return 'Yes,Negative';\n case 'yes_positive':\n return 'Yes,Positive';\n case 'no_i_dont':\n return \"No,I don't know\";\n case 'yes_dont_want_to_disclose':\n return \"Yes, don't want to disclose\";\n default:\n return;\n }\n }\n\n function transformLastTested(str) {\n if (!str) return;\n switch (str.toString()) {\n case 'yes_negative':\n return 'Yes,Negative';\n case 'yes_positive':\n return 'Yes,Positive';\n case 'no_i_dont':\n return \"No,I don't know\";\n case 'yes_dont_want_to_disclose':\n return \"Yes, don't want to disclose\";\n default:\n return;\n }\n }\n\n function transformMonthAgo(str) {\n if (!str) return;\n switch (str) {\n case 'month_ago':\n return '1 month ago';\n case 'months_ago':\n return '3 months ago';\n case 'month_ago':\n return 'copy-1-of-months_ago ';\n case 'month_ago':\n return '6 months ago';\n case 'a_year_or_more_ago':\n return 'A year or more';\n default:\n return;\n }\n }\n\n function transformGenericText(str) {\n if (!str) return;\n return capitalizeFirstLetter(splitAndJoin(transformDont(str), '_', ' '))\n .toString()\n .trim();\n }\n\n function transformRange(range) {\n if (!range) return;\n return range\n .toString()\n .replace(/\\d_\\d/i, match => match.replace('_', '-'))\n .toString()\n .trim();\n }\n\n function transformAgeRange(range) {\n if (!range) return;\n if (range === '10_years') return '< 10 years';\n if (range === 'greater_than_19') return '> 19 years';\n return capitalizeFirstLetter(transformDont(transformCant(splitAndJoin(transformRange(range), '_', ' '))))\n .toString()\n .trim();\n }\n\n function transformAbuseExperienced(str) {\n if (!str) return;\n return split(str, ' ')\n .map(word => capitalizeFirstLetter(word))\n .join(';')\n .toString()\n .trim();\n }\n\n function getAge(dateString) {\n if (!dateString) return;\n\n const today = new Date();\n const birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n }\n\n state.data.perform_a_risk_assessment = state.data.form.do_you_want_to_perform_a_risk_assessment === 'yes';\n\n state.data.complete_service_referrals = state.data.form.referral_services ? true : false;\n\n state.data.form.client_information.gender = capitalizeFirstLetter(state.data.form.client_information.gender);\n\n state.helperFunctions = {\n split,\n checked,\n transformAgeRange,\n transformHIVStatus,\n transformLastTested,\n transformMonthAgo,\n transformGenericText,\n transformDont,\n splitAndJoin,\n transformHowOften,\n transformAbuseExperienced,\n getAge,\n };\n return state;\n});\n\nupsertIf(\n dataValue('perform_a_risk_assessment'),\n 'Risk_Assessment__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n field('Date__c', dataValue('form.risk_assessment.date')),\n field('Participant_Name__c', dataValue('form.client_information.participant_full_name')),\n field('Participant_Age__c', state => {\n const dob = dataValue('form.client_information.date_of_birth')(state);\n\n return state.helperFunctions.getAge(dob);\n }),\n relationship('Site2__r', 'CommCare_Ext_ID__c', dataValue('form.client_information.site')),\n relationship('EventLink__r', 'CommCare_Ext_ID__c', dataValue('form.client_information.intervention_name')),\n relationship('Venue__r', 'CommCare_Ext_ID__c', dataValue('form.client_information.venue')),\n\n field('Participant_Sex__c', dataValue('form.client_information.gender')),\n field('X1_0_Sexually_Active_past_12_month__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.sexual_risk_and_pregnancy.sexually_active_12_months')(state)\n )\n ),\n field('X1_1_Age_at_first_sex__c', state =>\n state.helperFunctions.transformAgeRange(\n dataValue('form.risk_assessment.sexual_risk_and_pregnancy.age_at_first_sex')(state)\n )\n ),\n field('X1_2_Have_you_ever_had_unprotected_sex__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.sexual_risk_and_pregnancy.have_you_ever_had_unprotected_sex')(state)\n )\n ),\n field('X1_3_Sex_for_monetary_or_material_benefi__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.sexual_risk_and_pregnancy.sex_monetary_material')(state)\n )\n ),\n field('Do_you_know_your_HIV_status__c', state =>\n state.helperFunctions.transformHIVStatus(\n dataValue('form.risk_assessment.hiv_status.do_you_know_your_hiv_status')(state)\n )\n ),\n field('X2_1_When_last_did_you_test_for_HIV__c', state =>\n state.helperFunctions.transformMonthAgo(\n dataValue('form.risk_assessment.hiv_status.when_last_did_you_test_for_hiv')(state)\n )\n ),\n field('X2_2_Are_you_on_treatment_ART__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.hiv_status.are_you_on_treatment_art')(state)\n )\n ),\n field('X3_0_Had_an_STI_in_the_last_12months_yea__c', state =>\n state.helperFunctions.transformHowOften(dataValue('form.risk_assessment.sti_and_pep.hiv_last_12_months')(state))\n ),\n field('X3_1_Past_12_months_sex_HIV_status_part__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.sti_and_pep.knowing_partners_hiv_status')(state)\n )\n ),\n field('X4_0_Forms_of_abuse_experienced_before__c', state => {\n const abusesArray = state.helperFunctions.split(\n dataValue('form.risk_assessment.gender_based_violence.abuse_experienced')(state),\n ' '\n );\n const abuses = [];\n abusesArray.forEach(ab => {\n abuses.push(state.helperFunctions.transformGenericText(ab));\n });\n return abuses.join(';');\n }),\n field('X4_1_Feel_unsafe_any1_interact_with_ofte__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.gender_based_violence.unsafe_with_others')(state)\n )\n ),\n field('X4_2_Of_what_relationship_person_to_you__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.gender_based_violence.relationship_of_abuser')(state)\n )\n ),\n field('X5_0_Do_you_take_alcohol_or_drugs__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.drugs_and_alcohol_use.do_you_take_alcohol_andor_drugs')(state)\n )\n ),\n field('X5_1_On_average_how_often_drink_alcohol__c', state =>\n state.helperFunctions.transformHowOften(\n dataValue('form.risk_assessment.drugs_and_alcohol_use.how_often_alcohol')(state)\n )\n ),\n field('X5_2_On_average_how_often_take_drugs__c', state =>\n state.helperFunctions.transformHowOften(\n dataValue('form.risk_assessment.drugs_and_alcohol_use.how_often_drugs')(state)\n )\n ),\n field('X5_3_Easy_for_teens_to_obtain_alcohol__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.drugs_and_alcohol_use.alcohol_19')(state)\n )\n ),\n field('X5_4__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.risk_assessment.drugs_and_alcohol_use.illegal_drugs_19')(state)\n )\n )\n )\n);\n\nfn(state => {\n state.data.intervention_name = state.data.form.client_information.intervention_name\n ? [relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('form.client_information.intervention_name'))]\n : [];\n\n return state;\n});\n\nupsertIf(dataValue('complete_service_referrals'), 'NewReferral__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n field('CommCare_Ext_ID__c', state => {\n if (state.data.form.subcase_0.case) return state.data.form.subcase_0.case['@case_id'];\n else if (state.data.form.referral_services) {\n if (state.data.form.referral_services.art_support_services.skillz_plus_club_details)\n return state.data.form.referral_services.art_support_services.skillz_plus_club_details\n .create_skillz_plus_club_participant_case.case['@case_id'];\n }\n return undefined;\n }),\n field('Participants_Full_Name__c', dataValue('form.client_information.participant_full_name')),\n field('Service_Provider_Name__c', dataValue('form.client_information.coach_name')),\n field('Parent_Guardian_Full_Name__c', dataValue('form.parent__guardian_information.parent__guardian_full_name')),\n field('Relationship__c', dataValue('form.parent__guardian_information.relationship_to_client')),\n //field('', dataValue('form.parent__guardian_information.please_specify')),\n field('Parent_Guardian_Contact_Number__c', dataValue('form.parent__guardian_information.contact_number')),\n //field('', dataValue('form.parent__guardian_information.guardian_consent')),\n field('Institution_Referred_To_1__c', dataValue('form.referral_information.institution_referred_to')),\n field('Institution_Referred_To_2__c', dataValue('form.referral_information.copy-1-of-institution_referred_to')),\n field('Institution_Referred_To_3__c', dataValue('form.referral_information.copy-2-of-institution_referred_to')),\n field('HIV_Testing_Services_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'hiv_testing_services',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HIV_Other__c', dataValue('form.referral_services.hiv_support__care.please_specify')),\n field('ART_Initiation_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'art_initiationenrollment',\n dataValue('form.referral_services.art_support_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('SKILLZ_Plus_Club_Support_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'grs_skillz_plus_club',\n dataValue('form.referral_services.art_support_services.skillz_plus_club_option')(state)\n )\n ),\n field('PMTCT_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'pmtct',\n dataValue('form.referral_services.art_support_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('VMMC_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'vmmc',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('TB_Screening_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'tb_screening_treatment_adherence',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Legal_Other__c', dataValue('form.referral_services.legal_services.please_specify_other_legal')),\n field('Post_Exposure_Prophylaxis_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'post_exposure_prophylaxis',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('PrEP_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'prep',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HIV_STI_PREVENTION_Other_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HIV_Other__c', dataValue('form.referral_services.hiv_support__care.please_specify')),\n field(\n 'Victim_Friendly_Services_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'suspected_abuse_reported_police_court_other_authority',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'post_violence_care_medical_legal_counseling',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'child_support_grant_social_foster_general_support',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'other',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n )\n ),\n\n field('Sexual_and_GBV_Abuse_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'sexual__gender-based_violenceabus',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n\n // field('missing in SF', dataValue('form.referral_services.child_protection_support_services.type_of_post_violence_care')),\n // field('missing in SF', dataValue('form.referral_services.child_protection_support_services.child_support_grant_for')),\n field(\n 'Legal_Services_Other_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.legal_services.legal_services')(state)\n ) ||\n state.helperFunctions.checked('id', dataValue('form.referral_services.legal_services.legal_services')(state)) ||\n state.helperFunctions.checked(\n 'birth_bertificate',\n dataValue('form.referral_services.legal_services.legal_services')(state)\n )\n ),\n field('Legal_Other__c', dataValue('form.referral_services.legal_services.please_specify_other_legal')),\n field('IPTG_Health_Facility__c', state =>\n state.helperFunctions.checked(\n 'iptg_to_health_facility',\n dataValue('form.referral_services.mental_health_services.mental_health_select_services')\n )\n ),\n field('IPTG_Specialized_to_SMZ__c', state =>\n state.helperFunctions.checked(\n 'iptg_specialised_to_smz',\n dataValue('form.referral_services.mental_health_services.mental_health_select_services')\n )\n ),\n field('STI_Screen_Testing_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'sti_screening_diagnosis_treatment',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Contraception_Family_Plan_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'contraceptivesfamily_planning',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Cervical_Cancer_Screening_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'cervical_cancer_screening',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HPV_vaccine_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'hpv',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Antenatal_Care_ANC_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'antenatal_care_anc',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n\n field(\n 'Psycho_Social_Support_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'drug_or_alcohol_abuse',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n ) ||\n state.helperFunctions.checked(\n 'psychiatric_careintensive_counseling',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n ) ||\n state.helperFunctions.checked(\n 'psychosocial_support',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Psycho_Social_Services_Other_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Psycho_Other__c', dataValue('form.referral_services.other_srhr_services.please_specify_srhr_referred')),\n\n field('Date_Referred__c', dataValue('form.follow-up.date_referred')),\n field('Expected_Visit_Date__c', dataValue('form.follow-up.expected_visit_date')),\n field('Client_Follow_up_Consent_given__c', state =>\n state.helperFunctions.checked('client_follow-up_consent_given', dataValue('form.follow-up.select')(state))\n ),\n field('Client_Linked_to_care__c', state =>\n state.helperFunctions.checked('client_linked_to_care', dataValue('form.follow-up.select')(state))\n ),\n\n field('Business_Unit_Site__c', state => {\n const bu = dataValue('form.client_information.business_unit')(state);\n return bu === '65680f0c4c144b03ad0f86bdc46c1ebc'\n ? 'GRS Zambia'\n : bu === '04d98397e28046118fade28ced6b65cb'\n ? 'GRS Zimbabwe'\n : bu === 'ed125ab19ec34aacab79585e59eb76f4'\n ? 'GRS Partnerships'\n : undefined;\n })\n ),\n ...fields(...state.data.intervention_name),\n}));\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Risk-and-Vulnerability-Assessment---Service-Referral": {
"enabled": true,
"id": "417c9fe6-22a8-4d43-a351-5475d939fff5",
"source_trigger_id": "516c4ea9-c941-4fd8-b86b-0b65fce30250",
"condition_expression": "state.data.form[\"@name\"] == \"Risk & Vulnerability Assessment | Service Referral - Treatment, Care and Support\" && state.data.form[\"client_information\"][\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Risk & Vulnerability Assessment | Service Referral",
"target_job_id": "3cef6846-e9f4-41ff-967d-e29d76faab0b"
}
}
},
"Upsert-Service-Referral": {
"id": "6f4a1286-365b-41c2-8d6f-4713083f181b",
"name": "Upsert Service Referral",
"inserted_at": "2024-11-04T14:41:00.123051Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "f971464c-8fb8-4fea-8063-6d1bab6529ce",
"type": "webhook"
}
},
"jobs": {
"Upsert-Service-Referral": {
"id": "97346bba-3a1b-40f5-b292-2cdfdc0050fd",
"name": "Upsert Service Referral",
"body": "alterState(state => {\n function checked(key, str) {\n if (!str) return false;\n return str.split(' ').indexOf(key) >= 0;\n }\n\n state.helperFunctions = { checked };\n\n function capitalizeFirstLetter(str) {\n if (!str) return;\n let new_str = str.toString().toLowerCase();\n return new_str.slice(0, 1).toUpperCase() + new_str.slice(1);\n }\n\n function transform(value) {\n if (!value) return;\n switch (value.toString().trim()) {\n case 'Daughterson':\n return 'Daughter/Son';\n case 'Other_specify':\n return 'Other';\n case 'Single_never_married':\n return 'Single/Never Married';\n case 'Divorced__separated':\n return 'Divorced/separated';\n default:\n return value;\n }\n }\n\n state.data.form.parent__guardian_information.relationship_to_client = transform(\n capitalizeFirstLetter(state.data.form.parent__guardian_information.relationship_to_client)\n );\n\n return state;\n});\n\nalterState(state => {\n if (!state.data.form.subcase_0) {\n console.log('No referral services to upsert');\n return state;\n }\n return upsert(\n 'NewReferral__c',\n 'CommCare_Ext_ID__c',\n fields(\n // field('Enter_Partner_s_Name__c', dataValue('form.referral_information.institution_referred_to')),\n // field('Type_of_Referral__c', dataValue('form.referral_information.type_of_referral')),\n field('Participants_Full_Name__c', dataValue('form.client_registration.participant_full_name')),\n //field('Parent_Guardian_Contact_Number__c', dataValue('form.client_registration.mobile_number')),\n relationship('Event__r', 'CommCare_Case_ID__c', dataValue('form.event_name')),\n field('CommCare_Ext_ID__c', state => {\n var subid = state.data.form.subcase_0;\n return subid && subid !== '' ? state.data.form.subcase_0.case['@case_id'] : dataValue('id')(state); //Set external id to 'service' subcase if available, otherwise use formid\n }),\n //field('Venue__c', dataValue('form.client_registration.school_name')),\n //field('Grade__c', dataValue('form.client_registration.grade')),\n //field('Class__c', dataValue('form.client_registration.class')),\n field('Parent_Guardian_Full_Name__c', dataValue('form.parent__guardian_information.parent__guardian_full_name')),\n field('Relationship_To_Client__c', dataValue('form.parent__guardian_information.relationship_to_client')),\n field('Parent_Guardian_Contact_Number__c', dataValue('form.parent__guardian_information.contact_number')),\n field('Institution_Referred_To_1__c', dataValue('form.referral_information.institution_referred_to')),\n field('Institution_Referred_To_2__c', dataValue('form.referral_information.copy-1-of-institution_referred_to')),\n field('Institution_Referred_To_3__c', dataValue('form.referral_information.copy-2-of-institution_referred_to')),\n field('Service_Provider_Name__c', dataValue('form.hidden_props.coach_name')),\n field('HIV_Testing_Services_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'hiv_testing_services',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('VMMC_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'vmmc',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('TB_Screening_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'tb_screening_treatment_adherence',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Post_Exposure_Prophylaxis_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'post_exposure_prophylaxis',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('PrEP_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'prep',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HIV_STI_PREVENTION_Other_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HIV_Other__c', dataValue('form.referral_services.hiv_support__care.please_specify')),\n field('ART_Initiation_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'art_initiationenrollment',\n dataValue('form.referral_services.art_support_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('PMTCT_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'pmtct',\n dataValue('form.referral_services.art_support_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('SKILLZ_Plus_Club_Support_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'grs_skillz_plus_club',\n dataValue('form.referral_services.art_support_services.skillz_plus_club_option')(state)\n )\n ),\n field(\n 'Victim_Friendly_Services_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'suspected_abuse_reported_police_court_other_authority',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'post_violence_care_medical_legal_counseling',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'child_support_grant_social_foster_general_support',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n ) ||\n state.helperFunctions.checked(\n 'other',\n dataValue(\n 'form.referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to'\n )(state)\n )\n ),\n field('Business_Unit_Site__c', state => {\n const bu = dataValue('form.business_unit')(state);\n return bu === '65680f0c4c144b03ad0f86bdc46c1ebc'\n ? 'GRS Zambia'\n : bu === '04d98397e28046118fade28ced6b65cb'\n ? 'GRS Zimbabwe'\n : bu === 'ed125ab19ec34aacab79585e59eb76f4'\n ? 'GRS Partnerships'\n : undefined;\n }),\n field(\n 'Sexual_and_GBV_Abuse_GRS_Staff__c',\n dataValue('form.referral_services.child_protection_support_services.abuse_reported_to')\n ),\n\n field('Legal_Other__c', dataValue('form.referral_services.legal_services.please_specify_other_legal')),\n field(\n 'Legal_Services_Other_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.legal_services.legal_services')(state)\n ) ||\n state.helperFunctions.checked(\n 'id',\n dataValue('form.referral_services.legal_services.legal_services')(state)\n ) ||\n state.helperFunctions.checked(\n 'birth_bertificate',\n dataValue('form.referral_services.legal_services.legal_services')(state)\n )\n ),\n field('STI_Screen_Testing_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'sti_screening_diagnosis_treatment',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Contraception_Family_Plan_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'contraceptivesfamily_planning',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Cervical_Cancer_Screening_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'cervical_cancer_screening',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('HPV_vaccine_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'hpv',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Antenatal_Care_ANC_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'antenatal_care_anc',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Sexual_and_GBV_Abuse_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'based_violenceabus',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field(\n 'Psycho_Social_Support_GRS_Staff__c',\n state =>\n state.helperFunctions.checked(\n 'drug_or_alcohol_abuse',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(\n state\n )\n ) ||\n state.helperFunctions.checked(\n 'psychiatric_careintensive_counseling',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(\n state\n )\n ) ||\n state.helperFunctions.checked(\n 'psychosocial_support',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(\n state\n )\n )\n ),\n field('Psycho_Social_Services_Other_GRS_Staff__c', state =>\n state.helperFunctions.checked(\n 'other',\n dataValue('form.referral_services.other_srhr_services.check_the_services_that_client_was_referred_to')(state)\n )\n ),\n field('Psycho_Other__c', dataValue('form.referral_services.other_srhr_services.please_specify_srhr_referred')),\n field('Date_Referred__c', dataValue('form.follow-up.date_referred')),\n field('Expected_Visit_Date__c', dataValue('form.follow-up.expected_visit_date')),\n field('Client_Follow_up_Consent_given__c', state =>\n state.helperFunctions.checked('client_follow-up_consent_given', dataValue('form.follow-up.select')(state))\n ),\n field('Client_Linked_to_care__c', state =>\n state.helperFunctions.checked('client_linked_to_care', dataValue('form.follow-up.select')(state))\n )\n )\n )(state);\n});\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Service-Referral": {
"enabled": true,
"id": "267cc48a-f962-4e40-98bc-c73bf26d16c8",
"source_trigger_id": "f971464c-8fb8-4fea-8063-6d1bab6529ce",
"condition_expression": "state.data.form[\"@name\"] == \"Service Referral\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Service Referral",
"target_job_id": "97346bba-3a1b-40f5-b292-2cdfdc0050fd"
}
}
},
"Upsert-Team-or-Group-Name": {
"id": "98560b10-c9fb-4717-b2fa-1e529253ab9d",
"name": "Upsert Team or Group Name",
"inserted_at": "2024-11-04T14:41:36.740550Z",
"lock_version": 2,
"triggers": {
"webhook": {
"enabled": true,
"id": "9bc8548a-adc8-496a-bbd0-489cee70ac22",
"type": "webhook"
}
},
"jobs": {
"Upsert-Team-or-Group-Name": {
"id": "f85536e2-7c7a-493a-9257-c2633f96f9e5",
"name": "Upsert Team or Group Name",
"body": "// Upsert event by unique 'Name'\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n fields(\n field(\n 'Class_Group_Team__c',\n dataValue('form.question_group.group__team_name')\n ),\n relationship('RecordType', 'Name', 'Intervention'), \n field(\n 'CommCare_Case_ID__c',\n dataValue('form.case.@case_id')\n ),\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Team-or-Group-Name": {
"enabled": true,
"id": "8fcf97a5-e6ce-43ae-927b-9fd655178d3f",
"source_trigger_id": "9bc8548a-adc8-496a-bbd0-489cee70ac22",
"condition_expression": "state.data.form[\"@name\"] == \"My Team/Group Name\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "My Team/Group Name",
"target_job_id": "f85536e2-7c7a-493a-9257-c2633f96f9e5"
}
}
},
"x-[archived]-Attendance": {
"id": "fa06ca4b-0d2e-4a12-8ba8-3f570cb989cd",
"name": "x [archived] Attendance",
"inserted_at": "2024-11-05T14:12:59.390397Z",
"lock_version": 4,
"triggers": {
"webhook": {
"enabled": true,
"id": "ebd2d0da-cf1d-4ac0-a98d-6dac4b8f5ef1",
"type": "webhook"
}
},
"jobs": {
"Attendance": {
"id": "a871e9b6-3037-4463-bcb5-f44ac11882d4",
"name": "Attendance",
"body": "query(`SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`);\n\nalterState(state => {\n // Note: lastReferenceValue selects the first item in the references array.\n state.data.eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n \n function getSessionValue(present) {\n switch (present.toString().toLowerCase()) {\n case 'yes':\n return 'X';\n case 'no':\n return 'A';\n case '':\n return 'N';\n default:\n return 'U';\n }\n }\n\n function getSessionId(session_text) {\n return session_text.toString().trim().slice(0, session_text.indexOf(' ')).slice(1);\n }\n\n function objectToArray(object) {\n if (!object) return [];\n return !Array.isArray(object) ? [object] : object;\n }\n\n state.data.form.attendance_list.update_participant_cases.item = objectToArray(\n state.data.form.attendance_list.update_participant_cases.item\n );\n\n const sessionText = dataValue('form.attendance_list.session')(state);\n const sessionId = getSessionId(sessionText);\n\n // @aleksa-krolls confirm the path for the session date\n const sessionDate = dataValue(\"form.case['@date_modified']\")(state);\n\n state.data.form.attendance_list.update_participant_cases.item =\n state.data.form.attendance_list.update_participant_cases.item.map(item => {\n const sessionValue = getSessionValue(item.attendance_session);\n return {\n ...item,\n dynamicFields: { [`Session_${sessionId}__c`]: sessionValue, [`Session_${sessionId}_Date__c`]: sessionDate },\n };\n });\n\n return state;\n});\n\neach(\n merge(\n dataPath('form.attendance_list.update_participant_cases.item[*]'),\n fields(\n field('intervention_name', dataValue('form.intervention_name')),\n field('eventName', dataValue('eventName')),\n field('caseid', dataValue('form.case.@case_id'))\n )\n ),\n upsert('Attendance__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n relationship('Event__r', 'CommCare_Case_ID__c', dataValue('caseid')),\n //relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('eventName')),\n field('CommCare_Ext_ID__c', state => `${state.data['@id']}-${state.data.eventName}`),\n relationship('Person_Attendance__r', 'Participant_Identification_Number_PID__c', dataValue('@id'))\n ),\n ...state.data.dynamicFields,\n }))\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Attendance": {
"enabled": false,
"id": "77ee81b8-0239-49e5-b2a3-d4b07a5f1be8",
"source_trigger_id": "ebd2d0da-cf1d-4ac0-a98d-6dac4b8f5ef1",
"condition_expression": "state.data.form.attendance == \"1\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Attendance (Non Skillz Only)",
"target_job_id": "a871e9b6-3037-4463-bcb5-f44ac11882d4"
}
}
},
"Upsert-Intervention-Notes": {
"id": "c49dd420-bed3-4956-9560-2cd8870985c7",
"name": "Upsert Intervention Notes",
"inserted_at": "2024-11-08T12:21:37.385334Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "ca220364-43ca-4b32-a3db-192f365e72cd",
"type": "webhook"
}
},
"jobs": {
"Upsert-Intervention-Notes": {
"id": "fb13350e-0daf-4b93-b176-3e8b874b31f4",
"name": "Upsert Intervention Notes",
"body": "//openfn.org source \nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n fields(\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n //field('Name', dataValue('form.intervention_name')),\n field('Notes__c', dataValue('form.intervention_notes_to_save')),\n relationship('RecordType', 'Name', 'Intervention')\n )\n);\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Upsert-Intervention-Notes": {
"enabled": true,
"id": "d4c78f5e-e633-46fc-9ff7-c8a644187a19",
"source_trigger_id": "ca220364-43ca-4b32-a3db-192f365e72cd",
"condition_expression": "state.data.form[\"@name\"] == \"Intervention Notes\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Intervention Notes",
"target_job_id": "fb13350e-0daf-4b93-b176-3e8b874b31f4"
}
}
},
"Upsert-Post-Challenges": {
"id": "83fc9c00-7aac-43d1-b579-d792e0c09efd",
"name": "Upsert Post Challenges",
"inserted_at": "2024-11-08T12:22:12.565130Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "4103bc37-484c-46b5-bccf-ef495b3e8ca2",
"type": "webhook"
}
},
"jobs": {
"Upsert-Post-Challenges": {
"id": "055113e1-7e78-49ac-9655-acec44e614c2",
"name": "Upsert Post Challenges",
"body": "fn(state => {\n function transform(value) {\n if (!value) return;\n switch (value.toString().trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case 'agree':\n case 'concordo':\n case 'verdade':\n case 'copy-1-of-yes':\n case 'choice1':\n return 1;\n case 'false':\n case 'no':\n case 'disagree':\n case 'discordo':\n case 'falso':\n case 'copy-1-of-no':\n case 'choice3': \n case 'choice6': \n return 2;\n case 'i_dont_know':\n case 'na':\n return 3;\n case 'unanswered':\n case `not_sexually_active`:\n return 4;\n case 'not_applicable':\n return 5;\n default:\n return value;\n }\n }\n\n state.helperFunctions = { transform };\n\n return query(\n `SELECT Participant_Identification_Number_PID__c from Person__c where Participant_Identification_Number_PID__c = '${state.data.form.case['@case_id']}'`\n )(state);\n});\n\nfn(state => {\n const { form } = state.data;\n\n const formVersion = Object.keys(form).find(key => key.includes('challenge'));\n if (formVersion == 'post_challenge_ecap_-_post_-_season_survey_for_athletes') {\n console.log('Skipping upsert for ECAP data');\n return { ...state, formVersion };\n }\n console.log('form version', formVersion);\n\n const sfFieldMapping = {\n 'portuguese_pre_challenge_gcr_-_skillz_malaria': {\n Post_1__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.dormir_dentro_da_rede_mosquiteira_tratada_todas_as_noites_pode_proteger_me_',\n Post_2__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.posso_esperar_uns_dias_antes_de_fazer_o_teste_de_malria_se_tiver_febres',\n Post_3__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.um_mdico_tradicionalcurandeiro_pode_me_dar_um_tratamento_para_curar_a_malri',\n Post_4__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.se_tiver_malria_e_no_for_tratado_posso_transmitir_a_malria_a_algum',\n Post_5__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.somente_as_mulheres_grvidas_e_as_crianas_menores_de_5_anos__que_precisam_de',\n Post_6__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.a_malria_pode_matar_se_no_fr_tratada',\n Post_7__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.a_febre__um_sintoma_da_malria',\n Post_8__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.eu_me_sinto_bem_conmigo_mesmo',\n Post_9__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.tenho_algum_na_minha_vida_que_pode_me_dar_bons_conselhos_quando_preciso_de_',\n Post_10__c:\n 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.eu_sei_onde_posso_ter_tratamento_para_malria_na_minha_comunidade',\n Post_11__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.posso_proteger-me_da_malria',\n },\n\n 'post_challenge_south_africa_-_skillz_girl': {\n Post_1__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_have_an_older_person_in_my_life_i_can_go_to_for_advice_i_have_an_older_pe',\n Post_2__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_know_how_to_make_a_plan_to_deal_with_the_challenges_i_may_face_in_reachin',\n Post_3__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Post_4__c: 'form.post_challenge_south_africa_-_skillz_girl.every_day_i_can_find_something_to_be_grateful_for',\n Post_5__c:\n 'form.post_challenge_south_africa_-_skillz_girl.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Post_6__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Post_7__c:\n 'form.post_challenge_south_africa_-_skillz_girl.girls_have_a_greater_risk_of_contracting_hiv_than_boys',\n Post_8__c:\n 'form.post_challenge_south_africa_-_skillz_girl.if_i_am_sexually_active_i_go_to_a_clinic_to_get_protection_from_hivstis_and',\n Post_9__c: 'form.post_challenge_south_africa_-_skillz_girl.like_physical_health_we_all_have_mental_health',\n Post_10__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_11__c:\n 'form.post_challenge_south_africa_-_skillz_girl.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Post_12__c:\n 'form.post_challenge_south_africa_-_skillz_girl.if_a_girl_is_sexually_abused_she_can_reduce_her_risk_of_getting_hiv_by_goin',\n Post_13__c:\n 'form.post_challenge_south_africa_-_skillz_girl.sometimes_a_man_may_have_a_good_reason_to_hit_his_partner',\n Post_14__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Post_15__c:\n 'form.post_challenge_south_africa_-_skillz_girl.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Post_16__c:\n 'form.post_challenge_south_africa_-_skillz_girl.if_sexually_active_i_or_my_partner_is_using_a_prevention_method_to_protect_',\n Post_17__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_know_where_to_go_to_receive_counselling_for_mental_health_challenges',\n Post_18__c:\n 'form.post_challenge_south_africa_-_skillz_girl.loss_of_interest_in_funenjoyable_activities_is_a_common_sign_of_depression',\n Post_19__c:\n 'form.post_challenge_south_africa_-_skillz_girl.i_know_at_least_three_methods_to_prevent_an_unwanted_pregnancy',\n },\n 'portuguese_post_challenge_gcr_-_skillz_girl': {\n Post_1__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.falei_sobre_o_hiv_com_uma_pessoa_adulta_nos_ltimos_2_meses_fora_do_skillz',\n Post_2__c: 'form.portuguese_post_challenge_gcr_-_skillz_girl.sei_como_expressar_a_minha_raiva_sem_ser_violento',\n Post_3__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.sei_como_superar_os_desafios_que_possa_enfrentar_na_minha_vida',\n Post_4__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.sei_quais_as_decises_a_tomar_para_alcanar_os_meus_objectivos',\n Post_5__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.os_rapazes_correm_um_risco_mais_elevado_de_serem_vtimas_de_violncia_do_que_',\n Post_6__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.conheco_que_mudanas_ocorrem_no_meu_corpo_durante_a_puberdade',\n Post_7__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.conheo_pelo_menos_trs_mtodos_para_evitar_uma_gravidez_indesejada',\n Post_8__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.os_preservativos_so_o_nico_mtodo_contraceptivo_que_protege_contra_a_gravide',\n Post_9__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.conheco_onde_obter_servios_de_apoio_para_mim_ou_outra_pessoa_para_casos_de_',\n Post_10__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.se_uma_rapariga_inicia_seu_perodo_menstrual_significa_que_est_pronta_para_c',\n Post_11__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.caso_eu_seja_abusada_sexualmente_prefiro_guard-lo_para_mim_para_evitar_que_',\n Post_12__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.um_homem_tem_o_direito_de_ter_sexo_com_a_sua_namorada_mesmo_que_ela_no_o_qu',\n Post_13__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.pessoas_com_problemas_de_sade_mental_so_apenas_confusas_ou_loucas',\n Post_14__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.pessoas_com_problemas_de_sade_mental_so_apenas_confusas_ou_loucas',\n Post_15__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.informaria_a_algum_caso_fosse_tocada_por_alguem_de_uma_forma_que_me_deixass',\n Post_16__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.uma_filha_deve_sempre_respeitar_a_deciso_dos_seus_pais_para_se_casar',\n Post_17__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.um_casamento_bem_sucedido__mais_importante_para_as_raparigas_do_que_termina',\n Post_18__c: 'form.portuguese_post_challenge_gcr_-_skillz_girl.eu_no_praticaria_desporto_com_algum_que_tem_hiv',\n Post_19__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.um_namorado_pode_ter_boas_razes_para_bater_na_sua_namorada',\n Post_20__c:\n 'form.portuguese_post_challenge_gcr_-_skillz_girl.no_faz_mal_que_um_rapaz_ameace_bater_na_sua_namorada_se_nunca_a_bater_fisic',\n },\n 'post_challenge_zambia_-_plus_mh_enhanced_zambia': {\n Post_1__c: 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.in_general_i_feel_good_about_myself',\n Post_2__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.i_have_the_skills_and_knowledge_to_avoid_getting_infected_with_another_kind',\n Post_3__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_important_to_know_why_and_how_i_want_to_tell_someone_my_hiv_status',\n Post_4__c: 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.i_accept_myself_and_my_hiv_status',\n Post_5__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Post_6__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.are_you_or_have_you_been_past_12_months_in_a_sexual_relationship_na_if_not_',\n Post_7__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n Post_8__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Post_9__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.there_are_people_i_trust_with_whom_i_can_talk_about_my_status',\n Post_10__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_okay_for_two_people_with_hiv_to_have_unprotected_sex_with_each_other',\n Post_11__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_okay_for_someone_with_hiv_to_stop_taking_their_arv_as_soon_as_they_st',\n Post_12__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.when_i_have_a_choice_it_is_important_to_eat_a_variety_of_foods_including_gr',\n Post_13__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.mental_health_problems_have_nothing_to_do_with_being_lazy_or_weak_and_many_',\n Post_14__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.art_adherence_is_an_important_part_of_my_overall_health_and_well-being',\n Post_15__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.the_most_common_illnesses_of_mental_health_are_depression_and_anxiety',\n Post_16__c:\n 'form.post_challenge_zambia_-_plus_mh_enhanced_zambia.biological_and_social_factors_contribute_to_females_and_males_experiencing_',\n },\n 'post_challenge_nigeria_-_advanced_skills': {\n Post_1__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_have_talked_about_hiv_with_an_adult_in_the_past_two_months_outside_skillz',\n Post_2__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_have_talked_about_malaria_with_an_adult_in_the_past_two_months_outside_sk',\n Post_3__c:\n 'form.post_challenge_nigeria_-_advanced_skills.unequal_power_in_relationships_can_contribute_to_the_spread_of_hiv',\n Post_4__c:\n 'form.post_challenge_nigeria_-_advanced_skills.the_most_effective_way_to_avoid_getting_hiv_is_to_abstain_from_sex',\n Post_5__c: 'form.post_challenge_nigeria_-_advanced_skills.malaria_is_spread_by_standing_under_the_hot_sun',\n Post_6__c: 'form.post_challenge_nigeria_-_advanced_skills.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Post_7__c:\n 'form.post_challenge_nigeria_-_advanced_skills.sleeping_under_a_mosquito_net_every_night_can_help_protect_me_from_malaria',\n Post_8__c:\n 'form.post_challenge_nigeria_-_advanced_skills.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Post_9__c:\n 'form.post_challenge_nigeria_-_advanced_skills.it_is_okay_for_someone_with_malaria_to_stop_taking_their_medication_as_soon',\n Post_10__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_can_abstain_from_sex_until_i_am_older_even_if_it_is_difficult',\n Post_11__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Post_12__c:\n 'form.post_challenge_nigeria_-_advanced_skills.men_should_share_the_work_around_the_house_such_as_cleaning',\n Post_13__c:\n 'form.post_challenge_nigeria_-_advanced_skills.it_is_the_males_responsibilty_to_make_decisions_in_a_relationship',\n Post_14__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_can_use_drugs_and_still_easily_reach_my_goals_in_life',\n Post_15__c:\n 'form.post_challenge_nigeria_-_advanced_skills.when_sick_it_is_better_to_visit_the_herb_seller_than_to_visit_a_doctor_or_a',\n Post_16__c:\n 'form.post_challenge_nigeria_-_advanced_skills.it_is_okay_to_use_violence_with_my_partner_if_he_or_she_makes_me_angry',\n Post_17__c:\n 'form.post_challenge_nigeria_-_advanced_skills.i_have_the_power_to_change_gender_expectations_that_i_do_not_agree_with',\n },\n 'post_challenge_zimbabwe_-_skillz_core_zimbabwe': {\n Post_1__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_know_what_decisions_to_make_to_achieve_my_goals',\n Post_2__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girlboy',\n Post_3__c: 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_what_i_am_good_at',\n Post_4__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Post_5__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Post_6__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Post_7__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_access_sexual_health_services_such_as_sti_and_hiv_testi',\n Post_8__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_9__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_10__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.girls_should_be_obedient_and_should_not_disagree_with_boys',\n Post_11__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Post_12__c: 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.my_skillz_coach_helps_me_to_be_a_better_person',\n Post_13__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Post_14__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.if_i_test_positive_for_hiv_there_will_be_someone_who_will_help_and_support_',\n Post_15__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_who_to_go_to_if_i_amsomeone_i_know_is_abused_sexually_physically_and',\n Post_16__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_who_to_go_to_if_someone_touches_me_in_a_way_that_makes_me_uncomforta',\n Post_17__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Post_18__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Post_19__c:\n 'form.post_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n },\n 'copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe': {\n Post_1__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_know_what_decisions_to_make_to_achieve_my_goals',\n Post_2__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_dont_always_have_to_do_what_people_expect_just_because_i_am_girlboy',\n Post_3__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Post_4__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_can_make_my_own_informed_decisions_about_my_sexual_health',\n Post_5__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_6__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_7__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.my_skillz_coach_helps_me_to_be_a_better_person',\n Post_8__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advise_or_when_i_have_a',\n Post_9__c:\n 'form.copy-1-of-post_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n },\n 'post_challenge_skillz_girl_-_zam_311': {\n Post_1__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_what_i_am_good_at',\n Post_2__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_how_to_overcome_challenges_that_i_may_face_in_my_life',\n Post_3__c: 'form.post_challenge_skillz_girl_-_zam_311.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girl',\n Post_4__c: 'form.post_challenge_skillz_girl_-_zam_311.i_would_be_able_to_ask_my_boyfriend_that_i_want_to_use_a_condom',\n Post_5__c: 'form.post_challenge_skillz_girl_-_zam_311.i_can_say_no_to_sex_even_if_my_boyfriend_or_friends_pressure_me_to_have_sex',\n Post_6__c: 'form.post_challenge_skillz_girl_-_zam_311.if_i_am_sexually_active_i_go_to_a_healthcare_provider_to_get_protection_fro',\n Post_7__c: 'form.post_challenge_skillz_girl_-_zam_311.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Post_8__c: 'form.post_challenge_skillz_girl_-_zam_311.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Post_9__c: 'form.post_challenge_skillz_girl_-_zam_311.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_10__c: 'form.post_challenge_skillz_girl_-_zam_311.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_or_wife',\n Post_11__c: 'form.post_challenge_skillz_girl_-_zam_311.a_successful_marriage_is_more_important_to_girls_than_completing_school',\n Post_12__c: 'form.post_challenge_skillz_girl_-_zam_311.a_daughter_should_always_respect_her_parents_decision_for_her_to_get_marrie',\n Post_13__c: 'form.post_challenge_skillz_girl_-_zam_311.i_can_decide_when_is_the_right_time_for_me_to_have_a_baby',\n Post_14__c: 'form.post_challenge_skillz_girl_-_zam_311.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Post_15__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Post_16__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_gender_base',\n Post_17__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_prevention_',\n Post_18__c: 'form.post_challenge_skillz_girl_-_zam_311.one_sign_of_pregnancy_is_a_girl_missing_her_period',\n Post_19__c: 'form.post_challenge_skillz_girl_-_zam_311.i_know_at_least_three_methods_to_avoid_an_unwanted_pregnancy',\n Post_20__c: 'form.post_challenge_skillz_girl_-_zam_311.are_you_or_your_boyfriend_currently_using_any_contraceptive_method',\n },\n 'post_challenge_skillz_core_zambia_211': {\n Post_1__c: 'form.post_challenge_skillz_core_zambia_211.question1',\n Post_2__c: 'form.post_challenge_skillz_core_zambia_211.i_know_how_to_overcome_challenges_i_may_have_in_my_life',\n Post_3__c: 'form.post_challenge_skillz_core_zambia_211.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Post_4__c: 'form.post_challenge_skillz_core_zambia_211.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_5__c: 'form.post_challenge_skillz_core_zambia_211.i_dont_always_have_to_do_what_people_expect_because_i_am_a_boygirl',\n Post_6__c: 'form.post_challenge_skillz_core_zambia_211.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_7__c: 'form.post_challenge_skillz_core_zambia_211.girls_should_not_disagree_with_boys',\n Post_8__c: 'form.post_challenge_skillz_core_zambia_211.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Post_9__c: 'form.post_challenge_skillz_core_zambia_211.i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Post_10__c: 'form.post_challenge_skillz_core_zambia_211.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Post_11__c: 'form.post_challenge_skillz_core_zambia_211.if_i_test_positive_for_hivthere_will_be_someone_who_will_help_and_support_m',\n Post_12__c: 'form.post_challenge_skillz_core_zambia_211.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Post_13__c: 'form.post_challenge_skillz_core_zambia_211.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Post_14__c: 'form.post_challenge_skillz_core_zambia_211.i_know_where_to_get_support_services_for_me_or_someone_elsefor_hiv_-_relate',\n Post_15__c: 'form.post_challenge_skillz_core_zambia_211.i_know_where_to_get_support_services_for_me_or_someone_elsefor_abuse',\n Post_16__c: 'form.post_challenge_skillz_core_zambia_211.i_have_the_right_to_access_sexual_health_servicessuch_as_sti_and_hiv_testin',\n Post_17__c: 'form.post_challenge_skillz_core_zambia_211.one_sign_of_pregnancy_is_a_girl_missing_her_period',\n Post_18__c: 'form.post_challenge_skillz_core_zambia_211.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Post_19__c: 'form.post_challenge_skillz_core_zambia_211.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n Post_20__c: 'form.post_challenge_skillz_core_zambia_211.i_know_what_decisions_to_make_to_achieve_my_goals',\n },\n 'post_challenge_skillz_boy_zambia110': {\n Post_1__c: 'form.post_challenge_skillz_boy_zambia110.in_general_i_feel_good_about_myself',\n Post_2__c: 'form.post_challenge_skillz_boy_zambia110.i_would_be_able_to_ask_my_girlfriend_that_i_want_to_use_a_condom',\n Post_3__c: 'form.post_challenge_skillz_boy_zambia110.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_boy',\n Post_4__c: 'form.post_challenge_skillz_boy_zambia110.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_5__c: 'form.post_challenge_skillz_boy_zambia110.it_is_more_important_for_boys_to_be_educated_than_girls',\n Post_6__c: 'form.post_challenge_skillz_boy_zambia110.men_are_better_leaders_than_women',\n Post_7__c: 'form.post_challenge_skillz_boy_zambia110.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_8__c: 'form.post_challenge_skillz_boy_zambia110.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Post_9__c: 'form.post_challenge_skillz_boy_zambia110.it_is_okay_for_a_boyfriend_to_threaten_to_hit_his_girlfriend_if_he_never_hi',\n Post_10__c: 'form.post_challenge_skillz_boy_zambia110.i_can_say_no_to_sex_even_if_my_friends_or_girlfriend_pressure_me_to_have_se',\n Post_11__c: 'form.post_challenge_skillz_boy_zambia110.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_sexual_behaviou',\n Post_12__c: 'form.post_challenge_skillz_boy_zambia110.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_13__c: 'form.post_challenge_skillz_boy_zambia110.i_have_a_friend_that_i_can_go_to_for_advice_when_i_have_a_problem',\n Post_14__c: 'form.post_challenge_skillz_boy_zambia110.i_have_the_right_to_access_sexual_health_services_such_as_hiv_and_sti_testi',\n Post_15__c: 'form.post_challenge_skillz_boy_zambia110.i_know_where_to_access_sexual_health_services_such_as_sti_and_hiv_testing',\n Post_16__c: 'form.post_challenge_skillz_boy_zambia110.before_making_a_decision_i_think_about_how_it_can_affect_me_or_others',\n Post_17__c: 'form.post_challenge_skillz_boy_zambia110.i_know_how_to_express_my_anger_without_being_violent_such_as_hitting_kickin',\n Post_18__c: 'form.post_challenge_skillz_boy_zambia110.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Post_19__c: 'form.post_challenge_skillz_boy_zambia110.i_know_how_to_correctly_use_a_male_condom',\n Post_20__c: 'form.post_challenge_skillz_boy_zambia110.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n },\n 'post_challenge_skillz_guyz_mh_-_sa_100':{\n Post_1__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_have_to_be_respectful_communicate_and_take_action_to_be_a_role_model_in_m',\n Post_2__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Post_3__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_can_identify_my_strengths_or_things_that_i_am_good_at',\n Post_4__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.when_i_am_angry_i_know_how_to_avoid_using_violent_behaviour',\n Post_5__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.when_i_express_my_feelings_clearly_people_understand_me_better',\n Post_6__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Post_7__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.sadness_and_a_loss_of_pleasure_in_things_you_enjoy_are_common_symptoms_of_d',\n Post_8__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_know_where_to_access_health_services_and_mental_health_services',\n Post_9__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_will_share_accurate_information_about_mental_health_services_to_avoid_sti',\n Post_10__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Post_11__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.men_should_share_the_work_around_the_house_such_as_cleaning_and_taking_care',\n Post_12__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.its_okay_for_a_guy_to_beat_a_girl_when_there_is_a_misunderstanding',\n Post_13__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_should_respect_the_rights_of_others_such_as_their_right_to_their_own_opin',\n Post_14__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_feel_confident_setting_my_goals',\n Post_15__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.stress_is_a_normal_part_of_life',\n Post_16__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Post_17__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.there_are_people_i_trust_with_whom_i_can_talk_to_about_my_mental_health',\n Post_18__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_have_no_fear_or_shame_when_accessing_health_services_or_mental_health_ser',\n Post_19__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Post_20__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Post_21__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_can_stand_up_to_peer_pressure_when_i_have_to',\n Post_22__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_should_use_a_condom_even_if_my_girlfriend_is_on_another_form_of_birth_con',\n Post_23__c: 'form.post_challenge_skillz_guyz_mh_-_sa_100.i_know_where_to_go_for_support_if_i_or_someone_i_know_abuses_alcohol',\n },\n 'post_challenge_mindskillz-_zambia_100': {\n Post_1__c:'form.post_challenge_mindskillz-_zambia_100.when_i_express_my_feelings_clearly_people_understand_me_better',\n Post_2__c:'form.post_challenge_mindskillz-_zambia_100.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Post_3__c:'form.post_challenge_mindskillz-_zambia_100.stress_is_a_normal_part_of_life',\n Post_4__c:'form.post_challenge_mindskillz-_zambia_100.i_can_reach_my_goals_in_life',\n Post_5__c:'form.post_challenge_mindskillz-_zambia_100.if_i_have_a_problem_i_have_someone_in_my_life_i_can_go_to_for_support',\n Post_6__c:'form.post_challenge_mindskillz-_zambia_100.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Post_7__c:'form.post_challenge_mindskillz-_zambia_100.self_control_helps_you_make_smart_decisions_when_you_are_angry_or_upset',\n Post_8__c:'form.post_challenge_mindskillz-_zambia_100.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Post_9__c:'form.post_challenge_mindskillz-_zambia_100.i_know_how_to_express_my_anger_without_being_violent',\n Post_10__c:'form.post_challenge_mindskillz-_zambia_100.listening_carefully_to_others_is_an_important_communication_skill',\n Post_11__c:'form.post_challenge_mindskillz-_zambia_100.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Post_12__c:'form.post_challenge_mindskillz-_zambia_100.i_can_understand_how_others_are_feeling_and_be_sensitive_to_their_emotions',\n Post_13__c:'form.post_challenge_mindskillz-_zambia_100.i_am_confident_that_i_know_where_to_seek_information_about_mental_illness',\n Post_14__c:'form.post_challenge_mindskillz-_zambia_100.i_am_confident_using_the_computer_or_telephone_to_seek_information_about_me',\n Post_15__c:'form.post_challenge_mindskillz-_zambia_100.i_am_confident_attending_face_to_face_appointments_to_seek_information_abou',\n Post_16__c:'form.post_challenge_mindskillz-_zambia_100.i_am_confident_i_have_access_to_resources_eg_doctor_internet_friends_that_i',\n Post_17__c:'form.post_challenge_mindskillz-_zambia_100.people_with_mental_illness_could_snap_out_of_it_if_they_wanted',\n Post_18__c:'form.post_challenge_mindskillz-_zambia_100.a_mental_illness_is_a_sign_of_personal_weakness',\n Post_19__c:'form.post_challenge_mindskillz-_zambia_100.a_mental_illness_is_not_a_real_medical_illness',\n Post_20__c:'form.post_challenge_mindskillz-_zambia_100.people_with_mental_illness_are_dangerous',\n Post_21__c:'form.post_challenge_mindskillz-_zambia_100.it_is_best_to_avoid_people_with_mental_illness_so_that_you_dont_develop_thi',\n Post_22__c:'form.post_challenge_mindskillz-_zambia_100.if_i_had_a_mental_illness_i_would_not_tell_anyone',\n Post_23__c:'form.post_challenge_mindskillz-_zambia_100.seeing_a_mental_health_professional_means_you_are_not_strong_enough_to_mana',\n Post_24__c:'form.post_challenge_mindskillz-_zambia_100.if_i_had_mental_illness_i_would_not_seek_help_from_a_mental_health_professi',\n Post_25__c:'form.post_challenge_mindskillz-_zambia_100.i_believe_treatment_for_a_mental_illness_provided_by_a_mental_health_profes',\n },\n \n 'post_challenge_skillz_girl_nih200': {\n Post_1__c:'form.post_challenge_skillz_girl_nih200.i_have_talked_about_hiv_with_an_adult_in_the_past_two_months_outside_skillz',\nPost_2__c:'form.post_challenge_skillz_girl_nih200.i_have_talked_about_hiv_with_a_friend_in_the_past_two_months_outside_skillz',\nPost_3__c:'form.post_challenge_skillz_girl_nih200.having_sex_with_an_older_partner_increases_my_risk_of_getting_hiv',\nPost_4__c:'form.post_challenge_skillz_girl_nih200.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\nPost_5__c:'form.post_challenge_skillz_girl_nih200.i_know_someone_in_my_community_who_distributes_contraceptives_and_other_sex',\nPost_6__c:'form.post_challenge_skillz_girl_nih200.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\nPost_7__c:'form.post_challenge_skillz_girl_nih200.i_have_the_right_to_say_no_to_sex_no_matter_who_asks',\nPost_8__c:'form.post_challenge_skillz_girl_nih200.as_a_girl_i_have_a_greater_risk_of_getting_hiv_than_boys',\nPost_9__c:'form.post_challenge_skillz_girl_nih200.i_know_where_to_get_support_services_for_rape',\nPost_10__c:'form.post_challenge_skillz_girl_nih200.if_a_girl_is_sexually_abused_she_can_reduce_her_risk_of_getting_hiv_by_taki',\nPost_11__c:'form.post_challenge_skillz_girl_nih200.i_feel_good_about_being_a_girl',\nPost_12__c:'form.post_challenge_skillz_girl_nih200.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\nPost_13__c:'form.post_challenge_skillz_girl_nih200.boys_should_share_the_work_around_the_home_such_as_household_chores',\nPost_14__c:'form.post_challenge_skillz_girl_nih200.i_know_what_i_want_to_be_after_finishing_secondary_school',\nPost_15__c:'form.post_challenge_skillz_girl_nih200.if_i_have_a_problem_i_have_someone_in_my_life_i_can_talk_to_for_advise',\nPost_16__c:'form.post_challenge_skillz_girl_nih200.a_boyfriend_may_have_good_reason_to_hit_his_girlfriend',\nPost_17__c:'form.post_challenge_skillz_girl_nih200.i_would_tell_someone_if_i_were_touched_in_a_manner_that_made_me_uncomfortab',\nPost_18__c:'form.post_challenge_skillz_girl_nih200.i_can_reach_my_goals_in_life',\nPost_19__c:'form.post_challenge_skillz_girl_nih200.a_girl_should_wait_to_get_married_until_after_college',\nPost_20__c:'form.post_challenge_skillz_girl_nih200.biological_and_social_factors_contribute_to_females_and_males_experiencing_',\nPost_21__c:'form.post_challenge_skillz_girl_nih200.the_most_common_illness_of_mental_health_are_depression_and_anxiety',\nPost_22__c:'form.post_challenge_skillz_girl_nih200.mental_health_problems_have_nothing_to_do_with_being_lazy_or_weak_and_many_',\nPost_23__c:'form.post_challenge_skillz_girl_nih200.i_am_ready_to_take_an_hiv_test',\nPost_24__c:'form.post_challenge_skillz_girl_nih200.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n },\n \n 'post_challenge_mindskillz_pamumvuri':{\n Post_1__c: 'form.post_challenge_mindskillz_pamumvuri.when_i_express_my_feelings_clearly_people_understand_me_better',\n Post_2__c: 'form.post_challenge_mindskillz_pamumvuri.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Post_3__c: 'form.post_challenge_mindskillz_pamumvuri.stress_is_a_normal_part_of_life',\n Post_4__c: 'form.post_challenge_mindskillz_pamumvuri.i_can_reach_my_goals_in_life',\n Post_5__c: 'form.post_challenge_mindskillz_pamumvuri.if_i_have_a_problem_i_have_someone_in_my_life_i_can_go_to_for_support',\n Post_6__c: 'form.post_challenge_mindskillz_pamumvuri.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Post_7__c: 'form.post_challenge_mindskillz_pamumvuri.self_control_helps_you_make_smart_decisions_when_you_are_angry_or_upset',\n Post_8__c: 'form.post_challenge_mindskillz_pamumvuri.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Post_9__c: 'form.post_challenge_mindskillz_pamumvuri.i_know_how_to_express_my_anger_without_being_violent',\n Post_10__c: 'form.post_challenge_mindskillz_pamumvuri.listening_carefully_to_others_is_an_important_communication_skill',\n Post_11__c: 'form.post_challenge_mindskillz_pamumvuri.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Post_12__c: 'form.post_challenge_mindskillz_pamumvuri.i_can_understand_how_others_are_feeling_and_be_sensitive_to_their_emotions',\n Post_13__c: 'form.post_challenge_mindskillz_pamumvuri.i_am_confident_that_i_know_where_to_seek_information_about_mental_illness',\n Post_14__c: 'form.post_challenge_mindskillz_pamumvuri.i_am_confident_using_the_computer_or_telephone_to_seek_information_about_me',\n Post_15__c: 'form.post_challenge_mindskillz_pamumvuri.i_am_confident_attending_face_to_face_appointments_to_seek_information_abou',\n Post_16__c: 'form.post_challenge_mindskillz_pamumvuri.i_am_confident_i_have_access_to_resources_eg_doctor_internet_friends_that_i',\n Post_17__c: 'form.post_challenge_mindskillz_pamumvuri.people_with_mental_illness_could_snap_out_of_it_if_they_wanted',\n Post_18__c: 'form.post_challenge_mindskillz_pamumvuri.a_mental_illness_is_a_sign_of_personal_weakness',\n Post_19__c: 'form.post_challenge_mindskillz_pamumvuri.a_mental_illness_is_not_a_real_medical_illness',\n Post_20__c: 'form.post_challenge_mindskillz_pamumvuri.people_with_mental_illness_are_dangerous',\n Post_21__c: 'form.post_challenge_mindskillz_pamumvuri.it_is_best_to_avoid_people_with_mental_illness_so_that_you_dont_develop_thi',\n Post_22__c: 'form.post_challenge_mindskillz_pamumvuri.if_i_had_a_mental_illness_i_would_not_tell_anyone',\n Post_23__c: 'form.post_challenge_mindskillz_pamumvuri.seeing_a_mental_health_professional_means_you_are_not_strong_enough_to_mana',\n Post_24__c: 'form.post_challenge_mindskillz_pamumvuri.if_i_had_mental_illness_i_would_not_seek_help_from_a_mental_health_professi',\n Post_25__c: 'form.post_challenge_mindskillz_pamumvuri.i_believe_treatment_for_a_mental_illness_provided_by_a_mental_health_profes',\n\n },\n \n 'post_challenge_south_africa_-_skillz_girl_mh_sa_211':{\n Post_1__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_my_rights_and_responsibilities',\n Post_2__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Post_3__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Post_4__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.stress_is_a_normal_part_of_life',\n Post_5__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.like_physical_health_we_all_have_mental_health',\n Post_6__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Post_7__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.healthy_relationships_are_based_on_healthy_communication_and_mutual_respect',\n Post_8__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_partner_or_wif',\n Post_9__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Post_10__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Post_11__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.taking_prep_and_using_a_condom_can_lower_my_risk_of_getting_hiv',\n Post_12__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_13__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Post_14__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.post_exposure_prophylaxis_pep_can_reduce_my_risk_of_getting_hiv_if_taken_1-',\n Post_15__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.it_is_my_right_to_access_health_services',\n Post_16__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_have_an_adult_or_someone_in_my_life_i_can_go_to_for_advice',\n Post_17__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_give_support_and_encouragement_to_a_friend_or_family_member_who_is_li',\n Post_18__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.using_a_condom_and_another_contraceptive_method_can_help_prevent_unwanted_p',\n Post_19__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Post_20__c: 'form.post_challenge_south_africa_-_skillz_girl_mh_sa_211.drinking_too_much_alcohol_can_harm_the_body_and_the_mind',\n },\n \n 'post_challenge_skillz_girl_abbreviated_south_africa':{\n Post_1__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_know_my_rights_and_responsibilities',\n Post_2__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Post_3__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Post_4__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.stress_is_a_normal_part_of_life',\n Post_5__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.like_physical_health_we_all_have_mental_health',\n Post_6__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Post_7__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.in_a_relationship_it_is_both_partners_responsibility_to_prevent_unwanted_pr',\n Post_8__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.healthy_relationships_are_based_on_healthy_communication_and_respect',\n Post_9__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_partner_or_wif',\n Post_10__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.a_person_has_the_right_to_have_sex_with_their_partner_even_if_the_partner_d',\n Post_11__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Post_12__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Post_13__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.taking_prep_and_using_a_condom_can_lower_my_risk_of_getting_hiv',\n Post_14__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_15__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Post_16__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_can_use_coping_skills_to_handle_stress',\n Post_17__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.post_exposure_prophylaxis_pep_can_reduce_my_risk_of_getting_hiv_if_taken_1-',\n Post_18__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.it_is_my_right_to_access_health_services',\n Post_19__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_have_an_adult_or_someone_in_my_life_i_can_go_to_for_advice',\n Post_20__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.using_a_condom_and_another_contraceptive_method_can_help_prevent_unwanted_p',\n Post_21__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Post_22__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.drinking_too_much_alcohol_can_harm_the_body_and_mind',\n Post_23__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_know_at_least_two_ways_of_saving_money',\n Post_24__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.a_budget_is_the_estimated_income_and_expenses_for_a_certain_time_period',\n Post_25__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.accepting_money_for_sexual_favors_can_create_risks_to_my_health_and_safety',\n Post_26__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.using_assertive_communication_means_respectfully_sharing_my_thoughts_and_fe',\n Post_27__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.i_have_the_right_to_access_emergency_contraception',\n Post_28__c: 'form.post_challenge_skillz_girl_abbreviated_south_africa.if_a_girl_has_unprotected_sex_and_misses_her_period_this_could_mean_she_is_',\n },\n \n 'post_challenge_skillz_guyz_-_yedi__323':{\n Post_1__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_know_how_to_stand_up_to_peer_pressure_ie_to_drink_alcohol_or_have_sex_fro',\n Post_2__c: 'form.post_challenge_skillz_guyz_-_yedi__323.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Post_3__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_have_someone_i_can_go_to_for_advice',\n Post_4__c: 'form.post_challenge_skillz_guyz_-_yedi__323.no_one_has_the_right_to_touch_me_in_a_way_that_makes_me_uncomfortable_such_',\n Post_5__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_6__c: 'form.post_challenge_skillz_guyz_-_yedi__323.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_behaviours_such',\n Post_7__c: 'form.post_challenge_skillz_guyz_-_yedi__323.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Post_8__c: 'form.post_challenge_skillz_guyz_-_yedi__323.a_mental_illness_is_a_sign_of_personal_weakness',\n Post_9__c: 'form.post_challenge_skillz_guyz_-_yedi__323.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Post_10__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Post_11__c: 'form.post_challenge_skillz_guyz_-_yedi__323.a_boys_opinion_is_more_important_than_a_girls',\n Post_12__c: 'form.post_challenge_skillz_guyz_-_yedi__323.men_should_share_the_work_around_the_house_such_as_cleaning_and_taking_care',\n Post_13__c: 'form.post_challenge_skillz_guyz_-_yedi__323.its_okay_for_a_guy_to_beat_a_girl_when_she_misbehaves',\n Post_14__c: 'form.post_challenge_skillz_guyz_-_yedi__323.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Post_15__c: 'form.post_challenge_skillz_guyz_-_yedi__323.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Post_16__c: 'form.post_challenge_skillz_guyz_-_yedi__323.condoms_are_the_only_contraceptive_method_that_protect_against_pregnancy_as',\n Post_17__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_would_stand_up_to_my_friends_if_they_were_harming_others_such_as_touching',\n Post_18__c: 'form.post_challenge_skillz_guyz_-_yedi__323.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Post_19__c: 'form.post_challenge_skillz_guyz_-_yedi__323.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_20__c: 'form.post_challenge_skillz_guyz_-_yedi__323.i_have_the_ability_to_shape_my_own_life',\n },\n \n 'post_challenge_skillz_girl_mh_zambia':{\n Post_1__c: 'form.post_challenge_skillz_girl_mh_zambia.a_mental_illness_is_a_sign_of_personal_weakness',\n Post_2__c: 'form.post_challenge_skillz_girl_mh_zambia.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Post_3__c: 'form.post_challenge_skillz_girl_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girl',\n Post_4__c: 'form.post_challenge_skillz_girl_mh_zambia.if_i_had_a_boyfriend_i_would_be_able_to_ask_him_to_use_a_condom_before_havi',\n Post_5__c: 'form.post_challenge_skillz_girl_mh_zambia.i_can_say_no_to_sex_even_if_my_boyfriend_or_friends_pressure_to_have_sex',\n Post_6__c: 'form.post_challenge_skillz_girl_mh_zambia.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Post_7__c: 'form.post_challenge_skillz_girl_mh_zambia.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Post_8__c: 'form.post_challenge_skillz_girl_mh_zambia.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Post_9__c: 'form.post_challenge_skillz_girl_mh_zambia.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Post_10__c: 'form.post_challenge_skillz_girl_mh_zambia.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_or_wife',\n Post_11__c: 'form.post_challenge_skillz_girl_mh_zambia.a_successful_marrige_is_more_important_to_girls_than_completing_school',\n Post_12__c: 'form.post_challenge_skillz_girl_mh_zambia.a_daughter_should_always_respect_her_parents_decision_to_get_married',\n Post_13__c: 'form.post_challenge_skillz_girl_mh_zambia.i_can_decide_when_is_the_right_time_for_me_to_have_a_baby',\n Post_14__c: 'form.post_challenge_skillz_girl_mh_zambia.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Post_15__c: 'form.post_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Post_16__c: 'form.post_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_gender_base',\n Post_17__c: 'form.post_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_prevention_',\n Post_18__c: 'form.post_challenge_skillz_girl_mh_zambia.if_sexually_active_one_sign_of_pregnance_is_a_girl_missing_her_period',\n Post_19__c: 'form.post_challenge_skillz_girl_mh_zambia.i_know_at_least_three_methods_to_avoid_an_unwanted_pregnancy',\n Post_20__c: 'form.post_challenge_skillz_girl_mh_zambia.are_you_or_your_boyfriend_currently_using_any_contraceptive_method',\n \n },\n \n 'post_challenge_skillz_core_mh_zambia':{\n Post_1__c: 'form.post_challenge_skillz_core_mh_zambia.i_know_what_i_am_good_at',\n Post_2__c: 'form.post_challenge_skillz_core_mh_zambia.i_know_how_to_overcome_challenges_that_i_may_have_in_life',\n Post_3__c: 'form.post_challenge_skillz_core_mh_zambia.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Post_4__c: 'form.post_challenge_skillz_core_mh_zambia.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_5__c: 'form.post_challenge_skillz_core_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girlboy',\n Post_6__c: 'form.post_challenge_skillz_core_mh_zambia.a_man_has_the_right_to_have_sex_with_his_wifegirlfriend_even_if_she_doesnt_',\n Post_7__c: 'form.post_challenge_skillz_core_mh_zambia.girls_should_not_disagree_with_boys',\n Post_8__c: 'form.post_challenge_skillz_core_mh_zambia.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Post_9__c: 'form.post_challenge_skillz_core_mh_zambia.i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Post_10__c: 'form.post_challenge_skillz_core_mh_zambia.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Post_11__c: 'form.post_challenge_skillz_core_mh_zambia.if_i_test_positive_for_hiv_there_will_be_someone_who_will_help_and_support_',\n Post_12__c: 'form.post_challenge_skillz_core_mh_zambia.people_with_mental_illness_live_on_the_streets_and_eat_dirty_food_from_garb',\n Post_13__c: 'form.post_challenge_skillz_core_mh_zambia.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Post_14__c: 'form.post_challenge_skillz_core_mh_zambia.i_only_use_violent_behaviour_when_someone_angers_me',\n Post_15__c: 'form.post_challenge_skillz_core_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_abuse_or_hi',\n Post_16__c: 'form.post_challenge_skillz_core_mh_zambia.i_have_the_right_to_access_sexual_health_services_such_as_sti_and_hiv_testi',\n Post_17__c: 'form.post_challenge_skillz_core_mh_zambia.if_sexually_active_one_sign_of_pregnancy_can_be_a_girl_missing_her_period',\n Post_18__c: 'form.post_challenge_skillz_core_mh_zambia.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Post_19__c: 'form.post_challenge_skillz_core_mh_zambia.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n Post_20__c: 'form.post_challenge_skillz_core_mh_zambia.i_know_what_decisions_to_make_to_achieve_my_goals',\n },\n \n 'post_challenge_skillz_guyz_mh_zambia':{\n Post_1__c: 'form.post_challenge_skillz_guyz_mh_zambia.a_mental_illness_is_a_sign_of_personal_weakness',\n Post_2__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_would_be_able_to_tell_my_girlfriend_that_i_want_to_use_a_condom',\n Post_3__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_boy',\n Post_4__c: 'form.post_challenge_skillz_guyz_mh_zambia.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Post_5__c: 'form.post_challenge_skillz_guyz_mh_zambia.it_is_more_important_for_boys_to_be_educated_than_girls',\n Post_6__c: 'form.post_challenge_skillz_guyz_mh_zambia.men_are_better_leaders_than_women',\n Post_7__c: 'form.post_challenge_skillz_guyz_mh_zambia.a_manboy_has_the_right_to_have_sex_with_his_girlfriendwomanwife_even_if_she',\n Post_8__c: 'form.post_challenge_skillz_guyz_mh_zambia.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Post_9__c: 'form.post_challenge_skillz_guyz_mh_zambia.it_is_okay_for_a_boyfriend_to_threaten_to_hit_his_girlfriend_if_he_never_hi',\n Post_10__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_can_say_no_to_sex_even_if_my_friends_or_girlfriend_pressure_me_to_have_se',\n Post_11__c: 'form.post_challenge_skillz_guyz_mh_zambia.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_sexual_behaviou',\n Post_12__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Post_13__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_have_a_friend_that_i_can_go_to_for_advice_when_i_have_a_problem',\n Post_14__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_have_the_right_to_access_sexual_health_services_such_as_hiv_and_sti_testi',\n Post_15__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_know_where_to_access_sexual_health_services_such_as_sti_and_hiv_testing',\n Post_16__c: 'form.post_challenge_skillz_guyz_mh_zambia.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Post_17__c: 'form.post_challenge_skillz_guyz_mh_zambia.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Post_18__c: 'form.post_challenge_skillz_guyz_mh_zambia.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Post_19__c: 'form.post_challenge_skillz_guyz_mh_zambia.i_know_how_to_correctly_use_a_male_condom',\n Post_20__c: 'form.post_challenge_skillz_guyz_mh_zambia.are_you_or_your_girlfriend_currently_using_any_contraceptive_or_protective_',\n \n }\n \n };\n\n const pluckSfValue = val => {\n // if sfFieldMapping[formVersion][val] == undefined\n return sfFieldMapping[formVersion][val];\n };\n\n return { ...state, formVersion, pluckSfValue };\n});\n\nfn(state => {\n if (state.formVersion == 'post_challenge_ecap_-_post_-_season_survey_for_athletes') {\n return state;\n }\n const PID = lastReferenceValue('records[0].Participant_Identification_Number_PID__c')(state);\n\n if (!PID) {\n console.log(\n `Participant not found with Participant_Identification_Number_PID__c: ${state.data.form.case['@case_id']}`\n );\n return state;\n }\n\n return upsert(\n 'Attendance__c',\n 'CommCare_Ext_ID__c',\n fields(\n //field('Event__c', dataValue('form.hidden_properties.intervention_name')),\n\n // field('CommCare_Ext_ID__c', state => {\n // const value =\n // dataValue('form.case.@case_id')(state) +\n // '-' +\n // toUTF8(dataValue('form.hidden_properties.intervention_name')(state)).replace(/\\//gi, '');\n // return scrubEmojis(value, '');\n // }),\n field(\"CommCare_Ext_ID__c\", (state) => {\n return toUTF8(`${dataValue(\"form.case.@case_id\")(state)}-${scrubEmojis(\n dataValue(\"form.hidden_properties.intervention_name\")(state),\n \"\"\n ).replace(/\\//gi, \"\")}`);\n }),\n\n //relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('form.hidden_properties.intervention_name')),\n relationship('Person_Attendance__r', 'Participant_Identification_Number_PID__c', dataValue('form.case.@case_id')),\n field('Pre_Post_Completed__c', state => {\n var done = dataValue('form.hidden_properties.post_questionnaire_complete')(state);\n return done === 'Yes' ? true : done === 'No' ? false : undefined;\n }),\n field('Date_Post_Administered__c', dataValue('form.hidden_properties.date')),\n field('Post_1__c', state => {\n const value = dataValue(state.pluckSfValue('Post_1__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_2__c', state => {\n if (state.pluckSfValue('Post_2__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_2__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n\n field('Post_3__c', state => {\n const value = dataValue(state.pluckSfValue('Post_3__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n\n field('Post_4__c', state => {\n const value = dataValue(state.pluckSfValue('Post_4__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n\n field('Post_5__c', state => {\n const value = dataValue(state.pluckSfValue('Post_5__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_6__c', state => {\n const value = dataValue(state.pluckSfValue('Post_6__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_7__c', state => {\n const value = dataValue(state.pluckSfValue('Post_7__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_8__c', state => {\n const value = dataValue(state.pluckSfValue('Post_8__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_9__c', state => {\n const value = dataValue(state.pluckSfValue('Post_9__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_10__c', state => {\n if (state.pluckSfValue('Post_10__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_10__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_11__c', state => {\n if (state.pluckSfValue('Post_11__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_10__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_12__c', state => {\n if (state.pluckSfValue('Post_12__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_12__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_13__c', state => {\n if (state.pluckSfValue('Post_13__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_13__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_14__c', state => {\n if (state.pluckSfValue('Post_14__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_14__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_15__c', state => {\n if (state.pluckSfValue('Post_15__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_15__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_16__c', state => {\n if (state.pluckSfValue('Post_16__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_16__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_17__c', state => {\n if (state.pluckSfValue('Post_17__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_17__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_18__c', state => {\n if (state.pluckSfValue('Post_18__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_18__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_19__c', state => {\n if (state.pluckSfValue('Post_19__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_19__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_20__c', state => {\n if (state.pluckSfValue('Post_20__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_20__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_21__c', state => {\n if (state.pluckSfValue('Post_21__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_21__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_22__c', state => {\n if (state.pluckSfValue('Post_22__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_22__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_23__c', state => {\n if (state.pluckSfValue('Post_23__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_23__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_24__c', state => {\n if (state.pluckSfValue('Post_24__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_24__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_25__c', state => {\n if (state.pluckSfValue('Post_25__c') == null) return undefined;\n const value = dataValue(state.pluckSfValue('Post_25__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Post_26__c', state => {\n if (state.pluckSfValue('Post_26__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Post_26__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Post_27__c', state => {\n if (state.pluckSfValue('Post_27__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Post_27__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Post_28__c', state => {\n if (state.pluckSfValue('Post_28__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Post_28__c'))(state); \n return state.helperFunctions.transform(value);\n }) \n )\n )(state);\n});\n\n//Removing mapping... need case_id to upsert Events. Date_of_Post__c update should be handled on the SF side.\n/*upsert(\n 'Event__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('form.hidden_properties.intervention_name')),\n field('Date_of_Post__c', dataValue('form.date')),\n )\n );*/\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Upsert-Post-Challenges": {
"enabled": true,
"id": "8550ac13-2f2d-489b-97a0-27b9484ec1a9",
"source_trigger_id": "4103bc37-484c-46b5-bccf-ef495b3e8ca2",
"condition_expression": "state.data.form[\"@name\"] == \"Post Challenges\" && state.data.form[\"hidden_properties\"][\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Post Challenges",
"target_job_id": "055113e1-7e78-49ac-9655-acec44e614c2"
}
}
},
"Create-Intervention": {
"id": "0bb1787f-8860-452f-a901-5870e97e0203",
"name": "Create Intervention",
"inserted_at": "2024-11-08T12:24:05.509412Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "ae0536ff-41ec-494f-9ca3-5c44cadbe87b",
"type": "webhook"
}
},
"jobs": {
"Create-Intervention": {
"id": "4c8de684-b14e-4db2-b3f3-e901b8290c77",
"name": "Create Intervention",
"body": "alterState((state) => {\n \n function clean(str) {\n if (!!str)\n return str\n .split('_')\n .map(word => {\n let new_word = word.toString().toLowerCase();\n return new_word.slice(0, 1).toUpperCase() + new_word.slice(1);\n })\n .join(' ');\n }\n \n state.data.form.delivery_method = clean(state.data.form.delivery_method);\n \n const coachFieldNames = ['Coach_A__r','Coach_B__r','Coach_C__r','Coach_D__r']\n \n state.data.destinationCoachFields = state.data.form.coaches\n .split(' ')\n .reduce(\n (accumulator, currentValue, currentIndex) => [\n ...accumulator,\n (currentIndex < coachFieldNames.length && !!currentValue\n ? relationship(coachFieldNames[currentIndex], 'CommCare_Ext_ID__c', currentValue)\n : []),\n ],\n []\n );\n \n return state; \n}); \n\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n state=>({\n ...fields(\n field('Name', dataValue('form.name_of_intervention')),\n field('CommCare_Ext_ID__c', state => {\n return dataValue('form.name_of_intervention')(state).replace(/\\//gi, ''); \n }),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n relationship('RecordType', 'Name', 'Intervention'),\n field('Business_Unit__c', state => {\n const bu = dataValue('form.business_unit')(state); \n return bu==='65680f0c4c144b03ad0f86bdc46c1ebc' ? 'GRS Zambia' : \n bu==='04d98397e28046118fade28ced6b65cb' ? 'GRS Zimbabwe' : \n bu==='ed125ab19ec34aacab79585e59eb76f4' ? 'GRS Partnerships': undefined ; \n }),\n relationship(\n 'Site__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.site')\n ),\n relationship(\n 'Venue__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.Venue')\n \n ),\n relationship(\n 'Curriculum__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.curriculum_selection.curriculum')\n ),\n // relationship(\n // 'Grant__r',\n // 'CommCare_Ext_ID__c',\n // dataValue('form.grant')\n // ),\n field('Delivery_Method__c', dataValue('form.delivery_method')),\n field('Class_Group_Team__c', dataValue('form.class_grade')),\n field('Pre_Post_Administered__c', dataValue('form.prepost_administered')),\n field('Start_Date__c', dataValue('form.intervention_dates.start_date')),\n field('End_Date__c', dataValue('form.intervention_dates.end_date'))\n ),\n ...fields(...state.data.destinationCoachFields)\n })\n);\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Create-Intervention": {
"enabled": true,
"id": "c801c1ce-9a97-48c4-9ba4-ec6713de9c53",
"source_trigger_id": "ae0536ff-41ec-494f-9ca3-5c44cadbe87b",
"condition_expression": "state.data.form[\"@name\"] == \"Create Intervention\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Create Intervention",
"target_job_id": "4c8de684-b14e-4db2-b3f3-e901b8290c77"
}
}
},
"Upsert-Register-Participant": {
"id": "75040cfe-8582-49bf-8a70-92ad66dde169",
"name": "Upsert Register Participant",
"inserted_at": "2024-11-08T12:24:44.854470Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "688cf1eb-09a9-4a68-bc91-38e084766645",
"type": "webhook"
}
},
"jobs": {
"Upsert-Register-Participant": {
"id": "7c00e1a1-1c1f-4cc8-9b9d-f67a048ea6d2",
"name": "Upsert Register Participant",
"body": "query(\n `SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`\n);\n\nfn(state => {\n // Note: lastReferenceValue selects the first item in the references array.\n state.data.eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n state.data.eventCase = dataValue('form.case.@case_id')(state);\n\n function objectToArray(object) {\n return !Array.isArray(object) ? [object] : object;\n }\n\n const { form } = state.data;\n if (form.question1) {\n console.log('Ensuring that \"question1\" is an array.');\n form.question1 = objectToArray(form.question1);\n } else if (!form.new_participants) {\n console.log('Nothing to upsert. No participants were registered');\n } else {\n console.log('Shifting \"new_participants\" to \"question1\" array.');\n form.question1 = objectToArray(form.new_participants);\n console.log('Creating a \"case\" object inside each item in that array.');\n form.question1 = form.question1.map(item => ({\n ...item,\n case: item.create_skillz_plus_participant.case,\n }));\n }\n\n console.log('Done with initial data manipulation.');\n const persons = merge(\n dataPath('form.question1[*]'),\n fields(field('intervention_notes_to_save', dataValue('form.intervention_notes_to_save')))\n )(state);\n\n const attendances = merge(\n dataPath('form.question1[*]'),\n fields(\n field('intervention_name', dataValue('form.intervention_name')),\n field('eventCase', dataValue('eventCase')),\n field('eventName', dataValue('eventName'))\n )\n )(state);\n\n return { ...state, persons, attendances };\n});\n\neach(\n 'persons[*]',\n upsert(\n 'Person__c',\n 'Participant_Identification_Number_PID__c',\n fields(\n field('Notes__c', dataValue('intervention_notes_to_save')),\n field('First_Name__c', dataValue('participant_first_name')),\n field('Surname__c', dataValue('participant_surname')),\n relationship('RecordType', 'Name', 'Participant'),\n relationship('Site__r', 'CommCare_Ext_ID__c', dataValue('grp_location.site_id')),\n field('Participant_Identification_Number_PID__c', state => state.data.case['@case_id']),\n field('Sex__c', dataValue('gender')),\n field('Mobile_Number_1__c', dataValue('mobile_number')), //QUESTION: In CommCare, phone doesn't look like it's saving?\n field('School_name_person__c', dataValue('school_name')),\n field('Date_of_Birth__c', dataValue('date_of_birth')),\n field('School_name_person__c', dataValue('school_name')),\n field('Physical_Address__c', dataValue('participants_home_address')),\n field('Age_1_0__c', dataValue('participants_age_to_save'))\n )\n )\n);\n\neach(\n 'attendances[*]',\n upsert(\n 'Attendance__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', state => {\n const eventid = toUTF8(`${state.data.intervention_name}` || `${state.data.eventName}`); //dataValue('intervention_name')(state) || `${state.data.eventName}`;\n const personid = state.data.case['@case_id'];\n const value = personid + '-' + eventid.replace(/\\//gi, '');\n return scrubEmojis(value, '');\n }),\n relationship(\n //Attendance looks up to Persn via the case_id\n 'Person_Attendance__r',\n 'Participant_Identification_Number_PID__c',\n state => state.data.case['@case_id']\n ),\n relationship(\n //Attendance looks up to Event via the Event case_id\n 'Event__r',\n 'CommCare_Case_ID__c',\n state => `${state.data.eventCase}`\n ),\n // relationship(\n // //Attendance looks up to Event via the intervention_name\n // 'Event__r',\n // 'CommCare_Ext_ID__c',\n // state => `${state.data.intervention_name}` || `${state.data.eventName}`\n // ),\n field('Date_of_Birth__c', dataValue('date_of_birth'))\n )\n )\n);\n\n//First we insert Person record\n// fn(state => {\n// return upsert(\n// 'Person__c',\n// 'Participant_Identification_Number_PID__c',\n// fields(\n// field('Notes__c', dataValue('form.intervention_notes_to_save')),\n// field('First_Name__c', dataValue('form.question1.participant_first_name')),\n// field('Surname__c', dataValue('form.question1.participant_surname')),\n// relationship('RecordType', 'Name', 'Participant'),\n// field('Participant_Identification_Number_PID__c', state => state.data.case['@case_id']),\n// field('Sex__c', dataValue('form.question1.gender')),\n// //field('Age__c', dataValue('form.question1.age_in_years')), //This is a SF formula field, cannot map\n// field('Mobile_Number_1__c', dataValue('form.question1.mobile_number')),\n// field('School_name_person__c', dataValue('form.question1.school_name'))\n// )\n// )(state);\n// });\n\n// fn(state => {\n// //Then we upsert related Attendance records\n// return upsert(\n// 'Attendance__c',\n// 'CommCare_Ext_ID__c',\n// fields(\n// field('CommCare_Ext_ID__c', state => {\n// var eventid = dataValue('form.intervention_name')(state);\n// var personid = dataValue('form.case.@case_id')(state);\n// return personid + '-' + eventid;\n// }),\n// relationship(\n// //Attendance looks up to Persn via the case_id\n// 'Person_Attendance__r',\n// 'Participant_Identification_Number_PID__c',\n// dataValue('form.case.@case_id')\n// ),\n// relationship(\n// //Attendance looks up to Event via the intervention_name\n// 'Event__r',\n// 'Name',\n// dataValue('form.intervention_name')\n// ),\n// field('Date_of_Birth__c', dataValue('form.question1.date_of_birth'))\n// )\n// )(state);\n// });\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Upsert-Register-Participant": {
"enabled": true,
"id": "02c68821-57b5-4f93-ab45-bad335b33e06",
"source_trigger_id": "688cf1eb-09a9-4a68-bc91-38e084766645",
"condition_expression": "state.data.form[\"@name\"] == \"Register Participant\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Register Participant",
"target_job_id": "7c00e1a1-1c1f-4cc8-9b9d-f67a048ea6d2"
}
}
},
"Coach-Session-Register": {
"id": "6318473c-96b3-4093-afe7-c39bb48e9518",
"name": "Coach Session Register",
"inserted_at": "2024-11-08T12:25:16.301665Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "34f0acc8-ef52-4896-b2a2-857ed1fe16a5",
"type": "webhook"
}
},
"jobs": {
"Coach-Session-Register": {
"id": "46881590-406f-4fab-8ae5-8beba39ba8bc",
"name": "Coach Session Register",
"body": "// push to production\nquery(\n `SELECT Coach_A__c, Coach_A__r.Name from Event__c where CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`\n);\n\nfn(state => {\n const present = dataValue('form.present')(state).toLowerCase();\n\n function getSessionValue() {\n let value;\n switch (present) {\n case 'yes':\n value = 'X';\n break;\n case 'no':\n value = 'A';\n break;\n case '':\n value = 'N';\n break;\n default:\n value = 'U';\n break;\n }\n return value;\n }\n\n const session_text = dataValue('form.session')(state);\n\n const session_id = session_text.trim().slice(0, session_text.indexOf(' ')).slice(1);\n console.log(\"session_id: \", session_id);\n\n const coachname = dataValue('form.coach_name')(state)\n ? dataValue('form.coach_name')(state)\n : state.references[0].records[0].Coach_A__r.Name;\n\n let external_id = `${dataValue('form.case.@case_id')(state)}\n ${coachname}`; //case_id + coach_name for external Id\n\n state.data.commcare_external_id = external_id.toLowerCase().replace(/\\s/g, '').trim();\n\n state.data.dynamicFields = [\n field(`Session_${session_id}__c`, getSessionValue()),\n field(`Session_${session_id}_Date__c`, dataValue('form.date')(state)),\n //field(`Session_${session_id}_Duration__c`, dataValue('form.duration')(state)), //NOTE: Duration fields don't exist in SF?\n ];\n\n state.data.durationFields = [field(`Session_${session_id}_Duration__c`, dataValue('form.duration')(state))];\n console.log(state.data.durationFields);\n\n return state;\n});\n\nupsert('Event__c', 'CommCare_Case_ID__c', state => ({\n ...fields(field('CommCare_Case_ID__c', dataValue('form.case.@case_id'))),\n ...fields(...state.data.durationFields),\n}));\n\nquery(\n `SELECT Coach_A__c, Coach_A__r.CommCare_Ext_ID__c from Event__c where CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`\n);\n\nfn(state => {\n const coaches = dataValue('form.coach_name')(state).split(' ');\n const dynamicFields = state.data.dynamicFields;\n const commcare_external_id = state.data.commcare_external_id;\n const caseid = state.data.form.case['@case_id'];\n return each(\n coaches,\n upsert('Attendance__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n //relationship('RecordType', 'Name', 'Coach Development'),\n field('RecordTypeId', '012500000009jqaAAA'),\n relationship('Event__r', 'CommCare_Case_ID__c', caseid),\n relationship('Person_Attendance__r', 'CommCare_Ext_ID__c', state => {\n const coach_name = state.data;\n return coach_name;\n }),\n field('CommCare_Ext_ID__c', commcare_external_id)\n ),\n ...fields(...dynamicFields),\n }))\n )(state);\n});\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Coach-Session-Register": {
"enabled": true,
"id": "f1ca6e70-6de6-426c-90e9-40ed4add8ac7",
"source_trigger_id": "34f0acc8-ef52-4896-b2a2-857ed1fe16a5",
"condition_expression": "state.data.form[\"@name\"] == \"Coach Session Register\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Coach Session Register",
"target_job_id": "46881590-406f-4fab-8ae5-8beba39ba8bc"
}
}
},
"Upsert-Pre-Challenges": {
"id": "2257c976-cfa0-464e-9fd7-3fcb470460b9",
"name": "Upsert Pre Challenges",
"inserted_at": "2024-11-08T12:28:34.359712Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "5aae414b-0a32-4c0d-944c-c9f8c94376f9",
"type": "webhook"
}
},
"jobs": {
"Upsert-Pre-Challenges": {
"id": "1782e922-c0ad-402d-931e-119ee807fb19",
"name": "Upsert Pre Challenges",
"body": "fn(state => {\n function transform(value) {\n if (!value) return;\n //console.log(\"value in switch\", value.toString().trim().toLowerCase());\n switch (value.toString().trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case 'agree':\n case 'verdade':\n case 'concorda':\n case 'concordo':\n case 'choice1':\n return 1;\n case 'false':\n case 'no':\n case 'disagree':\n case 'discorda':\n case 'discordo':\n case 'falso':\n case 'choice6':\n case 'choice3':\n return 2;\n case 'i_dont_know':\n case 'na':\n return 3;\n case 'unanswered':\n return 4;\n case 'not_applicable':\n return 5;\n default:\n return value;\n }\n }\n\n state.helperFunctions = { transform };\n\n return query(\n `SELECT Participant_Identification_Number_PID__c from Person__c where Participant_Identification_Number_PID__c = '${state.data.form.case['@case_id']}'`\n )(state);\n});\n\nfn(state => {\n const { form } = state.data;\n\n const formVersion = Object.keys(form).find(key => key.includes('pre_challenge'));\n\n console.log(\"form version\", formVersion);\n\n const sfFieldMapping = {\n 'pre_challenge_south_africa_-_skillz_girl': {\n Pre_1__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_have_an_older_person_in_my_life_i_can_go_to_for_advice_i_have_an_older_pe',\n Pre_2__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_know_how_to_make_a_plan_to_deal_with_the_challenges_i_may_face_in_reachin',\n Pre_3__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Pre_4__c: 'form.pre_challenge_south_africa_-_skillz_girl.every_day_i_can_find_something_to_be_grateful_for',\n Pre_5__c: 'form.pre_challenge_south_africa_-_skillz_girl.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Pre_6__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Pre_7__c: 'form.pre_challenge_south_africa_-_skillz_girl.girls_have_a_greater_risk_of_contracting_hiv_than_boys',\n Pre_8__c: 'form.pre_challenge_south_africa_-_skillz_girl.if_i_am_sexually_active_i_go_to_a_clinic_to_get_protection_from_hivstis_and',\n Pre_9__c: 'form.pre_challenge_south_africa_-_skillz_girl.like_physical_health_we_all_have_mental_health',\n Pre_10__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_11__c: 'form.pre_challenge_south_africa_-_skillz_girl.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Pre_12__c: 'form.pre_challenge_south_africa_-_skillz_girl.if_a_girl_is_sexually_abused_she_can_reduce_her_risk_of_getting_hiv_by_goin',\n Pre_13__c: 'form.pre_challenge_south_africa_-_skillz_girl.sometimes_a_man_may_have_a_good_reason_to_hit_his_partner',\n Pre_14__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Pre_15__c: 'form.pre_challenge_south_africa_-_skillz_girl.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Pre_16__c: 'form.pre_challenge_south_africa_-_skillz_girl.if_sexually_active_i_or_my_partner_is_using_a_prevention_method_to_protect_',\n Pre_17__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_know_where_to_go_to_receive_counselling_for_mental_health_challenges',\n Pre_18__c: 'form.pre_challenge_south_africa_-_skillz_girl.loss_of_interest_in_funenjoyable_activities_is_a_common_sign_of_depression',\n Pre_19__c: 'form.pre_challenge_south_africa_-_skillz_girl.i_know_at_least_three_methods_to_prevent_an_unwanted_pregnancy',\n },\n 'portuguese_pre_challenge_gcr_-_skillz_malaria': {\n Pre_1__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.dormir_dentro_da_rede_mosquiteira_tratada_todas_as_noites_pode_proteger_me_',\n Pre_2__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.posso_esperar_uns_dias_antes_de_fazer_o_teste_de_malria_se_tiver_febres',\n Pre_3__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.um_mdico_tradicionalcurandeiro_pode_me_dar_um_tratamento_para_curar_a_malri',\n Pre_4__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.se_tiver_malria_e_no_for_tratado_posso_transmitir_a_malria_a_algum',\n Pre_5__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.somente_as_mulheres_grvidas_e_as_crianas_menores_de_5_anos__que_precisam_de',\n Pre_6__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.a_malria_pode_matar_se_no_fr_tratada',\n Pre_7__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.a_febre__um_sintoma_da_malria',\n Pre_8__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.eu_me_sinto_bem_conmigo_mesmo',\n Pre_9__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.tenho_algum_na_minha_vida_que_pode_me_dar_bons_conselhos_quando_preciso_de_',\n Pre_10__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.eu_sei_onde_posso_ter_tratamento_para_malria_na_minha_comunidade',\n Pre_11__c: 'form.portuguese_pre_challenge_gcr_-_skillz_malaria.posso_proteger-me_da_malria',\n },\n \n 'portuguese_pre_challenge_gcr_-_skillz_girl': {\n Pre_1__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.falei_sobre_o_hiv_com_uma_pessoa_adulta_nos_ltimos_2_meses_fora_do_skillz',\n Pre_2__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.sei_como_expressar_a_minha_raiva_sem_ser_violento',\n Pre_3__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.sei_como_superar_os_desafios_que_possa_enfrentar_na_minha_vida',\n Pre_4__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.sei_quais_as_decises_a_tomar_para_alcanar_os_meus_objectivos',\n Pre_5__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.os_rapazes_correm_um_risco_mais_elevado_de_serem_vtimas_de_violncia_do_que_',\n Pre_6__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.conheco_que_mudanas_ocorrem_no_meu_corpo_durante_a_puberdade',\n Pre_7__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.conheo_pelo_menos_trs_mtodos_para_evitar_uma_gravidez_indesejada',\n Pre_8__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.os_preservativos_so_o_nico_mtodo_contraceptivo_que_protege_contra_a_gravide',\n Pre_9__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.conheco_onde_obter_servios_de_apoio_para_mim_ou_outra_pessoa_para_casos_de_',\n Pre_10__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.se_uma_rapariga_inicia_seu_perodo_menstrual_significa_que_est_pronta_para_c',\n Pre_11__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.caso_eu_seja_abusada_sexualmente_prefiro_guard-lo_para_mim_para_evitar_que_',\n Pre_12__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.um_homem_tem_o_direito_de_ter_sexo_com_a_sua_namorada_mesmo_que_ela_no_o_qu',\n Pre_13__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.pessoas_com_problemas_de_sade_mental_so_apenas_confusas_ou_loucas',\n Pre_14__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.pessoas_com_problemas_de_sade_mental_so_apenas_confusas_ou_loucas',\n Pre_15__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.informaria_a_algum_caso_fosse_tocada_por_alguem_de_uma_forma_que_me_deixass',\n Pre_16__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.uma_filha_deve_sempre_respeitar_a_deciso_dos_seus_pais_para_se_casar',\n Pre_17__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.um_casamento_bem_sucedido__mais_importante_para_as_raparigas_do_que_termina',\n Pre_18__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.eu_no_praticaria_desporto_com_algum_que_tem_hiv',\n Pre_19__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.um_namorado_pode_ter_boas_razes_para_bater_na_sua_namorada',\n Pre_20__c: 'form.portuguese_pre_challenge_gcr_-_skillz_girl.no_faz_mal_que_um_rapaz_ameace_bater_na_sua_namorada_se_nunca_a_bater_fisic',\n },\n 'pre_challenge_zambia_-_plus_mh_enhanced_zambia': {\n Pre_1__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.in_general_i_feel_good_about_myself',\n Pre_2__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.i_have_the_skills_and_knowledge_to_avoid_getting_infected_with_another_kind',\n Pre_3__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_important_to_know_why_and_how_i_want_to_tell_someone_my_hiv_status',\n Pre_4__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.i_accept_myself_and_my_hiv_status',\n Pre_5__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Pre_6__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.are_you_or_have_you_been_past_12_months_in_a_sexual_relationship_na_if_not_',\n Pre_7__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n Pre_8__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Pre_9__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.there_are_people_i_trust_with_whom_i_can_talk_about_my_status',\n Pre_10__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_okay_for_two_people_with_hiv_to_have_unprotected_sex_with_each_other',\n Pre_11__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.it_is_okay_for_someone_with_hiv_to_stop_taking_their_arv_as_soon_as_they_st',\n Pre_12__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.when_i_have_a_choice_it_is_important_to_eat_a_variety_of_foods_including_gr',\n Pre_13__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.mental_health_problems_have_nothing_to_do_with_being_lazy_or_weak_and_many_',\n Pre_14__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.art_adherence_is_an_important_part_of_my_overall_health_and_well-being',\n Pre_15__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.the_most_common_illnesses_of_mental_health_are_depression_and_anxiety',\n Pre_16__c: 'form.pre_challenge_zambia_-_plus_mh_enhanced_zambia.biological_and_social_factors_contribute_to_females_and_males_experiencing_',\n },\n 'pre_challenge_nigeria_-_advanced_skills':{\n Pre_1__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_have_talked_about_hiv_with_an_adult_in_the_past_two_months_outside_skillz',\n Pre_2__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_have_talked_about_malaria_with_an_adult_in_the_past_two_months_outside_sk',\n Pre_3__c: 'form.pre_challenge_nigeria_-_advanced_skills.unequal_power_in_relationships_can_contribute_to_the_spread_of_hiv',\n Pre_4__c: 'form.pre_challenge_nigeria_-_advanced_skills.the_most_effective_way_to_avoid_getting_hiv_is_to_abstain_from_sex',\n Pre_5__c: 'form.pre_challenge_nigeria_-_advanced_skills.malaria_is_spread_by_standing_under_the_hot_sun',\n Pre_6__c: 'form.pre_challenge_nigeria_-_advanced_skills.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Pre_7__c: 'form.pre_challenge_nigeria_-_advanced_skills.sleeping_under_a_mosquito_net_every_night_can_help_protect_me_from_malaria',\n Pre_8__c: 'form.pre_challenge_nigeria_-_advanced_skills.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Pre_9__c: 'form.pre_challenge_nigeria_-_advanced_skills.it_is_okay_for_someone_with_malaria_to_stop_taking_their_medication_as_soon',\n Pre_10__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_can_abstain_from_sex_until_i_am_older_even_if_it_is_difficult',\n Pre_11__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Pre_12__c: 'form.pre_challenge_nigeria_-_advanced_skills.men_should_share_the_work_around_the_house_such_as_cleaning',\n Pre_13__c: 'form.pre_challenge_nigeria_-_advanced_skills.it_is_the_males_responsibilty_to_make_decisions_in_a_relationship',\n Pre_14__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_can_use_drugs_and_still_easily_reach_my_goals_in_life',\n Pre_15__c: 'form.pre_challenge_nigeria_-_advanced_skills.when_sick_it_is_better_to_visit_the_herb_seller_than_to_visit_a_doctor_or_a',\n Pre_16__c: 'form.pre_challenge_nigeria_-_advanced_skills.it_is_okay_to_use_violence_with_my_partner_if_he_or_she_makes_me_angry',\n Pre_17__c: 'form.pre_challenge_nigeria_-_advanced_skills.i_have_the_power_to_change_gender_expectations_that_i_do_not_agree_with',\n },\n 'pre_challenge_zimbabwe_-_skillz_core_zimbabwe': {\n Pre_1__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_know_what_decisions_to_make_to_achieve_my_goals',\n Pre_2__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girlboy',\n Pre_3__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_what_i_am_good_at',\n Pre_4__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Pre_5__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Pre_6__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Pre_7__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_access_sexual_health_services_such_as_sti_and_hiv_testi',\n Pre_8__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_9__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_10__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.girls_should_be_obedient_and_should_not_disagree_with_boys',\n Pre_11__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Pre_12__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.my_skillz_coach_helps_me_to_be_a_better_person',\n Pre_13__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Pre_14__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.if_i_test_positive_for_hiv_there_will_be_someone_who_will_help_and_support_',\n Pre_15__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_who_to_go_to_if_i_amsomeone_i_know_is_abused_sexually_physically_and',\n Pre_16__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_who_to_go_to_if_someone_touches_me_in_a_way_that_makes_me_uncomforta',\n Pre_17__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Pre_18__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Pre_19__c: 'form.pre_challenge_zimbabwe_-_skillz_core_zimbabwe.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n },\n 'pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe': {\n Pre_1__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_know_what_decisions_to_make_to_achieve_my_goals',\n Pre_2__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_dont_always_have_to_do_what_people_expect_just_because_i_am_girlboy',\n Pre_3__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Pre_4__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_can_make_my_own_informed_decisions_about_my_sexual_health',\n Pre_5__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_6__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_7__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.my_skillz_coach_helps_me_to_be_a_better_person',\n Pre_8__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advise_or_when_i_have_a',\n Pre_9__c: 'form.pre_challenge_zimbabwe_-_virtual_skillz_core_zimbabwe.copy-1-of-i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n },\n 'pre_challenge_mindskillz-_zambia_100': {\n Pre_1__c:'form.pre_challenge_mindskillz-_zambia_100.when_i_express_my_feelings_clearly_people_understand_me_better',\n Pre_2__c:'form.pre_challenge_mindskillz-_zambia_100.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Pre_3__c:'form.pre_challenge_mindskillz-_zambia_100.stress_is_a_normal_part_of_life',\n Pre_4__c:'form.pre_challenge_mindskillz-_zambia_100.i_can_reach_my_goals_in_life',\n Pre_5__c:'form.pre_challenge_mindskillz-_zambia_100.if_i_have_a_problem_i_have_someone_in_my_life_i_can_go_to_for_support',\n Pre_6__c:'form.pre_challenge_mindskillz-_zambia_100.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Pre_7__c:'form.pre_challenge_mindskillz-_zambia_100.self_control_helps_you_make_smart_decisions_when_you_are_angry_or_upset',\n Pre_8__c:'form.pre_challenge_mindskillz-_zambia_100.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Pre_9__c:'form.pre_challenge_mindskillz-_zambia_100.i_know_how_to_express_my_anger_without_being_violent',\n Pre_10__c:'form.pre_challenge_mindskillz-_zambia_100.listening_carefully_to_others_is_an_important_communication_skill',\n Pre_11__c:'form.pre_challenge_mindskillz-_zambia_100.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Pre_12__c:'form.pre_challenge_mindskillz-_zambia_100.i_can_understand_how_others_are_feeling_and_be_sensitive_to_their_emotions',\n Pre_13__c:'form.pre_challenge_mindskillz-_zambia_100.i_am_confident_that_i_know_where_to_seek_information_about_mental_illness',\n Pre_14__c:'form.pre_challenge_mindskillz-_zambia_100.i_am_confident_using_the_computer_or_telephone_to_seek_information_about_me',\n Pre_15__c:'form.pre_challenge_mindskillz-_zambia_100.i_am_confident_attending_face_to_face_appointments_to_seek_information_abou',\n Pre_16__c:'form.pre_challenge_mindskillz-_zambia_100.i_am_confident_i_have_access_to_resources_eg_doctor_internet_friends_that_i',\n Pre_17__c:'form.pre_challenge_mindskillz-_zambia_100.people_with_mental_illness_could_snap_out_of_it_if_they_wanted',\n Pre_18__c:'form.pre_challenge_mindskillz-_zambia_100.a_mental_illness_is_a_sign_of_personal_weakness',\n Pre_19__c:'form.pre_challenge_mindskillz-_zambia_100.a_mental_illness_is_not_a_real_medical_illness',\n Pre_20__c:'form.pre_challenge_mindskillz-_zambia_100.people_with_mental_illness_are_dangerous',\n Pre_21__c:'form.pre_challenge_mindskillz-_zambia_100.it_is_best_to_avoid_people_with_mental_illness_so_that_you_dont_develop_thi',\n Pre_22__c:'form.pre_challenge_mindskillz-_zambia_100.if_i_had_a_mental_illness_i_would_not_tell_anyone',\n Pre_23__c:'form.pre_challenge_mindskillz-_zambia_100.seeing_a_mental_health_professional_means_you_are_not_strong_enough_to_mana',\n Pre_24__c:'form.pre_challenge_mindskillz-_zambia_100.if_i_had_mental_illness_i_would_not_seek_help_from_a_mental_health_professi',\n Pre_25__c:'form.pre_challenge_mindskillz-_zambia_100.i_believe_treatment_for_a_mental_illness_provided_by_a_mental_health_profes',\n },\n 'pre_challenge_skillz_girl_nih200':{\n Pre_1__c:'form.pre_challenge_skillz_girl_nih200.i_have_talked_about_hiv_with_an_adult_in_the_past_two_months_outside_skillz',\n Pre_2__c:'form.pre_challenge_skillz_girl_nih200.i_have_talked_about_hiv_with_a_friend_in_the_past_two_months_outside_skillz',\n Pre_3__c:'form.pre_challenge_skillz_girl_nih200.having_sex_with_an_older_partner_increases_my_risk_of_getting_hiv',\n Pre_4__c:'form.pre_challenge_skillz_girl_nih200.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Pre_5__c:'form.pre_challenge_skillz_girl_nih200.i_know_someone_in_my_community_who_distributes_contraceptives_and_other_sex',\n Pre_6__c:'form.pre_challenge_skillz_girl_nih200.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Pre_7__c:'form.pre_challenge_skillz_girl_nih200.i_have_the_right_to_say_no_to_sex_no_matter_who_asks',\n Pre_8__c:'form.pre_challenge_skillz_girl_nih200.as_a_girl_i_have_a_greater_risk_of_getting_hiv_than_boys',\n Pre_9__c:'form.pre_challenge_skillz_girl_nih200.i_know_where_to_get_support_services_for_rape',\n Pre_10__c:'form.pre_challenge_skillz_girl_nih200.if_a_girl_is_sexually_abused_she_can_reduce_her_risk_of_getting_hiv_by_taki',\n Pre_11__c:'form.pre_challenge_skillz_girl_nih200.i_feel_good_about_being_a_girl',\n Pre_12__c:'form.pre_challenge_skillz_girl_nih200.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_13__c:'form.pre_challenge_skillz_girl_nih200.boys_should_share_the_work_around_the_home_such_as_household_chores',\n Pre_14__c:'form.pre_challenge_skillz_girl_nih200.i_know_what_i_want_to_be_after_finishing_secondary_school',\n Pre_15__c:'form.pre_challenge_skillz_girl_nih200.if_i_have_a_problem_i_have_someone_in_my_life_i_can_talk_to_for_advise',\n Pre_16__c:'form.pre_challenge_skillz_girl_nih200.a_boyfriend_may_have_good_reason_to_hit_his_girlfriend',\n Pre_17__c:'form.pre_challenge_skillz_girl_nih200.i_would_tell_someone_if_i_were_touched_in_a_manner_that_made_me_uncomfortab',\n Pre_18__c:'form.pre_challenge_skillz_girl_nih200.i_can_reach_my_goals_in_life',\n Pre_19__c:'form.pre_challenge_skillz_girl_nih200.a_girl_should_wait_to_get_married_until_after_college',\n Pre_20__c:'form.pre_challenge_skillz_girl_nih200.biological_and_social_factors_contribute_to_females_and_males_experiencing_',\n Pre_21__c:'form.pre_challenge_skillz_girl_nih200.the_most_common_illness_of_mental_health_are_depression_and_anxiety',\n Pre_22__c:'form.pre_challenge_skillz_girl_nih200.mental_health_problems_have_nothing_to_do_with_being_lazy_or_weak_and_many_',\n Pre_23__c:'form.pre_challenge_skillz_girl_nih200.i_am_ready_to_take_an_hiv_test',\n Pre_24__c:'form.pre_challenge_skillz_girl_nih200.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n },\n \n 'pre_challenge_mindskillz_pamumvuri':{\n Pre_1__c: 'form.pre_challenge_mindskillz_pamumvuri.when_i_express_my_feelings_clearly_people_understand_me_better',\n Pre_2__c: 'form.pre_challenge_mindskillz_pamumvuri.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Pre_3__c: 'form.pre_challenge_mindskillz_pamumvuri.stress_is_a_normal_part_of_life',\n Pre_4__c: 'form.pre_challenge_mindskillz_pamumvuri.i_can_reach_my_goals_in_life',\n Pre_5__c: 'form.pre_challenge_mindskillz_pamumvuri.if_i_have_a_problem_i_have_someone_in_my_life_i_can_go_to_for_support',\n Pre_6__c: 'form.pre_challenge_mindskillz_pamumvuri.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Pre_7__c: 'form.pre_challenge_mindskillz_pamumvuri.self_control_helps_you_make_smart_decisions_when_you_are_angry_or_upset',\n Pre_8__c: 'form.pre_challenge_mindskillz_pamumvuri.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Pre_9__c: 'form.pre_challenge_mindskillz_pamumvuri.i_know_how_to_express_my_anger_without_being_violent',\n Pre_10__c: 'form.pre_challenge_mindskillz_pamumvuri.listening_carefully_to_others_is_an_important_communication_skill',\n Pre_11__c: 'form.pre_challenge_mindskillz_pamumvuri.drinking_too_much_alcohol_can_have_serious_negative_consequences_for_mental',\n Pre_12__c: 'form.pre_challenge_mindskillz_pamumvuri.i_can_understand_how_others_are_feeling_and_be_sensitive_to_their_emotions',\n Pre_13__c: 'form.pre_challenge_mindskillz_pamumvuri.i_am_confident_that_i_know_where_to_seek_information_about_mental_illness',\n Pre_14__c: 'form.pre_challenge_mindskillz_pamumvuri.i_am_confident_using_the_computer_or_telephone_to_seek_information_about_me',\n Pre_15__c: 'form.pre_challenge_mindskillz_pamumvuri.i_am_confident_attending_face_to_face_appointments_to_seek_information_abou',\n Pre_16__c: 'form.pre_challenge_mindskillz_pamumvuri.i_am_confident_i_have_access_to_resources_eg_doctor_internet_friends_that_i',\n Pre_17__c: 'form.pre_challenge_mindskillz_pamumvuri.people_with_mental_illness_could_snap_out_of_it_if_they_wanted',\n Pre_18__c: 'form.pre_challenge_mindskillz_pamumvuri.a_mental_illness_is_a_sign_of_personal_weakness',\n Pre_19__c: 'form.pre_challenge_mindskillz_pamumvuri.a_mental_illness_is_not_a_real_medical_illness',\n Pre_20__c: 'form.pre_challenge_mindskillz_pamumvuri.people_with_mental_illness_are_dangerous',\n Pre_21__c: 'form.pre_challenge_mindskillz_pamumvuri.it_is_best_to_avoid_people_with_mental_illness_so_that_you_dont_develop_thi',\n Pre_22__c: 'form.pre_challenge_mindskillz_pamumvuri.if_i_had_a_mental_illness_i_would_not_tell_anyone',\n Pre_23__c: 'form.pre_challenge_mindskillz_pamumvuri.seeing_a_mental_health_professional_means_you_are_not_strong_enough_to_mana',\n Pre_24__c: 'form.pre_challenge_mindskillz_pamumvuri.if_i_had_mental_illness_i_would_not_seek_help_from_a_mental_health_professi',\n Pre_25__c: 'form.pre_challenge_mindskillz_pamumvuri.i_believe_treatment_for_a_mental_illness_provided_by_a_mental_health_profes',\n },\n 'pre_challenge_skillz_girl_-_zam_311': {\n Pre_1__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_what_i_am_good_at',\n Pre_2__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_how_to_overcome_challenges_that_i_may_face_in_my_life',\n Pre_3__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girl',\n Pre_4__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_would_be_able_to_ask_my_boyfriend_that_i_want_to_use_a_condom',\n Pre_5__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_can_say_no_to_sex_even_if_my_boyfriend_or_friends_pressure_me_to_have_sex',\n Pre_6__c: 'form.pre_challenge_skillz_girl_-_zam_311.if_i_am_sexually_active_i_go_to_a_healthcare_provider_to_get_protection_fro',\n Pre_7__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Pre_8__c: 'form.pre_challenge_skillz_girl_-_zam_311.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Pre_9__c: 'form.pre_challenge_skillz_girl_-_zam_311.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_10__c: 'form.pre_challenge_skillz_girl_-_zam_311.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_or_wife',\n Pre_11__c: 'form.pre_challenge_skillz_girl_-_zam_311.a_successful_marriage_is_more_important_to_girls_than_completing_school',\n Pre_12__c: 'form.pre_challenge_skillz_girl_-_zam_311.a_daughter_should_always_respect_her_parents_decision_for_her_to_get_marrie',\n Pre_13__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_can_decide_when_is_the_right_time_for_me_to_have_a_baby',\n Pre_14__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Pre_15__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Pre_16__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_gender_base',\n Pre_17__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_where_to_get_support_services_for_me_or_someone_else_for_prevention_',\n Pre_18__c: 'form.pre_challenge_skillz_girl_-_zam_311.one_sign_of_pregnancy_is_a_girl_missing_her_period',\n Pre_19__c: 'form.pre_challenge_skillz_girl_-_zam_311.i_know_at_least_three_methods_to_avoid_an_unwanted_pregnancy',\n Pre_20__c: 'form.pre_challenge_skillz_girl_-_zam_311.are_you_or_your_boyfriend_currently_using_any_contraceptive_method',\n },\n 'pre_challenge_skillz_core_zambia_211':{\n Pre_1__c: 'form.pre_challenge_skillz_core_zambia_211.i_know_what_i_am_good_at',\n Pre_2__c: 'form.pre_challenge_skillz_core_zambia_211.i_know_how_to_overcome_challenges_i_may_have_in_my_life',\n Pre_3__c: 'form.pre_challenge_skillz_core_zambia_211.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Pre_4__c: 'form.pre_challenge_skillz_core_zambia_211.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_5__c: 'form.pre_challenge_skillz_core_zambia_211.i_dont_always_have_to_do_what_people_expect_because_i_am_a_boygirl',\n Pre_6__c: 'form.pre_challenge_skillz_core_zambia_211.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_7__c: 'form.pre_challenge_skillz_core_zambia_211.girls_should_not_disagree_with_boys',\n Pre_8__c: 'form.pre_challenge_skillz_core_zambia_211.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Pre_9__c: 'form.pre_challenge_skillz_core_zambia_211.i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Pre_10__c: 'form.pre_challenge_skillz_core_zambia_211.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Pre_11__c: 'form.pre_challenge_skillz_core_zambia_211.if_i_test_positive_for_hivthere_will_be_someone_who_will_help_and_support_m',\n Pre_12__c: 'form.pre_challenge_skillz_core_zambia_211.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Pre_13__c: 'form.pre_challenge_skillz_core_zambia_211.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Pre_14__c: 'form.pre_challenge_skillz_core_zambia_211.i_know_where_to_get_support_services_for_me_or_someone_elsefor_hiv_-_relate',\n Pre_15__c: 'form.pre_challenge_skillz_core_zambia_211.i_know_where_to_get_support_services_for_me_or_someone_elsefor_abuse',\n Pre_16__c: 'form.pre_challenge_skillz_core_zambia_211.i_have_the_right_to_access_sexual_health_servicessuch_as_sti_and_hiv_testin',\n Pre_17__c: 'form.pre_challenge_skillz_core_zambia_211.one_sign_of_pregnancy_is_a_girl_missing_her_period',\n Pre_18__c: 'form.pre_challenge_skillz_core_zambia_211.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Pre_19__c: 'form.pre_challenge_skillz_core_zambia_211.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n Pre_20__c: 'form.pre_challenge_skillz_core_zambia_211.i_know_what_decisions_to_make_to_achieve_my_goals',\n },\n 'pre_challenge_skillz_boy_zambia110':{\n Pre_1__c: 'form.pre_challenge_skillz_boy_zambia110.in_general_i_feel_good_about_myself',\n Pre_2__c: 'form.pre_challenge_skillz_boy_zambia110.i_would_be_able_to_ask_my_girlfriend_that_i_want_to_use_a_condom',\n Pre_3__c: 'form.pre_challenge_skillz_boy_zambia110.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_boy',\n Pre_4__c: 'form.pre_challenge_skillz_boy_zambia110.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_5__c: 'form.pre_challenge_skillz_boy_zambia110.it_is_more_important_for_boys_to_be_educated_than_girls',\n Pre_6__c: 'form.pre_challenge_skillz_boy_zambia110.men_are_better_leaders_than_women',\n Pre_7__c: 'form.pre_challenge_skillz_boy_zambia110.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_8__c: 'form.pre_challenge_skillz_boy_zambia110.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Pre_9__c: 'form.pre_challenge_skillz_boy_zambia110.it_is_okay_for_a_boyfriend_to_threaten_to_hit_his_girlfriend_if_he_never_hi',\n Pre_10__c: 'form.pre_challenge_skillz_boy_zambia110.i_can_say_no_to_sex_even_if_my_friends_or_girlfriend_pressure_me_to_have_se',\n Pre_11__c: 'form.pre_challenge_skillz_boy_zambia110.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_sexual_behaviou',\n Pre_12__c: 'form.pre_challenge_skillz_boy_zambia110.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_13__c: 'form.pre_challenge_skillz_boy_zambia110.i_have_a_friend_that_i_can_go_to_for_advice_when_i_have_a_problem',\n Pre_14__c: 'form.pre_challenge_skillz_boy_zambia110.i_have_the_right_to_access_sexual_health_services_such_as_hiv_and_sti_testi',\n Pre_15__c: 'form.pre_challenge_skillz_boy_zambia110.i_know_where_to_access_sexual_health_services_such_as_sti_and_hiv_testing',\n Pre_16__c: 'form.pre_challenge_skillz_boy_zambia110.before_making_a_decision_i_think_about_how_it_can_affect_me_or_others',\n Pre_17__c: 'form.pre_challenge_skillz_boy_zambia110.i_know_how_to_express_my_anger_without_being_violent_such_as_hitting_kickin',\n Pre_18__c: 'form.pre_challenge_skillz_boy_zambia110.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Pre_19__c: 'form.pre_challenge_skillz_boy_zambia110.i_know_how_to_correctly_use_a_male_condom',\n Pre_20__c: 'form.pre_challenge_skillz_boy_zambia110.are_you_or_your_boyfriendgirlfriend_currently_using_any_contraceptive_or_pr',\n \n },\n 'pre_challenge_skillz_guyz_mh_-_sa_100':{\n Pre_1__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_have_to_be_respectful_communicate_and_take_action_to_be_a_role_model_in_m',\n Pre_2__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_have_skills_that_help_me_bounce_back_from_difficult_situations',\n Pre_3__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_can_identify_my_strengths_or_things_that_i_am_good_at',\n Pre_4__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.when_i_am_angry_i_know_how_to_avoid_using_violent_behaviour',\n Pre_5__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.when_i_express_my_feelings_clearly_people_understand_me_better',\n Pre_6__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Pre_7__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.sadness_and_a_loss_of_pleasure_in_things_you_enjoy_are_common_symptoms_of_d',\n Pre_8__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_know_where_to_access_health_services_and_mental_health_services',\n Pre_9__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_will_share_accurate_information_about_mental_health_services_to_avoid_sti',\n Pre_10__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.society_expects_boys_and_girls_to_deal_with_their_emotions_differently',\n Pre_11__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.men_should_share_the_work_around_the_house_such_as_cleaning_and_taking_care',\n Pre_12__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.its_okay_for_a_guy_to_beat_a_girl_when_there_is_a_misunderstanding',\n Pre_13__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_should_respect_the_rights_of_others_such_as_their_right_to_their_own_opin',\n Pre_14__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_feel_confident_setting_my_goals',\n Pre_15__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.stress_is_a_normal_part_of_life',\n Pre_16__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Pre_17__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.there_are_people_i_trust_with_whom_i_can_talk_to_about_my_mental_health',\n Pre_18__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_have_no_fear_or_shame_when_accessing_health_services_or_mental_health_ser',\n Pre_19__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Pre_20__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Pre_21__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_can_stand_up_to_peer_pressure_when_i_have_to',\n Pre_22__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_should_use_a_condom_even_if_my_girlfriend_is_on_another_form_of_birth_con',\n Pre_23__c: 'form.pre_challenge_skillz_guyz_mh_-_sa_100.i_know_where_to_go_for_support_if_i_or_someone_i_know_abuses_alcohol',\n },\n \n \n 'pre_challenge_south_africa_-_skillz_girl_mh_sa_211':{\n Pre_1__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_my_rights_and_responsibilities',\n Pre_2__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Pre_3__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Pre_4__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.stress_is_a_normal_part_of_life',\n Pre_5__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.like_physical_health_we_all_have_mental_health',\n Pre_6__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Pre_7__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.healthy_relationships_are_based_on_healthy_communication_and_mutual_respect',\n Pre_8__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_partner_or_wif',\n Pre_9__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Pre_10__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Pre_11__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.taking_prep_and_using_a_condom_can_lower_my_risk_of_getting_hiv',\n Pre_12__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_13__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Pre_14__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.post_exposure_prophylaxis_pep_can_reduce_my_risk_of_getting_hiv_if_taken_1-',\n Pre_15__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.it_is_my_right_to_access_health_services',\n Pre_16__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_have_an_adult_or_someone_in_my_life_i_can_go_to_for_advice',\n Pre_17__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_can_give_support_and_encouragement_to_a_friend_or_family_member_who_is_li',\n Pre_18__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.using_a_condom_and_another_contraceptive_method_can_help_prevent_unwanted_p',\n Pre_19__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Pre_20__c: 'form.pre_challenge_south_africa_-_skillz_girl_mh_sa_211.drinking_too_much_alcohol_can_harm_the_body_and_the_mind',\n },\n \n 'pre_challenge_skillz_girl_abbreviated_south_africa':{\n Pre_1__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_know_my_rights_and_responsibilities',\n Pre_2__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_can_identify_my_strengths_or_things_that_i_am_good_at_in_life',\n Pre_3__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_know_where_to_get_contraception_to_prevent_unwanted_pregnancy',\n Pre_4__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.stress_is_a_normal_part_of_life',\n Pre_5__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.like_physical_health_we_all_have_mental_health',\n Pre_6__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Pre_7__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.in_a_relationship_it_is_both_partners_responsibility_to_prevent_unwanted_pr',\n Pre_8__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.healthy_relationships_are_based_on_healthy_communication_and_respect',\n Pre_9__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_partner_or_wif',\n Pre_10__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.a_person_has_the_right_to_have_sex_with_their_partner_even_if_the_partner_d',\n Pre_11__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_can_say_no_to_sex_even_if_my_partner_or_friends_pressure_me_to_have_sex',\n Pre_12__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.having_more_than_one_sexual_partner_increases_my_risk_of_getting_hiv',\n Pre_13__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.taking_prep_and_using_a_condom_can_lower_my_risk_of_getting_hiv',\n Pre_14__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_15__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.deep_breathing_is_a_healthy_way_to_deal_with_difficult_and_stressful_situat',\n Pre_16__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_can_use_coping_skills_to_handle_stress',\n Pre_17__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.post_exposure_prophylaxis_pep_can_reduce_my_risk_of_getting_hiv_if_taken_1-',\n Pre_18__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.it_is_my_right_to_access_health_services',\n Pre_19__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_have_an_adult_or_someone_in_my_life_i_can_go_to_for_advice',\n Pre_20__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.using_a_condom_and_another_contraceptive_method_can_help_prevent_unwanted_p',\n Pre_21__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_know_what_changes_to_expect_in_my_body_during_puberty',\n Pre_22__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.drinking_too_much_alcohol_can_harm_the_body_and_mind',\n Pre_23__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_know_at_least_two_ways_of_saving_money',\n Pre_24__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.a_budget_is_the_estimated_income_and_expenses_for_a_certain_time_period',\n Pre_25__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.accepting_money_for_sexual_favors_can_create_risks_to_my_health_and_safety',\n Pre_26__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.using_assertive_communication_means_respectfully_sharing_my_thoughts_and_fe',\n Pre_27__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.i_have_the_right_to_access_emergency_contraception',\n Pre_28__c: 'form.pre_challenge_skillz_girl_abbreviated_south_africa.if_a_girl_has_unprotected_sex_and_misses_her_period_this_could_mean_she_is_',\n },\n \n 'pre_challenge_skillz_guyz_-_yedi__323':{\n Pre_1__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_know_how_to_stand_up_to_peer_pressure_ie_to_drink_alcohol_or_have_sex_fro',\n Pre_2__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Pre_3__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_have_someone_i_can_go_to_for_advice',\n Pre_4__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.no_one_has_the_right_to_touch_me_in_a_way_that_makes_me_uncomfortable_such_',\n Pre_5__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_6__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_behaviours_such',\n Pre_7__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.it_is_the_males_responsibility_to_make_decisions_in_a_relationship',\n Pre_8__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.a_mental_illness_is_a_sign_of_personal_weakness',\n Pre_9__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Pre_10__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Pre_11__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.a_boys_opinion_is_more_important_than_a_girls',\n Pre_12__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.men_should_share_the_work_around_the_house_such_as_cleaning_and_taking_care',\n Pre_13__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.its_okay_for_a_guy_to_beat_a_girl_when_she_misbehaves',\n Pre_14__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Pre_15__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.it_is_only_the_girls_responsibility_to_avoid_getting_pregnant',\n Pre_16__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.condoms_are_the_only_contraceptive_method_that_protect_against_pregnancy_as',\n Pre_17__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_would_stand_up_to_my_friends_if_they_were_harming_others_such_as_touching',\n Pre_18__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.having_more_than_one_sexual_partner_over_the_same_time_period_increases_my_',\n Pre_19__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_20__c: 'form.pre_challenge_skillz_guyz_-_yedi__323.i_have_the_ability_to_shape_my_own_life',\n },\n \n 'pre_challenge_skillz_girl_mh_zambia':{\n Pre_1__c: 'form.pre_challenge_skillz_girl_mh_zambia.a_mental_illness_is_a_sign_of_personal_weakness',\n Pre_2__c: 'form.pre_challenge_skillz_girl_mh_zambia.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Pre_3__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girl',\n Pre_4__c: 'form.pre_challenge_skillz_girl_mh_zambia.if_i_had_a_boyfriend_i_would_be_able_to_ask_him_to_use_a_condom_before_havi',\n Pre_5__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_can_say_no_to_sex_even_if_my_boyfriend_or_friends_pressure_to_have_sex',\n Pre_6__c: 'form.pre_challenge_skillz_girl_mh_zambia.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Pre_7__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_can_make_my_own_informed_decisions_about_my_sexual_healthcare',\n Pre_8__c: 'form.pre_challenge_skillz_girl_mh_zambia.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Pre_9__c: 'form.pre_challenge_skillz_girl_mh_zambia.a_man_has_the_right_to_have_sex_with_his_girlfriend_even_if_she_doesnt_want',\n Pre_10__c: 'form.pre_challenge_skillz_girl_mh_zambia.sometimes_a_man_may_have_a_good_reason_to_hit_his_girlfriend_or_wife',\n Pre_11__c: 'form.pre_challenge_skillz_girl_mh_zambia.a_successful_marrige_is_more_important_to_girls_than_completing_school',\n Pre_12__c: 'form.pre_challenge_skillz_girl_mh_zambia.a_daughter_should_always_respect_her_parents_decision_to_get_married',\n Pre_13__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_can_decide_when_is_the_right_time_for_me_to_have_a_baby',\n Pre_14__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_have_someone_in_my_life_i_can_turn_to_when_i_need_advice_or_when_i_have_a',\n Pre_15__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_hiv-related',\n Pre_16__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_gender_base',\n Pre_17__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_prevention_',\n Pre_18__c: 'form.pre_challenge_skillz_girl_mh_zambia.if_sexually_active_one_sign_of_pregnance_is_a_girl_missing_her_period',\n Pre_19__c: 'form.pre_challenge_skillz_girl_mh_zambia.i_know_at_least_three_methods_to_avoid_an_unwanted_pregnancy',\n Pre_20__c: 'form.pre_challenge_skillz_girl_mh_zambia.are_you_or_your_boyfriend_currently_using_any_contraceptive_method',\n },\n \n 'pre_challenge_skillz_core_mh_zambia':{\n Pre_1__c: 'form.pre_challenge_skillz_core_mh_zambia.i_know_what_i_am_good_at',\n Pre_2__c: 'form.pre_challenge_skillz_core_mh_zambia.i_know_how_to_overcome_challenges_that_i_may_have_in_life',\n Pre_3__c: 'form.pre_challenge_skillz_core_mh_zambia.i_can_make_my_own_decisions_no_matter_how_much_pressure_i_get_from_others',\n Pre_4__c: 'form.pre_challenge_skillz_core_mh_zambia.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_5__c: 'form.pre_challenge_skillz_core_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_girlboy',\n Pre_6__c: 'form.pre_challenge_skillz_core_mh_zambia.a_man_has_the_right_to_have_sex_with_his_wifegirlfriend_even_if_she_doesnt_',\n Pre_7__c: 'form.pre_challenge_skillz_core_mh_zambia.girls_should_not_disagree_with_boys',\n Pre_8__c: 'form.pre_challenge_skillz_core_mh_zambia.if_a_girl_gets_pregnant_she_should_drop_out_of_school',\n Pre_9__c: 'form.pre_challenge_skillz_core_mh_zambia.i_have_the_right_to_say_no_to_sex_no_matter_who_asks_me',\n Pre_10__c: 'form.pre_challenge_skillz_core_mh_zambia.i_have_an_older_person_in_my_life_i_can_go_to_for_advice',\n Pre_11__c: 'form.pre_challenge_skillz_core_mh_zambia.if_i_test_positive_for_hiv_there_will_be_someone_who_will_help_and_support_',\n Pre_12__c: 'form.pre_challenge_skillz_core_mh_zambia.people_with_mental_illness_live_on_the_streets_and_eat_dirty_food_from_garb',\n Pre_13__c: 'form.pre_challenge_skillz_core_mh_zambia.drinking_alcohol_can_increase_my_risk_of_getting_hiv',\n Pre_14__c: 'form.pre_challenge_skillz_core_mh_zambia.i_only_use_violent_behaviour_when_someone_angers_me',\n Pre_15__c: 'form.pre_challenge_skillz_core_mh_zambia.i_know_where_to_get_support_services_for_me_or_someone_else_for_abuse_or_hi',\n Pre_16__c: 'form.pre_challenge_skillz_core_mh_zambia.i_have_the_right_to_access_sexual_health_services_such_as_sti_and_hiv_testi',\n Pre_17__c: 'form.pre_challenge_skillz_core_mh_zambia.if_sexually_active_one_sign_of_pregnancy_can_be_a_girl_missing_her_period',\n Pre_18__c: 'form.pre_challenge_skillz_core_mh_zambia.i_would_say_no_to_playing_sport_with_someone_who_has_hiv',\n Pre_19__c: 'form.pre_challenge_skillz_core_mh_zambia.i_can_tell_whether_someone_has_hiv_by_looking_at_him_or_her',\n Pre_20__c: 'form.pre_challenge_skillz_core_mh_zambia.i_know_what_decisions_to_make_to_achieve_my_goals',\n },\n \n 'pre_challenge_skillz_guyz_mh_zambia':{\n Pre_1__c: 'form.pre_challenge_skillz_guyz_mh_zambia.a_mental_illness_is_a_sign_of_personal_weakness',\n Pre_2__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_would_be_able_to_tell_my_girlfriend_that_i_want_to_use_a_condom',\n Pre_3__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_dont_always_have_to_do_what_people_expect_just_because_i_am_a_boy',\n Pre_4__c: 'form.pre_challenge_skillz_guyz_mh_zambia.it_is_the_mans_responsibility_to_make_decisions_in_a_relationship',\n Pre_5__c: 'form.pre_challenge_skillz_guyz_mh_zambia.it_is_more_important_for_boys_to_be_educated_than_girls',\n Pre_6__c: 'form.pre_challenge_skillz_guyz_mh_zambia.men_are_better_leaders_than_women',\n Pre_7__c: 'form.pre_challenge_skillz_guyz_mh_zambia.a_manboy_has_the_right_to_have_sex_with_his_girlfriendwomanwife_even_if_she',\n Pre_8__c: 'form.pre_challenge_skillz_guyz_mh_zambia.it_is_better_to_express_yourself_with_anger_when_upset_than_to_use_self-con',\n Pre_9__c: 'form.pre_challenge_skillz_guyz_mh_zambia.it_is_okay_for_a_boyfriend_to_threaten_to_hit_his_girlfriend_if_he_never_hi',\n Pre_10__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_can_say_no_to_sex_even_if_my_friends_or_girlfriend_pressure_me_to_have_se',\n Pre_11__c: 'form.pre_challenge_skillz_guyz_mh_zambia.people_who_abuse_alcohol_are_more_likely_to_engage_in_risky_sexual_behaviou',\n Pre_12__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_know_where_to_go_for_support_if_i_or_someone_i_know_drinks_too_much_alcoh',\n Pre_13__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_have_a_friend_that_i_can_go_to_for_advice_when_i_have_a_problem',\n Pre_14__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_have_the_right_to_access_sexual_health_services_such_as_hiv_and_sti_testi',\n Pre_15__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_know_where_to_access_sexual_health_services_such_as_sti_and_hiv_testing',\n Pre_16__c: 'form.pre_challenge_skillz_guyz_mh_zambia.seeking_help_for_mental_health_challenges_is_a_sign_of_weakness',\n Pre_17__c: 'form.pre_challenge_skillz_guyz_mh_zambia.young_people_should_avoid_people_with_mental_illness_as_they_are_always_vio',\n Pre_18__c: 'form.pre_challenge_skillz_guyz_mh_zambia.male_circumcision_reduces_a_males_risk_of_getting_hiv',\n Pre_19__c: 'form.pre_challenge_skillz_guyz_mh_zambia.i_know_how_to_correctly_use_a_male_condom',\n Pre_20__c: 'form.pre_challenge_skillz_guyz_mh_zambia.are_you_or_your_girlfriend_currently_using_any_contraceptive_or_protective_',\n \n \n }\n };\n\n const pluckSfValue = val => {\n return sfFieldMapping[formVersion][val];\n };\n\n return { ...state, pluckSfValue };\n});\n\n// fn(state => {\n// console.log(\"test\")\n// console.log(state.pluckSfValue('Pre_1__c'));\n// return state;\n// });\n\nfn(state => {\n const PID = lastReferenceValue('records[0].Participant_Identification_Number_PID__c')(state);\n\n if (!PID) {\n console.log(\n `Participant not found with Participant_Identification_Number_PID__c: ${state.data.form.case['@case_id']}`\n );\n return state;\n }\n\n return upsert(\n 'Attendance__c',\n 'CommCare_Ext_ID__c',\n fields(\n //field('Event__c', dataValue('form.hidden_properties.intervention_name')),\n //relationship('Event__r', 'CommCare_Ext_ID__c', dataValue('form.hidden_properties.intervention_name')),\n relationship('Person_Attendance__r', 'Participant_Identification_Number_PID__c', dataValue('form.case.@case_id')),\n // relationship('Person_Attendance__r','CommCare_Ext_ID__c', state => {\n // return (\n // dataValue('form.hidden_properties.participant_first_name')(state) +\n // dataValue('form.hidden_properties.participant_surname')(state)\n // )\n // }),\n\n // field('CommCare_Ext_ID__c', state => {\n // return `${dataValue('form.case.@case_id')(state)}-${scrubEmojis(\n // dataValue('form.hidden_properties.intervention_name')(state),\n // ''\n // ).replace(/\\//gi, '')}`;\n // }),\n field(\"CommCare_Ext_ID__c\", (state) => {\n return toUTF8(`${dataValue(\"form.case.@case_id\")(state)}-${scrubEmojis(\n dataValue(\"form.hidden_properties.intervention_name\")(state),\n \"\"\n ).replace(/\\//gi, \"\")}`);\n }),\n\n //field(\n //'Person_Attendance__c',\n // state =>\n // dataValue('form.hidden_properties.participant_first_name')(state) +\n // ' ' +\n // dataValue('form.hidden_properties.participant_surname')(state)\n //),\n field('Gender__c', dataValue('form.hidden_properties.gender')),\n field('Grade__c', state => {\n const grade = dataValue('form.hidden_properties.grade')(state);\n return grade ? grade.replace(/\\D/g, '') : undefined;\n }),\n field('Class__c', dataValue('form.hidden_properties.class')),\n field('Pre_Post_Completed__c', state => {\n var done = dataValue('form.hidden_properties.pre_questionnaire_complete')(state);\n return done === 'Yes' ? true : done === 'No' ? false : undefined;\n }),\n field('Date_Pre_Administered__c', dataValue('form.date')),\n field('Pre_1__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_1__c'))(state);\n return state.helperFunctions.transform(value);\n }),\n field('Pre_2__c', state => {\n if (state.pluckSfValue('Pre_2__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_2__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n \n field('Pre_3__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_3__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n \n field('Pre_4__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_4__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n \n field('Pre_5__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_5__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_6__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_6__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_7__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_7__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_8__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_8__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_9__c', state => {\n const value = dataValue(state.pluckSfValue('Pre_9__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_10__c', state => {\n if (state.pluckSfValue('Pre_10__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_10__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_11__c', state => {\n if (state.pluckSfValue('Pre_11__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_10__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_12__c', state => {\n if (state.pluckSfValue('Pre_12__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_12__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_13__c', state => {\n if (state.pluckSfValue('Pre_13__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_13__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_14__c', state => {\n if (state.pluckSfValue('Pre_14__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_14__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_15__c', state => {\n if (state.pluckSfValue('Pre_15__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_15__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_16__c', state => {\n if (state.pluckSfValue('Pre_16__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_16__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_17__c', state => {\n if (state.pluckSfValue('Pre_17__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_17__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_18__c', state => {\n if (state.pluckSfValue('Pre_18__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_18__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_19__c', state => {\n if (state.pluckSfValue('Pre_19__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_19__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_20__c', state => {\n if (state.pluckSfValue('Pre_20__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_20__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_21__c', state => {\n if (state.pluckSfValue('Pre_21__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_21__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_22__c', state => {\n if (state.pluckSfValue('Pre_22__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_22__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_23__c', state => {\n if (state.pluckSfValue('Pre_23__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_23__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_24__c', state => {\n if (state.pluckSfValue('Pre_24__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_24__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_25__c', state => {\n if (state.pluckSfValue('Pre_25__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_25__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_26__c', state => {\n if (state.pluckSfValue('Pre_26__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_26__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_27__c', state => {\n if (state.pluckSfValue('Pre_27__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_27__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n field('Pre_28__c', state => {\n if (state.pluckSfValue('Pre_28__c') == null) return undefined\n const value = dataValue(state.pluckSfValue('Pre_28__c'))(state); \n return state.helperFunctions.transform(value);\n }),\n )\n )(state);\n});\n\n//Removing mapping... need case_id to upsert Events. Date_of_Pre__c update should be handled on the SF side.\n// upsert(\n// 'Event__c',\n// 'CommCare_Ext_ID__c',\n// fields(\n// field('CommCare_Ext_ID__c', dataValue('form.hidden_properties.intervention_name')),\n// field('Date_of_Pre__c', dataValue('form.date')),\n\n// )\n// );\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": "22c49c7c-e8b6-47aa-a0dd-6a50cd62fa5b"
}
},
"edges": {
"webhook->Upsert-Pre-Challenges": {
"enabled": true,
"id": "7b6d7320-09d7-450f-bfcc-0a58f75de7fb",
"source_trigger_id": "5aae414b-0a32-4c0d-944c-c9f8c94376f9",
"condition_expression": "state.data.form[\"@name\"] == \"Pre Challenges\" && state.data.form[\"hidden_properties\"][\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Pre Challenges",
"target_job_id": "1782e922-c0ad-402d-931e-119ee807fb19"
}
}
},
"?-HIV-Testing-Event-Snapshot": {
"id": "1e9e3c77-bda2-4c85-9944-958ecb993e7b",
"name": "? HIV Testing Event Snapshot",
"inserted_at": "2024-11-11T12:12:33.841638Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "06107f9d-e013-48fc-93eb-7d24de9285c4",
"type": "webhook"
}
},
"jobs": {
"HIV-Testing-Event-Snapshot": {
"id": "f58d935f-620b-4406-848c-b79d50caf18d",
"name": "HIV Testing Event Snapshot",
"body": "// push to production\nupsert(\n 'Event__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('Name', dataValue('form.basic_information.intervention')),\n field('Venue__c', dataValue('form.basic_information.venue')),\n field('Coach_A__c', dataValue('form.hidden_properties.coach_name')),\n field('Date__c', dataValue('form.basic_information.event_date')),\n field('Testing_Partner_Contact_Persion__c', dataValue('form.basic_information.testing_partner__contact_people')),\n field('of_People_in_Attendance_Testing_Events__c', dataValue('form.basic_information.number_in_attendance')),\n field('Event_Type__c', dataValue('form.basic_information.testing_event_type')),\n field('Coordinator__c', dataValue('form.basic_information.event_coordinator')),\n field(\n 'What_organization_discussed_VMMC__c',\n dataValue('form.basic_information.question2.what_organisation_discussed_mmc')\n ),\n field(\n 'What_organization_s_What_topic_s__c',\n dataValue(\n 'form.basic_information.information_sessions_other.what_organisations_delivered_a_session_and_what_was_the_topic_of_the_sessio'\n )\n ),\n field(\n 'How_was_the_information_presented__c',\n dataValue('form.basic_information.question2.how_was_this_information_presented_eg_lecture_individua_sessions_etc')\n ),\n field('how_many_people_attended_the_sessions__c', dataValue('form.basic_information.number_in_attendance')),\n field(\n 'How_many_people_attended_the_sessions_oh__c',\n dataValue('form.basic_information.question2.approximately_how_many_people_attended_the_sessions_in_total')\n ),\n field(\n 'Did_other_organizations_conduct__c',\n dataValue(\n 'form.basic_information.information_sessions_other.did_other_organisations_eg_youth-friendly_clinic_ministry_of_health_etc_con'\n )\n ),\n field(\n 'Testing_Key_Lesson_s_Learned__c',\n dataValue('form.basic_information.event_overview.highlights_key_challenges')\n ),\n field(\n 'X2_Main_challenges__c',\n dataValue(\n 'form.basic_information.event_overview.please_describe_highlights_key_challenges_and_main_lessons_learned_from_thi'\n )\n )\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->HIV-Testing-Event-Snapshot": {
"enabled": true,
"id": "8e2c5d1d-1400-4bd0-8a9b-5792f6dacaaf",
"source_trigger_id": "06107f9d-e013-48fc-93eb-7d24de9285c4",
"condition_expression": "state.data.form[\"@name\"] == \"HIV Testing Event Snapshot\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "HIV Testing Event Snapshot",
"target_job_id": "f58d935f-620b-4406-848c-b79d50caf18d"
}
}
},
"?-Malaria-Testing-Event-Snapshot": {
"id": "e42df5e5-91fe-470a-928e-f9a12a127fae",
"name": "? Malaria Testing Event Snapshot",
"inserted_at": "2024-11-11T12:13:19.724213Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "0f52e11d-b7ea-44bd-84a4-13448c7b30e4",
"type": "webhook"
}
},
"jobs": {
"Malaria-Testing-Event-Snapshot": {
"id": "f3705aa5-b4f9-4ed1-ac51-83f3fbe75379",
"name": "Malaria Testing Event Snapshot",
"body": "// push to production\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n fields(\n field('Name', dataValue('form.hidden_properties.event_name')),\n field('Date__c', dataValue('form.basic_information.event_details.event_date')),\n field('Testing_Partner_Contact_Persion__c', dataValue('form.event_information.testing_partner__contact_people')),\n field('of_People_in_Attendance_Testing_Events__c', dataValue('form.event_information.number_in_attendance')),\n field('Coordinator__c', dataValue('form.event_information.event_coordinator')),\n field(\n 'Did_an_organization_discuss_Malaria__c',\n dataValue('form.malaria_treatment_prevention.info_malaria_treatment')\n ),\n field('What_organization_s_What_topic_s__c', dataValue('form.malaria_treatment_prevention.which_organizations')),\n field(\n 'How_was_the_information_presented__c',\n dataValue('form.malaria_treatment_prevention.how_was_info_presented')\n ),\n //field('of_Participants__c', dataValue('form.malaria_treatment_prevention.how_many_total_participants')),\n field(\n 'Did_other_organizations_conduct__c',\n dataValue(\"form.skills_activities['did_other_organisations_eg_youth-friendly_clinic_ministry_of_health_etc_con']\")\n ),\n field(\n 'What_organization_s_What_topic_s__c',\n dataValue('form.skills_activities.what_organisations_delivered_a_session_and_what_was_the_topic_of_the_sessio')\n ),\n field('Facilitator_1__c', dataValue('form.skills_activities.facilitators')),\n field(\n 'How_many_people_attended_the_sessions__c',\n dataValue('form.skills_activities.how_many_people_attended_the_sessions_in_total')\n ),\n field(\n 'How_many_people_attended_the_sessions_oh__c',\n dataValue('form.skills_activities.how_many_people_attended_the_sessions_in_total')\n ),\n field(\n 'X2_Main_challenges__c',\n dataValue('form.bed_net_distribution.please_describe_highlights_key_challenges_and_main_lessons_learned_from_thi')\n ),\n field(\n 'X1_Main_successes__c',\n dataValue('form.bed_net_distribution.please_describe_highlights_key_challenges_and_main_lessons_learned_from_thi')\n ),\n field(\n 'Number_of_Bed_Nets_Distributed__c',\n dataValue('form.bed_net_distribution.total_number_of_bed_nets_distributed')\n ),\n //field('Site__c', dataValue('form.event_information.site')),\n //field('Venue__c', dataValue('form.event_information.venue')),\n //field('Curriculum__c', dataValue('form.event_information.curriculum')),\n field('X1_0_Intervention_Name__c', dataValue('form.event_information.intervention')),\n //field('Coach_1__c', dataValue('form.hidden_properties.coach_name')),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n field('Date__c', dataValue('form.event_information.event_date')),\n field('Testing_Partner_Contact_Persion__c', dataValue('form.event_information.testing_partner__contact_people')),\n field('of_People_in_Attendance_Testing_Events__c', dataValue('form.event_information.number_in_attendance')),\n field('Coordinator__c', dataValue('form.event_information.event_coordinator'))\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Malaria-Testing-Event-Snapshot": {
"enabled": true,
"id": "31cb158e-c6ca-49a8-8062-bc837ae68a2d",
"source_trigger_id": "0f52e11d-b7ea-44bd-84a4-13448c7b30e4",
"condition_expression": "state.data.form[\"@name\"] == \"Malaria Testing Event Snapshot\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Malaria Testing Event Snapshot",
"target_job_id": "f3705aa5-b4f9-4ed1-ac51-83f3fbe75379"
}
}
},
"?-Malaria-Testing-Event-Statistics": {
"id": "e723c6a7-ed84-44c0-8727-d56ecc248531",
"name": "? Malaria Testing Event Statistics",
"inserted_at": "2024-11-11T12:13:42.128035Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "cdb42671-744e-48d0-8b5a-749c311dea69",
"type": "webhook"
}
},
"jobs": {
"Malaria-Testing-Event-Statistics": {
"id": "193e6fba-2a95-4b8c-8932-0ca1409ad04f",
"name": "Malaria Testing Event Statistics",
"body": "// push to production\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\nfields(\n field('Name', dataValue('form.event_information.event_name')),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n field(\n 'Tested_Negative_Males_0_9__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question2')\n ),\n field(\n 'Tested_Negative_Males_10_14__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question7')\n ),\n field(\n 'Tested_Negative_Males_15_19__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question13')\n ),\n field(\n 'Tested_Negative_Males_20_24__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question18')\n ),\n field(\n 'Tested_Negative_Males_25_49__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question28')\n ),\n field(\n 'Tested_Negative_Males_50__c',\n dataValue('form.table_1_testing_results_malaria.male_malaria_negative.question32')\n ),\n field('Tested_Positive_Males_0_9__c', dataValue('form.table_1_testing_results_malaria.question33.question36')),\n field('Tested_Positive_Males_10_14__c', dataValue('form.table_1_testing_results_malaria.question33.question41')),\n field('Tested_Positive_Males_15_19__c', dataValue('form.table_1_testing_results_malaria.question33.question45')),\n field('Tested_Positive_Males_20_24__c', dataValue('form.table_1_testing_results_malaria.question33.question50')),\n field('Tested_Positive_Males_25_49__c', dataValue('form.table_1_testing_results_malaria.question33.question56')),\n field('Tested_Positive_Males_50__c', dataValue('form.table_1_testing_results_malaria.question33.question60')),\n field('Tested_Negative_Females_0_9__c', dataValue('form.table_1_testing_results_malaria.question61.question65')),\n field('Tested_Negative_Females_10_14__c', dataValue('form.table_1_testing_results_malaria.question61.question69')),\n field('Tested_Negative_Females_15_19__c', dataValue('form.table_1_testing_results_malaria.question61.question73')),\n field('Tested_Negative_Females_20_24__c', dataValue('form.table_1_testing_results_malaria.question61.question78')),\n field('Tested_Negative_Females_25_49__c', dataValue('form.table_1_testing_results_malaria.question61.question84')),\n field('Tested_Negative_Females_50__c', dataValue('form.table_1_testing_results_malaria.question61.question88')),\n field('Tested_Positive_Females_0_9__c', dataValue('form.table_1_testing_results_malaria.question89.question92')),\n field('Tested_Positive_Females_10_14__c', dataValue('form.table_1_testing_results_malaria.question89.question97')),\n field('Tested_Positive_Females_15_19__c', dataValue('form.table_1_testing_results_malaria.question89.question101')),\n field('Tested_Positive_Females_20_24__c', dataValue('form.table_1_testing_results_malaria.question89.question106')),\n field('Tested_Positive_Females_25_49__c', dataValue('form.table_1_testing_results_malaria.question89.question112')),\n field('Tested_Positive_Females_50__c', dataValue('form.table_1_testing_results_malaria.question89.question116'))\n));\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Malaria-Testing-Event-Statistics": {
"enabled": true,
"id": "024a5b81-5781-41cd-9a61-6c3aa2122817",
"source_trigger_id": "cdb42671-744e-48d0-8b5a-749c311dea69",
"condition_expression": "state.data.form[\"@name\"] == \"Malaria Testing Event Statistics\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Malaria Testing Event Statistics",
"target_job_id": "193e6fba-2a95-4b8c-8932-0ca1409ad04f"
}
}
},
"?-Register-Participant---V2-Skillz": {
"id": "d38c693b-1044-4466-b9d7-f408dbb97728",
"name": "? Register Participant - V2 Skillz",
"inserted_at": "2024-11-11T13:02:58.190758Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "48549153-e056-41d8-a9c1-f95ea91ead33",
"type": "webhook"
}
},
"jobs": {
"Register-Participant---V2-Skillz": {
"id": "a37b0669-ddf2-484a-a177-dee310f6fdae",
"name": "Register Participant - V2 Skillz",
"body": "query(`SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`);\n\nalterState(state => {\n // Note: lastReferenceValue selects the first item in the references array.\n state.data.eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n\n function objectToArray(object) {\n return !Array.isArray(object) ? [object] : object;\n }\n\n // if (state.data.form.question1) {\n // console.log('Ensuring that \"question1\" is an array.');\n // state.data.form.question1 = objectToArray(state.data.form.question1);\n // } else {\n // console.log('Shifting \"new_participants\" to \"question1\" array.');\n // state.data.form.question1 = objectToArray(state.data.form.new_participants);\n // console.log('Creating a \"case\" object inside each item in that array.');\n // state.data.form.question1 = state.data.form.question1.map(item => ({\n // ...item,\n // case: item.create_skillz_plus_participant.case,\n // }));\n // }\n\n console.log('Done with initial data manipulation.');\n\n return state;\n});\n\n// beta.each(\n// merge(\n// dataPath('form.question1[*]'),\n// fields(\n// field('intervention_notes_to_save', dataValue('form.intervention_notes_to_save')))\n// ),\n\n upsert(\n 'Person__c',\n 'Participant_Identification_Number_PID__c',\n fields(\n field('Notes__c', dataValue('form.intervention_notes_to_save')),\n field('First_Name__c', dataValue('form.new_participants.participant_first_name')),\n field('Surname__c', dataValue('form.new_participants.participant_surname')),\n relationship('RecordType', 'Name', 'Participant'),\n field('Participant_Identification_Number_PID__c', state => state.data.form.new_participants.create_skillz_plus_participant.case['@case_id']),\n field('Sex__c', dataValue('gender')),\n field('Mobile_Number_1__c', dataValue('form.new_participants.mobile_number')), //QUESTION: In CommCare, phone doesn't look like it's saving?\n field('School_name_person__c', dataValue('form.new_participants.school_name')),\n field('Date_of_Birth__c', dataValue('date_of_birth')),\n field('School_name_person__c', dataValue('form.new_participants.school_name')),\n field('Physical_Address__c', dataValue('form.new_participants.participants_home_address'))\n //field('Age__c', dataValue('form.question1.age_in_years')), //This is a SF formula field, cannot map\n )\n )\n//);\n\n// each(\n// merge(dataPath('form.question1[*]'), fields(\n// field('intervention_name', dataValue('form.intervention_name')),\n// field('eventName', dataValue('eventName')))),\n upsert(\n 'Attendance__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', state => {\n var eventid = `${state.data.eventName}` || dataValue('form.intervention_name')(state);\n var personid = state.data.form.new_participants.create_skillz_plus_participant.case['case_id'];//state.data.case['@case_id'];\n return personid + '-' + eventid;\n }),\n relationship(\n //Attendance looks up to Persn via the case_id\n 'Person_Attendance__r',\n 'Participant_Identification_Number_PID__c',\n state => state.data.case['@case_id']\n ),\n relationship(\n //Attendance looks up to Event via the intervention_name\n 'Event__r',\n 'CommCare_Case_ID__c',\n state.data.form.new_participants.create_skillz_plus_participant.case.index.parent['#text']\n ),\n field('Date_of_Birth__c', dataValue('form.new_participants.date_of_birth'))\n )\n )\n//);\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": null
}
},
"edges": {
"webhook->Register-Participant---V2-Skillz": {
"enabled": false,
"id": "afa110f8-bae3-448b-a967-c28173782ae3",
"source_trigger_id": "48549153-e056-41d8-a9c1-f95ea91ead33",
"condition_expression": "state.data.form[\"@name\"] == \"Register Participants\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Register Participants skillz",
"target_job_id": "a37b0669-ddf2-484a-a177-dee310f6fdae"
}
}
},
"?-Risk-and-Vulnerability-Assessment": {
"id": "d00b80a8-897d-4bae-a03e-7b641d9bda52",
"name": "? Risk and Vulnerability Assessment",
"inserted_at": "2024-11-11T13:04:10.487479Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "d1ee864c-c923-4fa5-be79-5ddca5b61992",
"type": "webhook"
}
},
"jobs": {
"Risk-and-Vulnerability-Assessment": {
"id": "6429e5de-0445-4092-9137-38b5aca600ca",
"name": "Risk and Vulnerability Assessment",
"body": "// Your job goes here. Testing github\nalterState(state => {\n function checked(key, str) {\n if (!str) return false;\n return str.toString().split(' ').indexOf(key) >= 0;\n }\n\n function capitalizeFirstLetter(str) {\n if (!str) return;\n let new_str = str.toString().toLowerCase();\n return new_str.slice(0, 1).toUpperCase() + new_str.slice(1);\n }\n\n function transformDont(str) {\n if (!str) return str;\n return str\n .toString()\n .split('_')\n .map(word => word.replace(/dont/i, \"don't\"))\n .join('_')\n .toString()\n .trim();\n }\n\n function transformCant(str) {\n if (!str) return str;\n return str\n .toString()\n .split('_')\n .map(word => word.replace(/cant/i, \"can't\"))\n .join('_')\n .toString()\n .trim();\n }\n\n function splitAndJoin(str, splitDelimiter, joinDelimiter) {\n if (!str) return;\n\n return str.toString().split(splitDelimiter).join(joinDelimiter).toString().trim();\n }\n\n function transformHowOften(str) {\n if (!str) return;\n if (str === 'special_occasions') return 'Special Occasions';\n return transformGenericText(str).toString().trim();\n }\n\n function transformHIVStatus(status) {\n switch (status) {\n case 'yes_negative':\n return 'Yes,Negative';\n case 'yes_positive':\n return 'Yes,Positive';\n case 'no_i_dont':\n return \"No,I don't know\";\n case 'yes_dont_want_to_disclose':\n return \"Yes, don't want to disclose\";\n default:\n return;\n }\n }\n\n function transformLastTested(str) {\n if (!str) return;\n switch (str.toString()) {\n case 'yes_negative':\n return 'Yes,Negative';\n case 'yes_positive':\n return 'Yes,Positive';\n case 'no_i_dont':\n return \"No,I don't know\";\n case 'yes_dont_want_to_disclose':\n return \"Yes, don't want to disclose\";\n default:\n return;\n }\n }\n\n function transformMonthAgo(str) {\n if (!str) return;\n switch (str) {\n case 'month_ago':\n return '1 month ago';\n case 'months_ago':\n return '3 months ago';\n case 'month_ago':\n return 'copy-1-of-months_ago ';\n case 'month_ago':\n return '6 months ago';\n case 'a_year_or_more_ago':\n return 'A year or more';\n default:\n return;\n }\n }\n\n function transformGenericText(str) {\n if (!str) return;\n return capitalizeFirstLetter(splitAndJoin(transformDont(str), '_', ' '))\n .toString()\n .trim();\n }\n\n function transformRange(range) {\n if (!range) return;\n return range\n .toString()\n .replace(/\\d_\\d/i, match => match.replace('_', '-'))\n .toString()\n .trim();\n }\n\n function transformAgeRange(range) {\n if (!range) return;\n if (range === '10_years') return '< 10 years';\n if (range === 'greater_than_19') return '> 19 years';\n return capitalizeFirstLetter(transformDont(transformCant(splitAndJoin(transformRange(range), '_', ' '))))\n .toString()\n .trim();\n }\n\n function transformAbuseExperienced(str) {\n if (!str) return;\n return str\n .split(' ')\n .map(word => capitalizeFirstLetter(word))\n .join(' ')\n .toString()\n .trim();\n }\n \n function getAge(dateString) {\n if (!dateString) return;\n\n const today = new Date();\n const birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n }\n\n state.data.perform_a_risk_assessment = state.data.form.do_you_want_to_perform_a_risk_assessment === 'yes';\n\n state.data.complete_service_referrals = state.data.form.referral_services ? true : false;\n \n state.data.form.hidden_properties.gender = \n capitalizeFirstLetter(state.data.form.hidden_properties.gender);\n\n state.helperFunctions = {\n checked,\n transformAgeRange,\n transformHIVStatus,\n transformLastTested,\n transformMonthAgo,\n transformGenericText,\n transformDont,\n splitAndJoin,\n transformHowOften,\n transformAbuseExperienced,\n getAge,\n };\n return state;\n});\n\nupsert(\n 'Risk_Assessment__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n field('Date__c', dataValue('form.date')),\n field('Participant_Name__c', state => {\n var firstname = state.data.form.hidden_properties.praticipant_first_name;\n var lastname = state.data.form.hidden_properties.participant_surname;\n return firstname + ' ' + lastname;\n }),\n field('Participant_Age__c', state => {\n const dob = dataValue('form.hidden_properties.date_of_birth')(state);\n\n return state.helperFunctions.getAge(dob);\n }),\n field('Participant_Sex__c', dataValue('form.hidden_properties.gender')),\n field('X1_0_Sexually_Active_past_12_month__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.sexually_active_12_months')(state)\n )\n ),\n field('X1_1_Age_at_first_sex__c', state =>\n state.helperFunctions.transformAgeRange(\n dataValue('form.sexual_risk_and_pregnancy.age_at_first_sex')(state)\n )\n ),\n field('X1_2_Have_you_ever_had_unprotected_sex__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.have_you_ever_had_unprotected_sex')(state)\n )\n ),\n field('X1_3_Sex_for_monetary_or_material_benefi__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.sex_monetary_material')(state)\n )\n ),\n field('Do_you_know_your_HIV_status__c', state =>\n state.helperFunctions.transformHIVStatus(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.do_you_know_your_hiv_status')(state)\n )\n ),\n field('X2_1_When_last_did_you_test_for_HIV__c', state =>\n state.helperFunctions.transformMonthAgo(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.when_last_did_you_test_for_hiv')(state)\n )\n ),\n field('X2_2_Are_you_on_treatment_ART__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.are_you_on_treatment_art')(state)\n )\n ),\n field('X3_0_Had_an_STI_in_the_last_12months_yea__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.hiv_last_12_months')(state)\n )\n ),\n field('X3_1_Past_12_months_sex_HIV_status_part__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.knowing_partners_hiv_status')(state)\n )\n ),\n //PENDING Donny change data type in SF\n // field('X4_0_Forms_of_abuse_experienced_before__c', state =>\n // state.helperFunctions.transformAbuseExperienced(\n // dataValue('form.risk_assessment.gender_based_violence.abuse_experienced')(state)\n // )\n // ),\n field('X4_1_Feel_unsafe_any1_interact_with_ofte__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.unsafe_with_others')(state)\n )\n ),\n field('X4_2_Of_what_relationship_person_to_you__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.relationship_of_abuser')(state)\n )\n ),\n field('X5_0_Do_you_take_alcohol_or_drugs__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.drugs_and_alcohol_use.do_you_take_alcohol_andor_drugs')(state)\n )\n ),\n field('X5_1_On_average_how_often_drink_alcohol__c', state =>\n state.helperFunctions.transformHowOften(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.drugs_and_alcohol_use.how_often_alcohol')(state)\n )\n ),\n field('X5_2_On_average_how_often_take_drugs__c', state =>\n state.helperFunctions.transformHowOften(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.drugs_and_alcohol_use.how_often_drugs')(state)\n )\n ),\n field('X5_3_Easy_for_teens_to_obtain_alcohol__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.drugs_and_alcohol_use.alcohol_19')(state)\n )\n ),\n field('X5_4__c', state =>\n state.helperFunctions.transformGenericText(\n dataValue('form.sexual_risk_and_pregnancy.hiv_status.sti_and_pep.gender_based_violence.drugs_and_alcohol_use.illegal_drugs_19')(state)\n )\n )\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Risk-and-Vulnerability-Assessment": {
"enabled": true,
"id": "8c96057d-d3ff-4aaa-9aa0-fc63ed900790",
"source_trigger_id": "d1ee864c-c923-4fa5-be79-5ddca5b61992",
"condition_expression": "state.data.form[\"@name\"] == \"Risk and Vulnerability Assessment\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Risk & Vulnerability Assessment",
"target_job_id": "6429e5de-0445-4092-9137-38b5aca600ca"
}
}
},
"?-Upsert-Confirm-Services-Received": {
"id": "0f8340db-f7ef-4205-bf93-8f31926dc60d",
"name": "? Upsert Confirm Services Received",
"inserted_at": "2024-11-11T13:04:37.486611Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "49785a62-712a-4a16-91ef-94c78a49729e",
"type": "webhook"
}
},
"jobs": {
"Upsert-Confirm-Services-Received": {
"id": "6ed3da99-a209-4814-9ce3-290432d13c8f",
"name": "Upsert Confirm Services Received",
"body": "// Your job goes here.\nalterState(state => {\n state.data.external_commcare_id = (\n dataValue('form.hidden_properties.intervention_name')(state) +\n dataValue('form.hidden_properties.participant_first_name')(state) +\n dataValue('form.hidden_properties.participant_surname')(state)\n )\n .toString()\n .toLowerCase()\n .replace(/\\s/g, '')\n .trim();\n\n return state;\n});\n\nupsert(\n 'NewReferral__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('Business_Unit_Site__c', state => {\n const bu = dataValue('form.business_unit')(state);\n return bu === 'X' ? 'GRS Zambia' : bu;\n }),\n field('CommCare_Ext_ID__c', dataValue('form.case.@case_id')),\n field('HIV_Testing_Services_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option1')(state)\n )\n ),\n field('TB_Screening_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option2')(state)\n )\n ),\n field('VMMC_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option3')(state)\n )\n ),\n field('Post_Exposure_Prophylaxis_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option4'\n )(state)\n )\n ),\n field('PrEP_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option5'\n )(state)\n )\n ),\n field('HIV_STI_PREVENTION_Other_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option6'\n )(state)\n )\n ),\n field('ART_Initiation_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option1')(\n state\n )\n )\n ),\n field('SKILLZ_Plus_Club_Support_Service_Provid__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option2')(\n state\n )\n )\n ),\n \n field(\n 'PMTCT_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option3')(\n state\n )\n )\n ), \n field('IPTG_Health_Facility__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option1')(\n state\n )\n )\n ), \n field('IPTG_Specialized_to_SMZ__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option2')(\n state\n )\n )\n ), \n \n field('ART_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.referred_art_support_services')(state)\n )\n ),\n field(\n 'Victim_Friendly_Services_Service_Provide__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option1'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option2'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option3'\n )(state)\n )\n ),\n field('Legal_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option3'\n )(state)\n )\n ),\n\n field('STI_Screen_Testing_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option1')(state))\n ),\n \n field('Contraception_Family_Plan_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option2')(state))\n ),\n field('Cervical_Cancer_Screen_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option3')(state))\n ),\n field('HPV_vaccine_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option4')(state))\n ),\n field('Antenatal_Care_ANC_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option5')(state))\n ),\n field('Sexual_and_GBV_Abuse_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option6')(state))\n ),\n field(\n 'Psycho_Social_Support_Service_Provider__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option9'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option8'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option7'\n )(state)\n )\n ),\n field('Psycho_Social_Services_Other_Service_Pro__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option10')(state))\n ),\n field(\n 'Legal_Services_Other_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_referral_services')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option1')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option2')(state)\n )\n ),\n \n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Confirm-Services-Received": {
"enabled": true,
"id": "97d7a0fc-54f0-4dc4-bd63-d0de8f70cd65",
"source_trigger_id": "49785a62-712a-4a16-91ef-94c78a49729e",
"condition_expression": "state.data.form[\"@name\"] == \"Confirm Services Received\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Confirm Services Received",
"target_job_id": "6ed3da99-a209-4814-9ce3-290432d13c8f"
}
}
},
"?-Upsert-Aggregate-Service-Referrals": {
"id": "26c27dba-1efb-45a6-bcdd-fbb34197a4ef",
"name": "? Upsert Aggregate Service Referrals",
"inserted_at": "2024-11-11T13:06:15.248670Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "5a57bf06-ee7f-4c5c-9ce1-8d0d9237fd80",
"type": "webhook"
}
},
"jobs": {
"Upsert-Aggregate-Service-Referrals": {
"id": "1cf44503-c2f2-488a-a04c-0eb046942f3f",
"name": "Upsert Aggregate Service Referrals",
"body": "// Push to production\nupsert(\n 'GRS_Referral_Agg__c',\n 'CommCare_Ext_ID__c',\n fields(\n relationship(\n 'SiteName__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.general_referral_information.event_information.site')\n ),\n field('CommCare_Ext_ID__c', dataValue('form.general_referral_information.event_information.site')),\n //TO DO\n //field('Business_Unit__c', dataValue('form.general_referral_information.event_information.business_unit')),\n field('Business_Unit__c', state => {\n const bu = dataValue('form.general_referral_information.event_information.business_unit')(state); \n return bu==='65680f0c4c144b03ad0f86bdc46c1ebc' ? 'GRS Zambia' : \n bu==='04d98397e28046118fade28ced6b65cb' ? 'GRS Zimbabwe' : \n bu==='ed125ab19ec34aacab79585e59eb76f4' ? 'GRS Partnerships': undefined ; \n }),\n relationship(\n //Attendance looks up to Event via the intervention_name\n 'Events__r',\n 'CommCare_Ext_ID__c',\n dataValue('form.general_referral_information.event_information.event_name')\n ),\n field('Type_of_Referral__c', dataValue('form.general_referral_information.type_of_referral')),\n field(\n 'Enter_Partner_s_Name__c',\n dataValue('form.general_referral_information.partner_or_organization_referred_to')\n ),\n field('Males_Referred_HIV_Testing__c', dataValue('form.hivsti_services.males_referred_for_hiv_testing')),\n field('Males_referred_for_STI_Screening__c', dataValue('form.hivsti_services.males_referred_for_sti_screening')),\n field('Males_Referred_for_PEP__c', dataValue('form.hivsti_services.males_referred_for_pep')),\n field('Males_Referred_for_PrEP__c', dataValue('form.hivsti_services.males_referred_for_prep')),\n field('Males_Referred_for_VMMC__c', dataValue('form.hivsti_services.males_referred_for_vmmc')),\n field('Females_Referred_for_HIV_Testing__c', dataValue('form.hivsti_services.females_referred_for_hiv_testing')),\n field(\n 'Females_Referred_for_STI_Screening__c',\n dataValue('form.hivsti_services.females_referred_for_sti_screening')\n ),\n field('Date_Referred__c', dataValue('form.general_referral_information.date_referred')),\n field('Females_Referred_for_PEP__c', dataValue('form.hivsti_services.females_referred_for_pep')),\n field('Females_Referred_for_PrEP__c', dataValue('form.hivsti_services.females_referred_for_prep')),\n field('Males_Referred_for_ART__c', dataValue('form.art_services.males_referred_for_art')),\n field('Males_Referred_for_SKILLZ_Club__c', dataValue('form.art_services.males_referred_for_skillz__club')),\n field('Females_Referred_for_ART__c', dataValue('form.art_services.females_referred_for_art')),\n field('Females_Referred_SKILLZ_Club__c', dataValue('form.art_services.females_referred_for_skillz__club')),\n field('Females_Referred_for_PMTCT__c', dataValue('form.art_services.females_referred_for_pmtct')),\n \n field(\n 'Males_Referred_for_Psycho_Social_Support__c',\n dataValue('form.psycho_-_social_services.males_referred_for_psycho-social_support')\n ),\n field(\n 'Females_Referred_Psycho_Social_Support__c',\n dataValue('form.psycho_-_social_services.females_referred_for_psycho-social_support')\n ),\n field('Males_Referred_for_TB_Screening__c', dataValue('form.tb_services.males_referred_for_tb_screening')),\n field('Females_Referred_for_TB_Screening__c', dataValue('form.tb_services.females_referred_for_rb_screening')),\n field(\n 'Number_of_Male_Condoms_distributed__c',\n dataValue('form.condom_distributions.number_of_male_condoms_distributed')\n ),\n field('Number_of_Male_Condoms_Accessed__c', dataValue('form.condom_distributions.number_of_male_condoms_accessed')),\n field(\n 'Number_of_Female_Condoms_distributed__c',\n dataValue('form.condom_distributions.number_of_female_condoms_distributed')\n ),\n field(\n 'Number_of_Female_Condoms_Accessedx__c',\n dataValue('form.condom_distributions.number_of_female_condoms_accessed')\n ),\n field(\n 'Females_Referred_for_Family_Planning__c',\n dataValue('form.other_srhr_services.females_referred_for_family_planning')\n ),\n field(\n 'Females_Referred_for_Cervical_Cancer__c',\n dataValue('form.other_srhr_services.females_referred_for_cervical_cancer')\n ),\n field('Females_Referred_for_Antenatal__c', dataValue('form.other_srhr_services.females_referred_for_antenatal')),\n field(\n 'Males_Referred_for_Malaria_Testing__c',\n dataValue('form.other_referral_services.males_referred_for_malaria_testing')\n ),\n field('Males_Referred_for_GBV__c', dataValue('form.other_referral_services.males_referred_for_gbv')),\n field(\n 'Females_Referred_for_Malaria_Testing__c',\n dataValue('form.other_referral_services.females_referred_for_malaria_testing')\n ),\n field('Females_Referred_for_GBV__c', dataValue('form.other_referral_services.females_referred_for_gbv')),\n field(\n 'Females_Referred_for_HPV_Vaccine__c',\n dataValue('form.other_referral_services.females_referred_for_hpv_vaccine')\n )\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Aggregate-Service-Referrals": {
"enabled": true,
"id": "51af75c9-66be-4aed-a9ab-a0708286f623",
"source_trigger_id": "5a57bf06-ee7f-4c5c-9ce1-8d0d9237fd80",
"condition_expression": "state.data.form[\"@name\"] == \"Aggregate Service Referrals\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Aggregate Service Referrals",
"target_job_id": "1cf44503-c2f2-488a-a04c-0eb046942f3f"
}
}
},
"?-Upsert-ART-Adherence-Self-Reporting-Tool": {
"id": "2f79851b-d93b-4400-a20d-f65ab9a8766c",
"name": "? Upsert ART Adherence Self-Reporting Tool",
"inserted_at": "2024-11-11T13:08:31.370986Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "d111d523-6550-40b2-abc9-26527cddbea7",
"type": "webhook"
}
},
"jobs": {
"Upsert-ART-Adherence-Self-Reporting-Tool": {
"id": "bb612d9d-4f7b-42fe-90c8-4225610fb107",
"name": "Upsert ART Adherence Self-Reporting Tool",
"body": "// Push to production\nalterState(state => {\n\n function getAge(dateString) {\n if (!dateString) return;\n\n const today = new Date();\n const birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n }\n\n function transform(value) {\n if (!value) return;\n switch (value.toString().trim()) {\n case 'i_dont_know__i_dont_recall':\n return \"I don't know/I don't recall\";\n case 'i_dont_recall':\n return \"I don't know/I don't recall\";\n case 'no':\n return 'No';\n case 'yes':\n return 'Yes';\n case 'na':\n return 'NA'; \n case 'disagree':\n return '2 (Disagree)';\n case 'agree':\n return '4 (Agree)'; \n case 'neither_agree_or_disagree':\n return '3 (Neither Agree or Disagree)';\n case 'strongly_agree':\n return '5 (Strongly Agree)'; \n case 'strongly_disagree':\n return '1 (Strongly Disagree)'; \n case 'sure':\n return '4 (Agree)'; \n case 'very_sure':\n return '5 (Strongly Agree)';\n case 'i_dont_know':\n return 'I dont know'; \n case 'suppressed':\n return 'Suppressed'; \n case 'unsuppressed':\n return 'Unsuppressed'; \n default:\n return value;\n }\n }\n\n state.helperFunctions = { getAge };\n \n state.data.form.behavioural.are_you_taking_any_other_religious_treatment_ie_holy_water_anointing_oilwat = \n transform(state.data.form.behavioural.are_you_taking_any_other_religious_treatment_ie_holy_water_anointing_oilwat)\n \n state.data.form.behavioural.are_you_taking_any_traditional_medicine_as_a_supplement_to_the_arvs = \n transform(state.data.form.behavioural.are_you_taking_any_traditional_medicine_as_a_supplement_to_the_arvs)\n \n state.data.form.behavioural.if_yes_to_any_of_the_above_did_it_affect_your_taking_of_medication_treatmen = \n transform(state.data.form.behavioural.if_yes_to_any_of_the_above_did_it_affect_your_taking_of_medication_treatmen)\n \n state.data.form.behavioural.in_the_past_month_did_you_go_for_a_party_or_other_leisure_activities = \n transform(state.data.form.behavioural.in_the_past_month_did_you_go_for_a_party_or_other_leisure_activities)\n \n state.data.form.behavioural.in_the_past_month_did_you_sleep_away_from_home = \n transform(state.data.form.behavioural.in_the_past_month_did_you_sleep_away_from_home)\n \n state.data.form.clinical_knowledge.do_you_know_your_cd4_count = \n transform(state.data.form.clinical_knowledge.do_you_know_your_cd4_count)\n \n state.data.form.clinical_knowledge.question16 = \n transform(state.data.form.clinical_knowledge.question16)\n \n state.data.form.clinical_knowledge.do_you_know_your_viral_load = \n transform(state.data.form.clinical_knowledge.do_you_know_your_viral_load)\n \n state.data.form.clinical_knowledge.when_did_you_last_go_for_these_two_clinical_tests = \n transform(state.data.form.clinical_knowledge.when_did_you_last_go_for_these_two_clinical_tests)\n \n state.data.form.treatment_adherence.did_you_encounter_any_challenges_in_taking_your_medication_as_prescribed_in = \n transform(state.data.form.treatment_adherence.did_you_encounter_any_challenges_in_taking_your_medication_as_prescribed_in)\n \n state.data.form.treatment_adherence.in_the_past_month_have_you_failed_to_take_any_of_your_art_treatment = \n transform(state.data.form.treatment_adherence.in_the_past_month_have_you_failed_to_take_any_of_your_art_treatment)\n \n state.data.form.treatment_adherence.in_the_past_month_have_you_taken_any_of_your_art_treatment_at_times_other_t = \n transform(state.data.form.treatment_adherence.in_the_past_month_have_you_taken_any_of_your_art_treatment_at_times_other_t)\n \n state.data.form.treatment_adherence.in_the_past_month_have_you_taken_less_or_more_pills_of_any_of_your_art_trea = \n transform(state.data.form.treatment_adherence.in_the_past_month_have_you_taken_less_or_more_pills_of_any_of_your_art_trea)\n \n state.data.form['treatment_self-efficacy'].how_sure_are_you_that_you_will_be_taking_your_medication_as_are_directed = how_sure_are_you_that_you_will_be_taking_your_medication_as_are_directed = \n transform(state.data.form['treatment_self-efficacy'].how_sure_are_you_that_you_will_be_taking_your_medication_as_are_directed)\n \n state.data.form['treatment_self-efficacy'].how_sure_are_you_that_your_medication_will_have_a_positive_effect_on_your_h = \n transform(state.data.form['treatment_self-efficacy'].how_sure_are_you_that_your_medication_will_have_a_positive_effect_on_your_h)\n \n state.data.form['treatment_self-efficacy'].how_sure_are_you_that_your_medication_will_help_you_live_a_longer_and_healt = \n transform(state.data.form['treatment_self-efficacy'].how_sure_are_you_that_your_medication_will_help_you_live_a_longer_and_healt)\n \n state.data.form.clinical_knowledge.question16 = \n transform(state.data.form.clinical_knowledge.question16) \n \n state.data.form.clinical_knowledge.when_did_you_last_have_your_clinical_test = \n state.data.form.clinical_knowledge.when_did_you_last_have_your_clinical_test ? transform(state.data.form.clinical_knowledge.when_did_you_last_have_your_clinical_test)\n : transform(state.data.form.clinical_knowledge.when_did_you_last_go_for_these_two_clinical_tests);\n \n return state;\n});\n\n\n\nupsert(\n 'ART_ADHERENCE_SELF_SELF_REPORTING_TOOL__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n field('Date__c', dataValue('form.demographic_information.date')),\n field('Sex__c', dataValue('form.gender')),\n field('Facility_Name__c', dataValue('form.school')),\n field('Patient_ID_or_Facility_File_Number__c', dataValue('form.skillz_lplus_number')),\n //field('Business_Unit__c', 'GRS Zambia'),\n field('Captured_By__c', dataValue('form.coach_name')),\n field('Verified_By__c', dataValue('form.coach_name')),\n field('Captured_Date__c', dataValue('form.demographic_information.date')),\n field('Verified_Date__c', dataValue('form.demographic_information.date')),\n field('Age__c', state => {\n const dob = dataValue('form.date_of_birth')(state);\n return state.helperFunctions.getAge(dob);\n }), \n field(\n 'Treatment_Adherence_3__c',\n dataValue('form.treatment_adherence.in_the_past_month_have_you_taken_any_of_your_art_treatment_at_times_other_t')\n ),\n field(\n 'Treatment_Adherence_2__c',\n dataValue('form.treatment_adherence.in_the_past_month_have_you_failed_to_take_any_of_your_art_treatment')\n ),\n field(\n 'Treatment_Adherence_4__c',\n dataValue('form.treatment_adherence.in_the_past_month_have_you_taken_less_or_more_pills_of_any_of_your_art_trea')\n ),\n field(\n 'Treatment_Adherence_5_a__c',\n dataValue('form.treatment_adherence.did_you_encounter_any_challenges_in_taking_your_medication_as_prescribed_in')\n ),\n \n \n field('Clinical_Knowledge_2__c', dataValue('form.clinical_knowledge.question16')),\n field(\n 'Clinical_Knowledge_1__c',\n dataValue('form.clinical_knowledge.when_did_you_last_have_your_clinical_test')\n ),\n field(\n 'Treatment_Self_Efficacy__c',\n dataValue('form.treatment_self-efficacy.how_sure_are_you_that_you_will_be_taking_your_medication_as_are_directed')\n ),\n field(\n 'Treatment_Self_Efficacy_10__c',\n dataValue(\n 'form.treatment_self-efficacy.how_sure_are_you_that_your_medication_will_have_a_positive_effect_on_your_h'\n )\n ),\n field(\n 'Treatment_Self_Efficacy_11__c',\n dataValue(\n 'form.treatment_self-efficacy.how_sure_are_you_that_your_medication_will_help_you_live_a_longer_and_healt'\n )\n ),\n field(\n 'Behavioural_Factors_12__c',\n dataValue('form.behavioural.in_the_past_month_did_you_go_for_a_party_or_other_leisure_activities')\n ),\n field('Behavioural_Factors_13__c', dataValue('form.behavioural.in_the_past_month_did_you_sleep_away_from_home')),\n field(\n 'Behavioural_Factors_14__c',\n dataValue('form.behavioural.are_you_taking_any_traditional_medicine_as_a_supplement_to_the_arvs')\n ),\n field(\n 'Behavioural_Factors_14__c',\n dataValue('form.behavioural.are_you_taking_any_other_religious_treatment_ie_holy_water_anointing_oilwat')\n ),\n field(\n 'Behavioural_Factors_15__c',\n dataValue('form.behavioural.if_yes_to_any_of_the_above_did_it_affect_your_taking_of_medication_treatmen')\n )\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-ART-Adherence-Self-Reporting-Tool": {
"enabled": true,
"id": "1813607c-fdae-4267-8380-998f4c867aab",
"source_trigger_id": "d111d523-6550-40b2-abc9-26527cddbea7",
"condition_expression": "state.data.form[\"@name\"] == \"ART Adherence Self-Reporting Tool\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "ART Adherence Self-Reporting Tool",
"target_job_id": "bb612d9d-4f7b-42fe-90c8-4225610fb107"
}
}
},
"?-Upsert-Attendance-Skillz-Plus-Club": {
"id": "928f6523-1a4e-48aa-b182-eb422b08ac81",
"name": "? Upsert Attendance Skillz Plus Club",
"inserted_at": "2024-11-11T13:08:50.627239Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "9ced450e-c942-4c23-ab44-3678a114e46a",
"type": "webhook"
}
},
"jobs": {
"Upsert-Attendance-Skillz-Plus-Club": {
"id": "1bc1963e-0f76-4e0b-abe2-68fbd18c8479",
"name": "Upsert Attendance Skillz Plus Club",
"body": "query(\n `SELECT Participant_Identification_Number_PID__c from Person__c where Participant_Identification_Number_PID__c = '${state.data.form.attendance_list.update_participant_cases.item[0]['@id']}'`\n);\n\nfn(state => {\n const PID = lastReferenceValue('records[0].Participant_Identification_Number_PID__c')(state);\n\n if (!PID) {\n console.log(\n `Participant not found with Participant_Identification_Number_PID__c: ${state.data.form.attendance_list.update_participant_cases.item[0]['@id']}`\n );\n return state;\n }\n return execute(\n // Set state.references to event record\n query(\n `SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`\n ),\n // Organise data and keep it safe\n fn(state => {\n function objectToArray(object) {\n if (!object) return [];\n return !Array.isArray(object) ? [object] : object;\n }\n\n const eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n state.data.eventName = eventName;\n\n state.data.form.attendance_list.update_participant_cases.item = objectToArray(\n state.data.form.attendance_list.update_participant_cases.item\n );\n\n state.data.form.attendance_list.update_participant_cases.item =\n state.data.form.attendance_list.update_participant_cases.item.map(item => ({\n ...item,\n CommCare_Ext_ID__c: `${item['@id']}-${eventName}`,\n event_case_id: state.data.form.case['@case_id'],\n }));\n\n // Keep our data safe\n state.items = state.data.form.attendance_list.update_participant_cases.item;\n\n // Reset references\n state.references = [];\n\n return state;\n }),\n // Set state.references to an array of attendance records for each participant\n beta.each(\n '$.items[*]',\n query(\n state => `SELECT CommCare_Ext_ID__c, Session_1__c, Session_2__c, Session_3__c, Session_4__c, Session_5__c, Session_6__c, Session_7__c, Session_8__c, Session_9__c, Session_10__c, Session_11__c, Session_12__c, Session_13__c, Session_14__c, Session_15__c, Session_16__c, Session_17__c, Session_18__c, Session_19__c, Session_20__c, Session_21__c, Session_22__c, Session_23__c,Session_24__c, Session_25__c, Session_26__c, Session_27__c, Session_28__c\n FROM Attendance__c\n WHERE CommCare_Ext_ID__c = '${state.data.CommCare_Ext_ID__c}'\n `\n )\n ),\n // Calculate dynamic fields\n fn(state => {\n state.items = state.items.map(item => {\n const record = state.references.find(rec =>\n rec.records[0] ? rec.records[0].CommCare_Ext_ID__c === item.CommCare_Ext_ID__c : true\n ).records[0];\n\n function getSessionValue(present) {\n if (!present) return 'U';\n switch (present.toString().toLowerCase()) {\n case 'yes':\n return 'X';\n case 'no':\n return 'A';\n case '':\n return 'N';\n default:\n return 'U';\n }\n }\n\n function getSessionFieldName(record) {\n if (!record || Object.keys(record).length === 0) {\n return 'Session_1__c';\n }\n\n const fieldName = Object.entries(record)\n .filter(rec => rec[1] === null && rec[0] !== 'CommCare_Ext_ID__c')\n .sort(function (a, b) {\n return a[0].split('_')[1] - b[0].split('_')[1];\n })[0][0];\n\n return fieldName;\n }\n\n const sessionValue = getSessionValue(item.attendance_session);\n const sessionDate = item.date;\n const sessionFieldName = getSessionFieldName(record);\n const sessionDateFieldName = `Session_${sessionFieldName.split('_')[1]}_Date__c`;\n\n return {\n ...item,\n dynamicFields: {\n [sessionFieldName]: sessionValue,\n [sessionDateFieldName]: sessionDate,\n },\n };\n });\n\n // Reset state.references\n state.references = [];\n\n return state;\n }),\n\n // Upsert\n beta.each(\n '$.items[*]',\n upsert('Attendance__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n field('CommCare_Ext_ID__c', dataValue('CommCare_Ext_ID__c')),\n relationship('Person_Attendance__r', 'Participant_Identification_Number_PID__c', dataValue('@id')),\n relationship('Event__r', 'CommCare_Case_ID__c', dataValue('event_case_id'))\n ),\n ...state.data.dynamicFields,\n }))\n )\n )(state);\n});\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Attendance-Skillz-Plus-Club": {
"enabled": true,
"id": "98392895-b1a7-4825-a28c-508a765521f3",
"source_trigger_id": "9ced450e-c942-4c23-ab44-3678a114e46a",
"condition_expression": "state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\" && state.data.form[\"skillz_attendance\"] == \"1\"",
"condition_type": "js_expression",
"condition_label": "Attendance Skillz Plus Club",
"target_job_id": "1bc1963e-0f76-4e0b-abe2-68fbd18c8479"
}
}
},
"?-Upsert-Register-Participant-Skillz": {
"id": "384a3240-a7f8-487d-a6af-52d52d81f055",
"name": "? Upsert Register Participant Skillz",
"inserted_at": "2024-11-11T13:09:12.476209Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "3ddf5768-5859-488c-84fc-72250a193899",
"type": "webhook"
}
},
"jobs": {
"Upsert-Register-Participant-Skillz": {
"id": "8328ede7-90c1-4d92-9d3c-7ce6ae91aada",
"name": "Upsert Register Participant Skillz",
"body": "query(\n `SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.case['@case_id']}'`\n);\n\nfn(state => {\n // Note: lastReferenceValue selects the first item in the references array.\n state.data.eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n state.data.eventCase = dataValue('form.case.@case_id')(state);\n\n function objectToArray(object) {\n return !Array.isArray(object) ? [object] : object;\n }\n\n const { form } = state.data;\n if (form.question1) {\n console.log('Ensuring that \"question1\" is an array.');\n form.question1 = objectToArray(form.question1);\n } else if (!form.new_participants) {\n console.log('Nothing to upsert. No participants were registered');\n } else {\n console.log('Shifting \"new_participants\" to \"question1\" array.');\n form.question1 = objectToArray(form.new_participants);\n console.log('Creating a \"case\" object inside each item in that array.');\n form.question1 = form.question1.map(item => ({\n ...item,\n case: item.create_skillz_plus_participant.case,\n }));\n }\n\n console.log('Done with initial data manipulation.');\n const persons = merge(\n dataPath('form.question1[*]'),\n fields(field('intervention_notes_to_save', dataValue('form.intervention_notes_to_save')))\n )(state);\n\n const attendances = merge(\n dataPath('form.question1[*]'),\n fields(\n field('intervention_name', dataValue('form.intervention_name')),\n field('eventCase', dataValue('eventCase')),\n field('eventName', dataValue('eventName'))\n )\n )(state);\n\n return { ...state, persons, attendances };\n});\n\neach(\n 'persons[*]',\n upsert(\n 'Person__c',\n 'Participant_Identification_Number_PID__c',\n fields(\n field('Notes__c', dataValue('intervention_notes_to_save')),\n field('First_Name__c', dataValue('participant_first_name')),\n field('Surname__c', dataValue('participant_surname')),\n relationship('RecordType', 'Name', 'Participant'),\n relationship('Site__r', 'CommCare_Ext_ID__c', dataValue('grp_location.site_id')),\n field('Participant_Identification_Number_PID__c', state => state.data.case['@case_id']),\n field('Sex__c', dataValue('gender')),\n field('Mobile_Number_1__c', dataValue('mobile_number')), //QUESTION: In CommCare, phone doesn't look like it's saving?\n field('School_name_person__c', dataValue('school_name')),\n field('Date_of_Birth__c', dataValue('date_of_birth')),\n field('School_name_person__c', dataValue('school_name')),\n field('Physical_Address__c', dataValue('participants_home_address')),\n field('Age_1_0__c', dataValue('participants_age_to_save'))\n )\n )\n);\n\neach(\n 'attendances[*]',\n upsert(\n 'Attendance__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', state => {\n const eventid = toUTF8(`${state.data.intervention_name}` || `${state.data.eventName}`); //dataValue('intervention_name')(state) || `${state.data.eventName}`;\n const personid = state.data.case['@case_id'];\n const value = personid + '-' + eventid.replace(/\\//gi, '');\n return scrubEmojis(value, '');\n }),\n relationship(\n //Attendance looks up to Persn via the case_id\n 'Person_Attendance__r',\n 'Participant_Identification_Number_PID__c',\n state => state.data.case['@case_id']\n ),\n relationship(\n //Attendance looks up to Event via the Event case_id\n 'Event__r',\n 'CommCare_Case_ID__c',\n state => `${state.data.eventCase}`\n ),\n // relationship(\n // //Attendance looks up to Event via the intervention_name\n // 'Event__r',\n // 'CommCare_Ext_ID__c',\n // state => `${state.data.intervention_name}` || `${state.data.eventName}`\n // ),\n field('Date_of_Birth__c', dataValue('date_of_birth'))\n )\n )\n);\n\n//First we insert Person record\n// fn(state => {\n// return upsert(\n// 'Person__c',\n// 'Participant_Identification_Number_PID__c',\n// fields(\n// field('Notes__c', dataValue('form.intervention_notes_to_save')),\n// field('First_Name__c', dataValue('form.question1.participant_first_name')),\n// field('Surname__c', dataValue('form.question1.participant_surname')),\n// relationship('RecordType', 'Name', 'Participant'),\n// field('Participant_Identification_Number_PID__c', state => state.data.case['@case_id']),\n// field('Sex__c', dataValue('form.question1.gender')),\n// //field('Age__c', dataValue('form.question1.age_in_years')), //This is a SF formula field, cannot map\n// field('Mobile_Number_1__c', dataValue('form.question1.mobile_number')),\n// field('School_name_person__c', dataValue('form.question1.school_name'))\n// )\n// )(state);\n// });\n\n// fn(state => {\n// //Then we upsert related Attendance records\n// return upsert(\n// 'Attendance__c',\n// 'CommCare_Ext_ID__c',\n// fields(\n// field('CommCare_Ext_ID__c', state => {\n// var eventid = dataValue('form.intervention_name')(state);\n// var personid = dataValue('form.case.@case_id')(state);\n// return personid + '-' + eventid;\n// }),\n// relationship(\n// //Attendance looks up to Persn via the case_id\n// 'Person_Attendance__r',\n// 'Participant_Identification_Number_PID__c',\n// dataValue('form.case.@case_id')\n// ),\n// relationship(\n// //Attendance looks up to Event via the intervention_name\n// 'Event__r',\n// 'Name',\n// dataValue('form.intervention_name')\n// ),\n// field('Date_of_Birth__c', dataValue('form.question1.date_of_birth'))\n// )\n// )(state);\n// });\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Register-Participant-Skillz": {
"enabled": true,
"id": "2228adf8-3af3-477f-b43c-5c9a873c418d",
"source_trigger_id": "3ddf5768-5859-488c-84fc-72250a193899",
"condition_expression": "state.data.form[\"@name\"] == \"Register Participants\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Register Participants skillz",
"target_job_id": "8328ede7-90c1-4d92-9d3c-7ce6ae91aada"
}
}
},
"?-Upsert-Coach-Support-Visit-CSV": {
"id": "f9f76556-c6d0-4e20-9000-796881078d85",
"name": "? Upsert Coach Support Visit CSV",
"inserted_at": "2024-11-11T13:09:28.554076Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "70babe72-f621-4d74-8c77-eeb8dc4d8e67",
"type": "webhook"
}
},
"jobs": {
"Upsert-Coach-Support-Visit-CSV": {
"id": "d9919692-19d9-4ddc-8c9a-0b23027864b2",
"name": "Upsert Coach Support Visit CSV",
"body": "//openfn.org source\nalterState(state => {\n function clean(str) {\n console.log('str', str);\n\n if (!str) return '';\n\n return str\n .split('_')\n .map(word => {\n let new_word = word.toString().toLowerCase();\n return new_word.slice(0, 1).toUpperCase() + new_word.slice(1);\n })\n .join(' ');\n }\n \n if (state.data.form['step_3_-_the_big_5'] !== undefined ){ \n state.data.form['step_3_-_the_big_5'].faciliation = clean(state.data.form['step_3_-_the_big_5'].faciliation);\n }\n else{\n state.data.form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.faciliation = \n clean(state.data.form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.faciliation);\n }\n \n function transform(value) {\n if (!value) return;\n switch (value.toString().trim()) {\n case 'copy-1-of-excellent':\n return 'Excellent'; \n case 'needs_improvement':\n return 'Needs Improvement'; \n case 'meets_expectations':\n return 'Meets Expectations'; \n case 'excellent':\n return 'Excellent'; \n case 'unsatisfactory':\n return 'Unsatisfactory';\n case 'exceeds_expectations':\n return 'Exceeds Expectations'; \n default:\n return value;\n }\n }\n\n state.data.form['step_3_-_the_big_5'].builds_personal_connections = \n transform(state.data.form['step_3_-_the_big_5'].builds_personal_connections)\n\n state.data.form['step_3_-_the_big_5'].cool_down = \n transform(state.data.form['step_3_-_the_big_5'].cool_down)\n \n state.data.form['step_3_-_the_big_5'].creates_safe_space = \n transform(state.data.form['step_3_-_the_big_5'].creates_safe_space)\n \n state.data.form['step_3_-_the_big_5'].faciliation = \n transform(state.data.form['step_3_-_the_big_5'].faciliation)\n \n state.data.form['step_3_-_the_big_5'].gives_praise = \n transform(state.data.form['step_3_-_the_big_5'].gives_praise)\n \n state.data.form['step_3_-_the_big_5'].praise = \n transform(state.data.form['step_3_-_the_big_5'].praise)\n\n state.data.form['step_3_-_the_big_5'].preparation = \n transform(state.data.form['step_3_-_the_big_5'].preparation)\n \n state.data.form['step_3_-_the_big_5'].shares_accurate_information_about_hivaids_sexual_reproductive_health_and_ri = \n transform(state.data.form['step_3_-_the_big_5'].shares_accurate_information_about_hivaids_sexual_reproductive_health_and_ri)\n \n state.data.form['step_3_-_the_big_5'].sparks_vital_conversations = \n transform(state.data.form['step_3_-_the_big_5'].sparks_vital_conversations)\n \n state.data.form['step_3_-_the_big_5'].time_management = \n transform(state.data.form['step_3_-_the_big_5'].time_management)\n \n state.data.form['step_3_-_the_big_5'].warm_up = \n transform(state.data.form['step_3_-_the_big_5'].warm_up)\n \n\n return state;\n});\n\nupsert(\n 'Coach_Support_Visit__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('CommCare_Ext_ID__c', dataValue('id')),\n relationship('Coach_Person__r', 'CommCare_Ext_ID__c', state => {\n return dataValue('form.step_1_basic_information.select_coach')(state) || \n dataValue('form.step_1_csv_information.select_coach')(state); \n }),\n relationship('Venue__r', 'CommCare_Ext_ID__c', state => {\n return dataValue('form.hidden_properties.venue')(state) || \n dataValue('form.step_1_csv_information.venue')(state); \n }),\n relationship('Event__r', 'CommCare_Ext_ID__c', state => {\n return dataValue('form.hidden_properties.intervention')(state) || \n dataValue('form.step_1_csv_information.intervention')(state); \n }),\n relationship('Curriculum_Aggregate__r', 'CommCare_Ext_ID__c', state => {\n return dataValue('form.hidden_properties.curriculum')(state) || \n dataValue('form.step_1_csv_information.curriculum')(state); \n }), \n relationship('Site_Lookup__r', 'CommCare_Ext_ID__c', state => {\n return dataValue('form.hidden_properties.site')(state) || \n dataValue('form.step_1_csv_information.site')(state); \n }), \n field('Date__c', dataValue('form.step_2_practice_information.date_of_csv')),\n //== TODO: FIx repeated mappings to only reference destination field 1 time ===//\n field(\n 'Accurate_Information__c', state => {\n return dataValue('form.step_3_-_the_big_5.shares_accurate_information_about_hivaids_sexual_reproductive_health_and_ri')(state) || \n dataValue(\n 'form.step_3_the_big_five.question1.shares_accurate_information_about_hivaids_sexual_reproductive_health_and_ri'\n )(state); \n }),\n field('Creates_safe_space__c', state => {\n return dataValue('form.step_3_-_the_big_5.creates_safe_space')(state) || \n dataValue('form.step_3_the_big_five.question1.creates_safe_space')(state); \n \n }),\n field('Builds_personal_connections__c', state => {\n return dataValue('form.step_3_-_the_big_5.builds_personal_connections')(state) || \n dataValue('form.step_3_the_big_five.question1.builds_personal_connections')(state); \n }),\n field('Gives_praise__c', state => {\n return dataValue('form.step_3_-_the_big_5.gives_praise')(state) ||\n dataValue('form.step_3_the_big_five.question1.gives_powerful_praise')(state); \n }),\n field('Sparks_vital_conversations__c', state => {\n return dataValue('form.step_3_-_the_big_5.sparks_vital_conversations')(state) || \n dataValue('form.step_3_the_big_five.question1.sparks_vital_conversations')(state); \n }),\n field('X2_Warm_Up__c', state => {\n return dataValue('form.step_3_-_the_big_5.warm_up')(state) || \n dataValue(\n 'form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.warm_up'\n )(state); \n }),\n field('X3_Activity__c', state => {\n return dataValue('form.step_3_-_the_big_5.activity')(state) || dataValue(\n 'form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.activity'\n )(state); \n }),\n field('X4_Cool_Down__c', state => {\n return dataValue('form.step_3_-_the_big_5.cool_down')(state) || dataValue(\n 'form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.cool_down'\n )(state); \n }),\n field('X5_Facilitation__c', state => {\n return dataValue('form.step_3_-_the_big_5.faciliation')(state) || \n dataValue(\n 'form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.faciliation'\n )(state); \n }),\n field(\n 'X6_Time_Management__c',\n dataValue('form.step_3_-_the_big_5.time_management')\n ),\n field(\n 'X1_Preparation__c',\n dataValue('form.step_3_-_the_big_5.preparation')\n ),\n field('Introduces_micromove__c', state => {\n return //dataValue('form.step_3_-_the_big_5.faciliation')(state) || \n dataValue(\n 'form.step_4_comments.for_each_practice_component_describe_what_the_coach_did_well_and_how_the_co.micromove'\n )(state); \n }),\n field(\n 'Notes__c',\n dataValue(\n 'form.step_3_-_the_big_5.additional_notes.include_your_obsevations_related_to_preparation_punctuality_process'\n )\n )\n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Coach-Support-Visit-CSV": {
"enabled": true,
"id": "270d99f6-644f-4170-bfca-21fc7db5a0bc",
"source_trigger_id": "70babe72-f621-4d74-8c77-eeb8dc4d8e67",
"condition_expression": "state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\" && state.data.form[\"hidden_properties\"].csv == \"1\"",
"condition_type": "js_expression",
"condition_label": "Coach Support Visit Form",
"target_job_id": "d9919692-19d9-4ddc-8c9a-0b23027864b2"
}
}
},
"?-Upsert-Register-Skills-plus-Club": {
"id": "b5a5aab4-51ec-4de3-a8e0-7a7215c8f30a",
"name": "? Upsert Register Skills plus Club",
"inserted_at": "2024-11-11T13:09:48.951234Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "31b359ed-8d4d-431a-b087-584f73de47d3",
"type": "webhook"
}
},
"jobs": {
"Upsert-Register-Skills-plus-Club": {
"id": "b59d9145-ca60-4c24-b526-3e379dde4993",
"name": "Upsert Register Skills plus Club",
"body": "// push to production\nalterState((state) => {\n \n function clean(str) {\n if (!!str)\n return str\n .split('_')\n .map(word => {\n let new_word = word.toString().toLowerCase();\n return new_word.slice(0, 1).toUpperCase() + new_word.slice(1);\n })\n .join(' ');\n }\n \n const coachFieldNames = ['Coach_A__r','Coach_B__r','Coach_C__r','Coach_D__r']\n \n state.data.destinationCoachFields = state.data.form.coaches\n .split(' ')\n .reduce(\n (accumulator, currentValue, currentIndex) => [\n ...accumulator,\n (currentIndex < coachFieldNames.length && !!currentValue\n ? relationship(coachFieldNames[currentIndex], 'CommCare_Ext_ID__c', currentValue)\n : []),\n ],\n []\n );\n\n return state; \n}); \n\n\n\nupsert(\n 'Event__c',\n 'CommCare_Case_ID__c',\n state=>({\n ...fields(\n field('Name', dataValue('form.name_of_skillz_plus_club')),\n field('CommCare_Ext_ID__c', dataValue('form.name_of_skillz_plus_club')),\n field('CommCare_Case_ID__c', dataValue('form.case.@case_id')),\n relationship('RecordType', 'Name', 'Intervention'),\n relationship('Site__r', 'CommCare_Ext_ID__c', dataValue('form.skillz_plus_site')),\n relationship('Venue__r', 'CommCare_Ext_ID__c', dataValue('form.skillz_plus_venue')),\n ),\n ...fields(...state.data.destinationCoachFields)\n })\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Register-Skills-plus-Club": {
"enabled": true,
"id": "02594594-f742-4b9e-b0fd-d5371ad328f4",
"source_trigger_id": "31b359ed-8d4d-431a-b087-584f73de47d3",
"condition_expression": "state.data.form[\"@name\"] == \"Register Skillz Plus Club\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Register Skillz plus Club",
"target_job_id": "b59d9145-ca60-4c24-b526-3e379dde4993"
}
}
},
"?-Upsert-Service-Referral-2": {
"id": "a1dfb1ad-7096-475c-9c09-403f5135d7a7",
"name": "? Upsert Service Referral 2",
"inserted_at": "2024-11-11T13:10:05.905099Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "ec8cc32e-8bb6-4016-b89d-59ae597361ac",
"type": "webhook"
}
},
"jobs": {
"Upsert-Service-Referral-2": {
"id": "2410a56f-deb3-4778-aed4-7b77ce6a0fe0",
"name": "Upsert Service Referral 2",
"body": "// push to production\nalterState(state => {\n state.data.external_commcare_id = (\n dataValue('form.hidden_properties.intervention_name')(state) +\n dataValue('form.hidden_properties.participant_first_name')(state) +\n dataValue('form.hidden_properties.participant_surname')(state)\n )\n .toString()\n .toLowerCase()\n .replace(/\\s/g, '')\n .trim();\n\n return state;\n});\n\nupsert(\n 'NewReferral__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('Business_Unit_Site__c', state => {\n const bu = dataValue('form.business_unit')(state);\n return bu === 'X' ? 'GRS Zambia' : bu;\n }),\n field('CommCare_Ext_ID__c', dataValue('form.case.@case_id')),\n field('HIV_Testing_Services_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option1')(state)\n )\n ),\n field('TB_Screening_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option2')(state)\n )\n ),\n field('VMMC_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option3')(state)\n )\n ),\n field('Post_Exposure_Prophylaxis_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option4'\n )(state)\n )\n ),\n field('PrEP_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option5'\n )(state)\n )\n ),\n field('HIV_STI_PREVENTION_Other_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option6'\n )(state)\n )\n ),\n field('ART_Initiation_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option1')(\n state\n )\n )\n ),\n field('SKILLZ_Plus_Club_Support_Service_Provid__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option2')(\n state\n )\n )\n ),\n \n field(\n 'PMTCT_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option3')(\n state\n )\n )\n ), \n field('IPTG_Health_Facility__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option1')(\n state\n )\n )\n ), \n field('IPTG_Specialized_to_SMZ__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option2')(\n state\n )\n )\n ), \n \n field('ART_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.referred_art_support_services')(state)\n )\n ),\n field(\n 'Victim_Friendly_Services_Service_Provide__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option1'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option2'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option3'\n )(state)\n )\n ),\n field('Legal_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option3'\n )(state)\n )\n ),\n\n field('STI_Screen_Testing_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option1')(state))\n ),\n \n field('Contraception_Family_Plan_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option2')(state))\n ),\n field('Cervical_Cancer_Screen_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option3')(state))\n ),\n field('HPV_vaccine_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option4')(state))\n ),\n field('Antenatal_Care_ANC_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option5')(state))\n ),\n field('Sexual_and_GBV_Abuse_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option6')(state))\n ),\n field(\n 'Psycho_Social_Support_Service_Provider__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option9'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option8'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option7'\n )(state)\n )\n ),\n field('Psycho_Social_Services_Other_Service_Pro__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option10')(state))\n ),\n field(\n 'Legal_Services_Other_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_referral_services')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option1')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option2')(state)\n )\n ),\n \n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Service-Referral-2": {
"enabled": true,
"id": "83a55ffb-2114-41f5-a99c-95febf421d2f",
"source_trigger_id": "ec8cc32e-8bb6-4016-b89d-59ae597361ac",
"condition_expression": "state.data.form[\"@name\"] == \"Service Referral Followup\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Service Referral Followup Name",
"target_job_id": "2410a56f-deb3-4778-aed4-7b77ce6a0fe0"
}
}
},
"?-Upsert-Service-Referral-Followup": {
"id": "a707ef9c-ba32-48a7-b8f0-5a8fce1e5899",
"name": "? Upsert Service Referral Followup",
"inserted_at": "2024-11-11T13:10:27.108497Z",
"lock_version": 3,
"triggers": {
"webhook": {
"enabled": true,
"id": "b040b38f-d3b5-44d2-99fe-4f46d3ed824e",
"type": "webhook"
}
},
"jobs": {
"Upsert-Service-Referral-Followup": {
"id": "9038588a-566a-433e-89a3-7bcf62c9b9cb",
"name": "Upsert Service Referral Followup",
"body": "// push to production\nalterState(state => {\n state.data.external_commcare_id = (\n dataValue('form.hidden_properties.intervention_name')(state) +\n dataValue('form.hidden_properties.participant_first_name')(state) +\n dataValue('form.hidden_properties.participant_surname')(state)\n )\n .toString()\n .toLowerCase()\n .replace(/\\s/g, '')\n .trim();\n\n return state;\n});\n\nupsert(\n 'NewReferral__c',\n 'CommCare_Ext_ID__c',\n fields(\n field('Business_Unit_Site__c', state => {\n const bu = dataValue('form.business_unit')(state);\n return bu === 'X' ? 'GRS Zambia' : bu;\n }),\n field('CommCare_Ext_ID__c', dataValue('form.case.@case_id')),\n field('HIV_Testing_Services_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option1')(state)\n )\n ),\n field('TB_Screening_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option2')(state)\n )\n ),\n field('VMMC_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option3')(state)\n )\n ),\n field('Post_Exposure_Prophylaxis_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option4'\n )(state)\n )\n ),\n field('PrEP_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option5'\n )(state)\n )\n ),\n field('HIV_STI_PREVENTION_Other_Service_Provid__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.hiv_support__care.check_services_label.hiv_support_care_option6'\n )(state)\n )\n ),\n field('ART_Initiation_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option1')(\n state\n )\n )\n ),\n field('SKILLZ_Plus_Club_Support_Service_Provid__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option2')(\n state\n )\n )\n ),\n \n field(\n 'PMTCT_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.art_services_group.art_services_option3')(\n state\n )\n )\n ), \n field('IPTG_Health_Facility__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option1')(\n state\n )\n )\n ), \n field('IPTG_Specialized_to_SMZ__c', state =>\n Boolean(\n dataValue('form.referral_services.mental_health_services.confirmation_of_services_provided_label.mental_health_select_services_option2')(\n state\n )\n )\n ), \n \n field('ART_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue('form.referral_services.art_support_services.referred_art_support_services')(state)\n )\n ),\n field(\n 'Victim_Friendly_Services_Service_Provide__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option1'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option2'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.child_protection_support_services.copy-1-of-check_the_services_that_were_provided.child_protection_option3'\n )(state)\n )\n ),\n field('Legal_Services_Other_Service_Provider__c', state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option3'\n )(state)\n )\n ),\n\n field('STI_Screen_Testing_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option1')(state))\n ),\n \n field('Contraception_Family_Plan_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option2')(state))\n ),\n field('Cervical_Cancer_Screen_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option3')(state))\n ),\n field('HPV_vaccine_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option4')(state))\n ),\n field('Antenatal_Care_ANC_Service_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option5')(state))\n ),\n field('Sexual_and_GBV_Abuse_Servi_Provider__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option6')(state))\n ),\n field(\n 'Psycho_Social_Support_Service_Provider__c',\n state =>\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option9'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option8'\n )(state)\n ) ||\n Boolean(\n dataValue(\n 'form.referral_services.other_srhr_services.service_label.srhr_option7'\n )(state)\n )\n ),\n field('Psycho_Social_Services_Other_Service_Pro__c', state =>\n Boolean(dataValue('form.referral_services.other_srhr_services.service_label.srhr_option10')(state))\n ),\n field(\n 'Legal_Services_Other_Service_Provider__c',\n state =>\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_referral_services')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option1')(state)\n ) ||\n Boolean(\n dataValue('form.referral_services.other_legal_services.confirmation_of_services_provided_label.legal_services_option2')(state)\n )\n ),\n \n )\n);\n",
"adaptor": "@openfn/[email protected]",
"project_credential_id": null
}
},
"edges": {
"webhook->Upsert-Service-Referral-Followup": {
"enabled": true,
"id": "e3886dfa-ffb5-49c7-a86f-f095d589dadd",
"source_trigger_id": "b040b38f-d3b5-44d2-99fe-4f46d3ed824e",
"condition_expression": "state.data.form.followup == \"1\" && state.data.form[\"business_unit\"] != \"57ac433fe0cb4319a701cc9e7c721816\"",
"condition_type": "js_expression",
"condition_label": "Service Referral Followup",
"target_job_id": "9038588a-566a-433e-89a3-7bcf62c9b9cb"
}
}
},
"Attendance-Non-Skillz": {
"id": "2b65ddd5-d627-4cee-b895-74e098ded0dd",
"name": "Attendance Non Skillz",
"inserted_at": "2024-11-14T16:54:02.347963Z",
"lock_version": 4,
"triggers": {
"webhook": {
"enabled": true,
"id": "54f64bbd-0351-4665-9e49-96a1508149ab",
"type": "webhook"
}
},
"jobs": {
"Attendance-Non-Skillz": {
"id": "68835437-e11a-4070-8864-f37cc3c36260",
"name": "Attendance Non Skillz",
"body": "fn(state => {\n if (!state.data.form.attendance_list.update_participant_cases.item) {\n console.log('No participant attendance data was provided, not upserting to Salesforce.');\n return state;\n } else {\n // query(\n // `SELECT Id, Name, CommCare_Ext_ID__c FROM Event__c WHERE CommCare_Case_ID__c = '${state.data.form.attendance_list.update_participant_cases.item[0]['@id']}'`\n // );\n\n // fn(state => {\n const records = lastReferenceValue('records')(state);\n const eventName = lastReferenceValue('records[0].CommCare_Ext_ID__c')(state);\n\n // if (!eventName) {\n // console.log(\n // `Participant not found with CommCare_Case_ID__c: ${state.data.form.attendance_list.update_participant_cases.item[0]['@id']}`\n // );\n // return state;\n // }\n\n return execute(\n fn(state => {\n // Note: lastReferenceValue selects the first item in the references array.\n state.data.eventName = eventName ? eventName.replace(/\\//gi, '') : null;\n\n function getSessionValue(present) {\n switch (present.toString().toLowerCase()) {\n case 'yes':\n return 'X';\n case 'no':\n return 'A';\n case '':\n return 'N';\n default:\n return 'U';\n }\n }\n\n function getSessionId(session_text) {\n return session_text.toString().trim().slice(0, session_text.indexOf(' ')).slice(1);\n }\n\n function objectToArray(object) {\n if (!object) return [];\n return !Array.isArray(object) ? [object] : object;\n }\n\n state.data.form.attendance_list.update_participant_cases.item = objectToArray(\n state.data.form.attendance_list.update_participant_cases.item\n );\n \n //When GRS enters session names incorrectly in CommCare (e.g., session: \"P8 // My body is mine)\n function findPValue(input) {\n // Regular expression to match \"P\" followed by one or more digits, then \"//\"\n const regex = /P(\\d+)\\s*\\/\\//;\n \n // Match the input against the regex\n const match = input.match(regex);\n \n // If a match is found, return the captured digits as an integer\n if (match) {\n return parseInt(match[1], 10);\n } else {\n // If no match is found, return null or handle as needed\n return 'Session_not_found';\n }\n}\n\n const sessionText = dataValue('form.attendance_list.session')(state);\n const sessionId = sessionText.includes('//') ? findPValue(sessionText) : getSessionId(sessionText);\n \n console.log('sessionText:: ', sessionText); \n console.log('sessionId:: ', sessionText); \n \n const sessionDate = dataValue(\"form.case['@date_modified']\")(state);\n\n state.data.form.attendance_list.update_participant_cases.item =\n state.data.form.attendance_list.update_participant_cases.item.map(item => {\n const sessionValue = getSessionValue(item.attendance_session);\n return {\n ...item,\n dynamicFields: {\n [`Session_${sessionId}__c`]: sessionValue,\n [`Session_${sessionId}_Date__c`]: sessionDate,\n },\n };\n });\n\n return state;\n }),\n\n each(\n merge(\n dataPath('form.attendance_list.update_participant_cases.item[*]'),\n fields(\n field('intervention_name', dataValue('form.intervention_name')),\n field('eventName', dataValue('eventName')),\n field('caseid', dataValue('form.case.@case_id'))\n )\n ),\n upsert('Attendance__c', 'CommCare_Ext_ID__c', state => ({\n ...fields(\n relationship('Event__r', 'CommCare_Case_ID__c', dataValue('caseid')),\n field(\n 'CommCare_Ext_ID__c',\n state => `${state.data['@id']}-${toUTF8(state.data.intervention_name)}`\n ),\n relationship('Person_Attendance__r', 'Participant_Identification_Number_PID__c', dataValue('@id'))\n ),\n ...state.data.dynamicFields,\n }))\n )\n )(state);\n }\n});\n",
"adaptor": "@openfn/language-salesforce@latest",
"project_credential_id": null
}