File tree Expand file tree Collapse file tree 1 file changed +30
-15
lines changed
Expand file tree Collapse file tree 1 file changed +30
-15
lines changed Original file line number Diff line number Diff line change @@ -124,20 +124,26 @@ type Metadata struct {
124124func isSurveyMetadata (key string ) bool {
125125 switch key {
126126 case
127- "case_ref" ,
128- "case_type" ,
129- "display_address" ,
130- "employment_date" ,
131- "form_type" ,
132- "period_id" ,
133- "period_str" ,
134- "ref_p_end_date" ,
135- "ref_p_start_date" ,
136- "ru_name" ,
137- "ru_ref" ,
138- "trad_as" ,
139- "user_id" ,
140- "qid" :
127+ "case_ref" ,
128+ "case_type" ,
129+ "display_address" ,
130+ "employment_date" ,
131+ "form_type" ,
132+ "period_id" ,
133+ "period_str" ,
134+ "ref_p_end_date" ,
135+ "ref_p_start_date" ,
136+ "ru_name" ,
137+ "ru_ref" ,
138+ "trad_as" ,
139+ "user_id" ,
140+ "qid" ,
141+ "PARTICIPANT_ID" ,
142+ "FIRST_NAME" ,
143+ "BLOOD_TEST_BARCODE" ,
144+ "SWAB_TEST_BARCODE" ,
145+ "TEST_QUESTIONS" :
146+
141147 return true
142148 }
143149 return false
@@ -627,7 +633,12 @@ func GetRequiredMetadata(launcherSchema surveys.LauncherSchema) ([]Metadata, str
627633 defaults := GetDefaultValues ()
628634
629635 for i , value := range schema .Metadata {
630- schema .Metadata [i ].Default = defaults [value .Name ]
636+
637+ if strings .Contains (value .Name , "BARCODE" ) {
638+ schema .Metadata [i ].Default = "BAR" + fmt .Sprintf ("%08d" , rand .Int63n (1e8 ))
639+ } else {
640+ schema .Metadata [i ].Default = defaults [value .Name ]
641+ }
631642
632643 if value .Validator == "boolean" {
633644 schema .Metadata [i ].Default = "false"
@@ -759,6 +770,10 @@ func GetDefaultValues() map[string]string {
759770 defaults ["postcode" ] = "PE12 4GH"
760771 defaults ["display_address" ] = "68 Abingdon Road, Goathill"
761772 defaults ["country" ] = "E"
773+ defaults ["PARTICIPANT_ID" ] = "ABC-" + fmt .Sprintf ("%011d" , rand .Int63n (1e11 ))
774+ defaults ["FIRST_NAME" ] = "John"
775+ defaults ["TEST_QUESTIONS" ] = "F"
776+
762777
763778 return defaults
764779}
You can’t perform that action at this time.
0 commit comments