diff --git a/CHANGELOG b/CHANGELOG index 463feaf..232653a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,16 @@ Changelog ========= +## [0.6.1] - 2019-05-19 +### Summary + +Fix field names and blanks circumstances. + +### Fixed + * Incorrect fields used in blanks check on D1 form (Naomi Braun, Nicolas May) + * Field names missing in blanks check on A3 form (Naomi Braun) + * Adjust builder files to use correct field names for Z1X form (Naomi Braun) + + ## [0.6.0] - 2019-04-17 ### Summary diff --git a/get_subject_list.js b/get_subject_list.js new file mode 100644 index 0000000..58e4a0f --- /dev/null +++ b/get_subject_list.js @@ -0,0 +1,21 @@ +var statusList = document.getElementsByName('XID')[0].options; +packets = [['Patient ID','Packet type','Visit Num','Status']]; +for(i=6; i < statusList.length; i++){ + label = statusList[i].label.split(" "); + csv = [label[3], label[6], label[10], label[19]]; + packets[i] = csv;} + +var csvContent = "data:text/csv;charset=utf-8,"; +packets.forEach(function(infoArray, index){ + + dataString = infoArray.join(","); + csvContent += index < packets.length ? dataString+ "\n" : dataString; +}); + +var encodedUri = encodeURI(csvContent); +a=document.createElement('a'); +a.textContent='download'; +a.download="current-db-subjects.csv"; +a.href=csvContent; +document.body.appendChild(a); +a.click(); \ No newline at end of file diff --git a/nacc/redcap2nacc.py b/nacc/redcap2nacc.py index b7baf40..7d93d2f 100755 --- a/nacc/redcap2nacc.py +++ b/nacc/redcap2nacc.py @@ -163,7 +163,12 @@ def convert(fp, options, out=sys.stdout, err=sys.stderr): set_blanks_to_zero(packet) warnings = [] - warnings += check_blanks(packet) + try: + warnings += check_blanks(packet) + except KeyError: + print >> err, "[SKIP] Error for ptid : " + str(record['ptid']) + traceback.print_exc() + continue if not options.np: warnings += check_single_select(packet) diff --git a/nacc/uds3/fvp/builder.py b/nacc/uds3/fvp/builder.py index f3bd97c..f084dcb 100644 --- a/nacc/uds3/fvp/builder.py +++ b/nacc/uds3/fvp/builder.py @@ -857,53 +857,53 @@ def add_z1_or_z1x(record, packet): if (int(record['visityr'])>2018) or (int(record['visityr'])==2018 and int(record['visitmo'])>4) or \ (int(record['visityr'])==2018 and int(record['visitmo'])==4 and int(record['visitday'])>=2): z1x = fvp_forms.FormZ1X() - z1x.LANGA1 = record['fu_a1lang'] - z1x.LANGA2 = record['fu_a2lang'] - z1x.A2SUB = record['fu_a2sub_73fdc7'] - z1x.A2NOT = record['fu_a2not_fd65a7'] - z1x.LANGA3 = record['fu_a3lang'] - z1x.A3SUB = record['fu_a3sub_c2a68b'] - z1x.A3NOT = record['fu_a3not_f7c411'] - z1x.LANGA4 = record['fu_a4lang'] - z1x.A4SUB = record['fu_a4sub_143f22'] - z1x.A4NOT = record['fu_a4not_b95e64'] - z1x.LANGB1 = record['fu_b1lang'] - z1x.B1SUB = record['fu_b1sub_c03500'] - z1x.B1NOT = record['fu_b1not_0a7e9f'] - z1x.LANGB4 = record['fu_b4lang'] - z1x.LANGB5 = record['fu_b5lang'] - z1x.B5SUB = record['fu_b5sub_51a694'] - z1x.B5NOT = record['b5not_fvpz1x'] - z1x.LANGB6 = record['fu_b6lang'] - z1x.B6SUB = record['fu_b6sub_db439d'] - z1x.B6NOT = record['fu_b6not_310244'] - z1x.LANGB7 = record['fu_b7lang'] - z1x.B7SUB = record['fu_b7sub_21a95f'] - z1x.B7NOT = record['fu_b7not_dccb30'] - z1x.LANGB8 = record['fu_b8lang'] - z1x.LANGB9 = record['fu_b9lang'] - z1x.LANGC2 = record['fu_c2lang'] - z1x.LANGD1 = record['fu_d1lang'] - z1x.LANGD2 = record['fu_d2lang'] - z1x.LANGA3A = record['fu_a3alang'] - z1x.FTDA3AFS = record['fu_a3asubmitted'] - z1x.FTDA3AFR = record['fu_a3anot'] - z1x.LANGB3F = record['fu_b3flang'] - z1x.LANGB9F = record['fu_b9flang'] - z1x.LANGC1F = record['fu_c1flang'] - z1x.LANGC2F = record['fu_c2flang'] - z1x.LANGC3F = record['fu_c3flang'] - z1x.LANGC4F = record['fu_c4flang'] - z1x.FTDC4FS = record['fu_c4fsubmitted'] - z1x.FTDC4FR = record['fu_c4fnot'] - z1x.FTDC5FS = record['fu_c5fsubmitted'] - z1x.FTDC5FR = record['fu_c5fnot'] - z1x.FTDC6FS = record['fu_c6fsubmitted'] - z1x.FTDC6FR = record['fu_c6fnot'] - z1x.LANGE2F = record['fu_e2flang'] - z1x.LANGE3F = record['fu_e3flang'] - z1x.LANGCLS = record['fu_clslang'] - z1x.CLSSUB = record['fu_clssubmitted'] + z1x.LANGA1 = record['fu_langa1'] + z1x.LANGA2 = record['fu_langa2'] + z1x.A2SUB = record['fu_a2sub'] + z1x.A2NOT = record['fu_a2not'] + z1x.LANGA3 = record['fu_langa3'] + z1x.A3SUB = record['fu_a3sub'] + z1x.A3NOT = record['fu_a3not'] + z1x.LANGA4 = record['fu_langa4'] + z1x.A4SUB = record['fu_a4sub'] + z1x.A4NOT = record['fu_a4not'] + z1x.LANGB1 = record['fu_langb1'] + z1x.B1SUB = record['fu_b1sub'] + z1x.B1NOT = record['fu_b1not'] + z1x.LANGB4 = record['fu_langb4'] + z1x.LANGB5 = record['fu_langb5'] + z1x.B5SUB = record['fu_b5sub'] + z1x.B5NOT = record['fu_b5not'] + z1x.LANGB6 = record['fu_langb6'] + z1x.B6SUB = record['fu_b6sub'] + z1x.B6NOT = record['fu_b6not'] + z1x.LANGB7 = record['fu_langb7'] + z1x.B7SUB = record['fu_b7sub'] + z1x.B7NOT = record['fu_b7not'] + z1x.LANGB8 = record['fu_langb8'] + z1x.LANGB9 = record['fu_langb9'] + z1x.LANGC2 = record['fu_langc2'] + z1x.LANGD1 = record['fu_langd1'] + z1x.LANGD2 = record['fu_langd2'] + z1x.LANGA3A = record['fu_langa3a'] + z1x.FTDA3AFS = record['fu_ftda3afs'] + z1x.FTDA3AFR = record['fu_ftda3afr'] + z1x.LANGB3F = record['fu_langb3f'] + z1x.LANGB9F = record['fu_langb9f'] + z1x.LANGC1F = record['fu_langc1f'] + z1x.LANGC2F = record['fu_langc2f'] + z1x.LANGC3F = record['fu_langc3f'] + z1x.LANGC4F = record['fu_langc4f'] + z1x.FTDC4FS = record['fu_ftdc4fs'] + z1x.FTDC4FR = record['fu_ftdc4fr'] + z1x.FTDC5FS = record['fu_ftdc5fs'] + z1x.FTDC5FR = record['fu_ftdc5fr'] + z1x.FTDC6FS = record['fu_ftdc6fs'] + z1x.FTDC6FR = record['fu_ftdc6fr'] + z1x.LANGE2F = record['fu_lange2f'] + z1x.LANGE3F = record['fu_lange3f'] + z1x.LANGCLS = record['fu_langcls'] + z1x.CLSSUB = record['fu_clssub'] packet.insert(0, z1x) else: z1 = fvp_forms.FormZ1() diff --git a/nacc/uds3/fvp/forms.py b/nacc/uds3/fvp/forms.py index c2b4e4d..0014dc7 100644 --- a/nacc/uds3/fvp/forms.py +++ b/nacc/uds3/fvp/forms.py @@ -74,8 +74,8 @@ def __init__(self): self.fields['NWINFMUT'] = nacc.uds3.Field(name='NWINFMUT', typename='Num', position=(45, 45), length=1, inclusive_range=(0, 1), allowable_values=['9', '1', '0'], blanks=[]) self.fields['FADMUT'] = nacc.uds3.Field(name='FADMUT', typename='Num', position=(47, 47), length=1, inclusive_range=(0, 3), allowable_values=['2', '1', '0', '9', '8', '3'], blanks=['Blank if Question 1 NWINFMUT ne 1 (Yes)']) self.fields['FADMUTX'] = nacc.uds3.Field(name='FADMUTX', typename='Char', position=(49, 108), length=60, inclusive_range=None, allowable_values=[], blanks=['Blank if Question 2a FADMUT ne 8 (Other)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) - self.fields['FADMUSO'] = nacc.uds3.Field(name='FADMUSO', typename='Num', position=(110, 110), length=1, inclusive_range=(1, 3), allowable_values=['3', '2', '1', '9', '8'], blanks=['Blank if Question 2a FADMUT = 0 (No)', 'Blank if Question 2a = 9 (Unknown)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) - self.fields['FADMUSOX'] = nacc.uds3.Field(name='FADMUSOX', typename='Char', position=(112, 171), length=60, inclusive_range=None, allowable_values=[], blanks=['Blank if Question 2a FADMUT = 0 (No)', 'Blank if Question 2a = 9 (Unknown)', 'Blank if Question 2b FADMUSO ne 8 (Other)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) + self.fields['FADMUSO'] = nacc.uds3.Field(name='FADMUSO', typename='Num', position=(110, 110), length=1, inclusive_range=(1, 3), allowable_values=['3', '2', '1', '9', '8'], blanks=['Blank if Question 2a FADMUT = 0 (No)', 'Blank if Question 2a FADMUT = 9 (Unknown)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) + self.fields['FADMUSOX'] = nacc.uds3.Field(name='FADMUSOX', typename='Char', position=(112, 171), length=60, inclusive_range=None, allowable_values=[], blanks=['Blank if Question 2a FADMUT = 0 (No)', 'Blank if Question 2a FADMUT = 9 (Unknown)', 'Blank if Question 2b FADMUSO ne 8 (Other)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) self.fields['FFTDMUT'] = nacc.uds3.Field(name='FFTDMUT', typename='Num', position=(173, 173), length=1, inclusive_range=(0, 4), allowable_values=['9', '2', '1', '0', '8', '4', '3'], blanks=['Blank if Question 1 NWINFMUT ne 1 (Yes)']) self.fields['FFTDMUTX'] = nacc.uds3.Field(name='FFTDMUTX', typename='Char', position=(175, 234), length=60, inclusive_range=None, allowable_values=[], blanks=['Blank if Question 3a FFTDMUT ne 8 (Other)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) self.fields['FFTDMUSO'] = nacc.uds3.Field(name='FFTDMUSO', typename='Num', position=(236, 236), length=1, inclusive_range=(1, 3), allowable_values=['3', '2', '1', '9', '8'], blanks=['Blank if Question 3a FFTDMUT = 0 (No)', 'Blank if Question 3a FFTDMUT = 9 (Unknown)', 'Blank if Question 1 NWINFMUT ne 1 (Yes)']) @@ -735,15 +735,15 @@ def __init__(self): self.fields['MCIAPEX'] = nacc.uds3.Field(name='MCIAPEX', typename='Num', position=(73, 73), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCIAPLUS ne 1']) self.fields['MCIAPVIS'] = nacc.uds3.Field(name='MCIAPVIS', typename='Num', position=(75, 75), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes', 'Blank if Question 5b MCIAPLUS ne 1']) self.fields['MCINON1'] = nacc.uds3.Field(name='MCINON1', typename='Num', position=(77, 77), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)']) - self.fields['MCIN1LAN'] = nacc.uds3.Field(name='MCIN1LAN', typename='Num', position=(79, 79), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN1ATT'] = nacc.uds3.Field(name='MCIN1ATT', typename='Num', position=(81, 81), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN1EX'] = nacc.uds3.Field(name='MCIN1EX', typename='Num', position=(83, 83), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN1VIS'] = nacc.uds3.Field(name='MCIN1VIS', typename='Num', position=(85, 85), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) + self.fields['MCIN1LAN'] = nacc.uds3.Field(name='MCIN1LAN', typename='Num', position=(79, 79), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5c MCINON1 ne 1']) + self.fields['MCIN1ATT'] = nacc.uds3.Field(name='MCIN1ATT', typename='Num', position=(81, 81), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5c MCINON1 ne 1']) + self.fields['MCIN1EX'] = nacc.uds3.Field(name='MCIN1EX', typename='Num', position=(83, 83), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5c MCINON1 ne 1']) + self.fields['MCIN1VIS'] = nacc.uds3.Field(name='MCIN1VIS', typename='Num', position=(85, 85), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5c MCINON1 ne 1']) self.fields['MCINON2'] = nacc.uds3.Field(name='MCINON2', typename='Num', position=(87, 87), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)']) - self.fields['MCIN2LAN'] = nacc.uds3.Field(name='MCIN2LAN', typename='Num', position=(89, 89), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN2ATT'] = nacc.uds3.Field(name='MCIN2ATT', typename='Num', position=(91, 91), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN2EX'] = nacc.uds3.Field(name='MCIN2EX', typename='Num', position=(93, 93), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) - self.fields['MCIN2VIS'] = nacc.uds3.Field(name='MCIN2VIS', typename='Num', position=(95, 95), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5b MCINON2 ne 1']) + self.fields['MCIN2LAN'] = nacc.uds3.Field(name='MCIN2LAN', typename='Num', position=(89, 89), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5d MCINON2 ne 1']) + self.fields['MCIN2ATT'] = nacc.uds3.Field(name='MCIN2ATT', typename='Num', position=(91, 91), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5d MCINON2 ne 1']) + self.fields['MCIN2EX'] = nacc.uds3.Field(name='MCIN2EX', typename='Num', position=(93, 93), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5d MCINON2 ne 1']) + self.fields['MCIN2VIS'] = nacc.uds3.Field(name='MCIN2VIS', typename='Num', position=(95, 95), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)', 'Blank if Question 5d MCINON2 ne 1']) self.fields['IMPNOMCI'] = nacc.uds3.Field(name='IMPNOMCI', typename='Num', position=(97, 97), length=1, inclusive_range=(0, 1), allowable_values=['1', '0'], blanks=['Blank if Question 2 NORMCOG = 1 (Yes)', 'Blank if Question 3 DEMENTED = 1 (Yes)']) self.fields['AMYLPET'] = nacc.uds3.Field(name='AMYLPET', typename='Num', position=(99, 99), length=1, inclusive_range=(0, 1), allowable_values=['8', '1', '0'], blanks=[]) self.fields['AMYLCSF'] = nacc.uds3.Field(name='AMYLCSF', typename='Num', position=(101, 101), length=1, inclusive_range=(0, 1), allowable_values=['8', '1', '0'], blanks=[]) diff --git a/nacc/uds3/ivp/builder.py b/nacc/uds3/ivp/builder.py index 267695d..172f1a3 100644 --- a/nacc/uds3/ivp/builder.py +++ b/nacc/uds3/ivp/builder.py @@ -935,55 +935,56 @@ def add_z1_or_z1x(record, packet): if (int(record['visityr'])>2018) or (int(record['visityr'])==2018 and int(record['visitmo'])>4) or \ (int(record['visityr'])==2018 and int(record['visitmo'])==4 and int(record['visitday'])>=2): z1x = ivp_forms.FormZ1X() - z1x.LANGA1 = record['a1lang'] - z1x.LANGA2 = record['a2lang'] - z1x.A2SUB = record['a2sub_095a3b'] - z1x.A2NOT = record['a2not_21e87d'] - z1x.LANGA3 = record['a3lang'] - z1x.A3SUB = record['a3sub_2b0d69'] - z1x.A3NOT = record['a3not_c7cb57'] - z1x.LANGA4 = record['a4lang'] - z1x.A4SUB = record['a4sub_2c437c'] - z1x.A4NOT = record['a4not_c4e53e'] - z1x.LANGA5 = record['a5lang'] - z1x.LANGB1 = record['b1lang'] - z1x.B1SUB = record['b1sub_3c9b3b'] - z1x.B1NOT = record['b1not_8b7733'] - z1x.LANGB4 = record['b4lang'] - z1x.LANGB5 = record['b5lang'] - z1x.B5SUB = record['b5sub_712f66'] - z1x.B5NOT = record['b5not_a4b779'] - z1x.LANGB6 = record['b6lang'] - z1x.B6SUB = record['b6sub_35db4c'] - z1x.B6NOT = record['b6not_06dff0'] - z1x.LANGB7 = record['b7lang'] - z1x.B7SUB = record['b7sub_7e2220'] - z1x.B7NOT = record['b7not_2dfac5'] - z1x.LANGB8 = record['b8lang'] - z1x.LANGB9 = record['b9lang'] - z1x.LANGC2 = record['c2lang'] - z1x.LANGD1 = record['d1lang'] - z1x.LANGD2 = record['d2lang'] - z1x.LANGA3A = record['a3alang'] - z1x.FTDA3AFS = record['a3asubmitted'] - z1x.FTDA3AFR = record['a3anot'] - z1x.LANGB3F = record['b3flang'] - z1x.LANGB9F = record['b9flang'] - z1x.LANGC1F = record['c1flang'] - z1x.LANGC2F = record['c2flang'] - z1x.LANGC3F = record['c3flang'] - z1x.LANGC4F = record['c4flang'] - z1x.FTDC4FS = record['c4fsubmitted'] - z1x.FTDC4FR = record['c4fnot'] - z1x.FTDC5FS = record['c5fsubmitted'] - z1x.FTDC5FR = record['c5fnot'] - z1x.FTDC6FS = record['c6fsubmitted'] - z1x.FTDC6FR = record['c6fnot'] - z1x.LANGE2F = record['e2flang'] - z1x.LANGE3F = record['e3flang'] - z1x.LANGCLS = record['clslang'] - z1x.CLSSUB = record['clssubmitted'] + z1x.LANGA1 = record['langa1'] + z1x.LANGA2 = record['langa2'] + z1x.A2SUB = record['a2sub'] + z1x.A2NOT = record['a2not'] + z1x.LANGA3 = record['langa3'] + z1x.A3SUB = record['a3sub'] + z1x.A3NOT = record['a3not'] + z1x.LANGA4 = record['langa4'] + z1x.A4SUB = record['a4sub'] + z1x.A4NOT = record['a4not'] + z1x.LANGA5 = record['langa5'] + z1x.LANGB1 = record['langb1'] + z1x.B1SUB = record['b1sub'] + z1x.B1NOT = record['b1not'] + z1x.LANGB4 = record['langb4'] + z1x.LANGB5 = record['langb5'] + z1x.B5SUB = record['b5sub'] + z1x.B5NOT = record['b5not'] + z1x.LANGB6 = record['langb6'] + z1x.B6SUB = record['b6sub'] + z1x.B6NOT = record['b6not'] + z1x.LANGB7 = record['langb7'] + z1x.B7SUB = record['b7sub'] + z1x.B7NOT = record['b7not'] + z1x.LANGB8 = record['langb8'] + z1x.LANGB9 = record['langb9'] + z1x.LANGC2 = record['langc2'] + z1x.LANGD1 = record['langd1'] + z1x.LANGD2 = record['langd2'] + z1x.LANGA3A = record['langa3a'] + z1x.FTDA3AFS = record['ftda3afs'] + z1x.FTDA3AFR = record['ftda3afr'] + z1x.LANGB3F = record['langb3f'] + z1x.LANGB9F = record['langb9f'] + z1x.LANGC1F = record['langc1f'] + z1x.LANGC2F = record['langc2f'] + z1x.LANGC3F = record['langc3f'] + z1x.LANGC4F = record['langc4f'] + z1x.FTDC4FS = record['ftdc4fs'] + z1x.FTDC4FR = record['ftdc4fr'] + z1x.FTDC5FS = record['ftdc5fs'] + z1x.FTDC5FR = record['ftdc5fr'] + z1x.FTDC6FS = record['ftdc6fs'] + z1x.FTDC6FR = record['ftdc6fr'] + z1x.LANGE2F = record['lange2f'] + z1x.LANGE3F = record['lange3f'] + z1x.LANGCLS = record['langcls'] + z1x.CLSSUB = record['clssub'] packet.insert(0, z1x) + else: z1 = ivp_forms.FormZ1() z1.A2SUB = record['a2sub'] diff --git a/nacculator_cfg.ini.example b/nacculator_cfg.ini.example index c43d401..37cad57 100644 --- a/nacculator_cfg.ini.example +++ b/nacculator_cfg.ini.example @@ -10,6 +10,8 @@ redcap_server: Your Redcap Server filepath: path/to/current-db-subjects.csv [filter_fix_headers] +# Write in format: +# old_header: corrected_header c1s_2a_npsylan: c1s_2_npsycloc c1s_2a_npsylanx: c1s_2a_npsylan b6s_2a1_npsylanx: c1s_2a1_npsylanx diff --git a/tests/z1_z1x_test.py b/tests/z1_z1x_test.py index a178ec1..1cb940b 100644 --- a/tests/z1_z1x_test.py +++ b/tests/z1_z1x_test.py @@ -21,8 +21,8 @@ def test_z1x_added_to_ivp_when_filled(self): """ If header is from after April 2, 2018, the Z1X form should be added """ record = make_blank_ivp() record['visityr'] = '2019' - record['a1lang'] = '1' - record['clssubmitted'] = '1' + record['langa1'] = '1' + record['clssub'] = '1' ipacket = packet.Packet() ivp_builder.add_z1_or_z1x(record, ipacket) @@ -43,8 +43,8 @@ def test_z1x_added_to_fvp_when_filled(self): """ If header is from after April 2, 2018, the Z1X form should be added """ record = make_blank_fvp() record['visityr'] = '2019' - record['fu_a1lang'] = '1' - record['fu_clssubmitted'] = '1' + record['fu_langa1'] = '1' + record['fu_clssub'] = '1' fpacket = packet.Packet() fvp_builder.add_z1_or_z1x(record, fpacket) @@ -78,54 +78,54 @@ def make_blank_ivp(): 'b7not': '', 'b7comm': '', # Z1X - 'a1lang': '', - 'a2lang': '', - 'a2sub_095a3b': '', - 'a2not_21e87d': '', - 'a3lang': '', - 'a3sub_2b0d69': '', - 'a3not_c7cb57': '', - 'a4lang': '', - 'a4sub_2c437c': '', - 'a4not_c4e53e': '', - 'a5lang': '', - 'b1lang': '', - 'b1sub_3c9b3b': '', - 'b1not_8b7733': '', - 'b4lang': '', - 'b5lang': '', - 'b5sub_712f66': '', - 'b5not_a4b779': '', - 'b6lang': '', - 'b6sub_35db4c': '', - 'b6not_06dff0': '', - 'b7lang': '', - 'b7sub_7e2220': '', - 'b7not_2dfac5': '', - 'b8lang': '', - 'b9lang': '', - 'c2lang': '', - 'd1lang': '', - 'd2lang': '', - 'a3alang': '', - 'a3asubmitted': '', - 'a3anot': '', - 'b3flang': '', - 'b9flang': '', - 'c1flang': '', - 'c2flang': '', - 'c3flang': '', - 'c4flang': '', - 'c4fsubmitted': '', - 'c4fnot': '', - 'c5fsubmitted': '', - 'c5fnot': '', - 'c6fsubmitted': '', - 'c6fnot': '', - 'e2flang': '', - 'e3flang': '', - 'clslang': '', - 'clssubmitted': '' + 'langa1': '', + 'langa2': '', + 'a2sub': '', + 'a2not': '', + 'langa3': '', + 'a3sub': '', + 'a3not': '', + 'langa4': '', + 'a4sub': '', + 'a4not': '', + 'langa5': '', + 'langb1': '', + 'b1sub': '', + 'b1not': '', + 'langb4': '', + 'langb5': '', + 'b5sub': '', + 'b5not': '', + 'langb6': '', + 'b6sub': '', + 'b6not': '', + 'langb7': '', + 'b7sub': '', + 'b7not': '', + 'langb8': '', + 'langb9': '', + 'langc2': '', + 'langd1': '', + 'langd2': '', + 'langa3a': '', + 'ftda3afs': '', + 'ftda3afr': '', + 'langb3f': '', + 'langb9f': '', + 'langc1f': '', + 'langc2f': '', + 'langc3f': '', + 'langc4f': '', + 'ftdc4fs': '', + 'ftdc4fr': '', + 'ftdc5fs': '', + 'ftdc5fr': '', + 'ftdc6fs': '', + 'ftdc6fr': '', + 'lange2f': '', + 'lange3f': '', + 'langcls': '', + 'clssub': '' } @@ -157,53 +157,53 @@ def make_blank_fvp(): 'fu_b7not': '', 'fu_b7comm': '', # Z1X - 'fu_a1lang': '', - 'fu_a2lang': '', - 'fu_a2sub_73fdc7': '', - 'fu_a2not_fd65a7': '', - 'fu_a3lang': '', - 'fu_a3sub_c2a68b': '', - 'fu_a3not_f7c411': '', - 'fu_a4lang': '', - 'fu_a4sub_143f22': '', - 'fu_a4not_b95e64': '', - 'fu_b1lang': '', - 'fu_b1sub_c03500': '', - 'fu_b1not_0a7e9f': '', - 'fu_b4lang': '', - 'fu_b5lang': '', - 'fu_b5sub_51a694': '', - 'b5not_fvpz1x': '', - 'fu_b6lang': '', - 'fu_b6sub_db439d': '', - 'fu_b6not_310244': '', - 'fu_b7lang': '', - 'fu_b7sub_21a95f': '', - 'fu_b7not_dccb30': '', - 'fu_b8lang': '', - 'fu_b9lang': '', - 'fu_c2lang': '', - 'fu_d1lang': '', - 'fu_d2lang': '', - 'fu_a3alang': '', - 'fu_a3asubmitted': '', - 'fu_a3anot': '', - 'fu_b3flang': '', - 'fu_b9flang': '', - 'fu_c1flang': '', - 'fu_c2flang': '', - 'fu_c3flang': '', - 'fu_c4flang': '', - 'fu_c4fsubmitted': '', - 'fu_c4fnot': '', - 'fu_c5fsubmitted': '', - 'fu_c5fnot': '', - 'fu_c6fsubmitted': '', - 'fu_c6fnot': '', - 'fu_e2flang': '', - 'fu_e3flang': '', - 'fu_clslang': '', - 'fu_clssubmitted': '' + 'fu_langa1': '', + 'fu_langa2': '', + 'fu_a2sub': '', + 'fu_a2not': '', + 'fu_langa3': '', + 'fu_a3sub': '', + 'fu_a3not': '', + 'fu_langa4': '', + 'fu_a4sub': '', + 'fu_a4not': '', + 'fu_langb1': '', + 'fu_b1sub': '', + 'fu_b1not': '', + 'fu_langb4': '', + 'fu_langb5': '', + 'fu_b5sub': '', + 'fu_b5not': '', + 'fu_langb6': '', + 'fu_b6sub': '', + 'fu_b6not': '', + 'fu_langb7': '', + 'fu_b7sub': '', + 'fu_b7not': '', + 'fu_langb8': '', + 'fu_langb9': '', + 'fu_langc2': '', + 'fu_langd1': '', + 'fu_langd2': '', + 'fu_langa3a': '', + 'fu_ftda3afs': '', + 'fu_ftda3afr': '', + 'fu_langb3f': '', + 'fu_langb9f': '', + 'fu_langc1f': '', + 'fu_langc2f': '', + 'fu_langc3f': '', + 'fu_langc4f': '', + 'fu_ftdc4fs': '', + 'fu_ftdc4fr': '', + 'fu_ftdc5fs': '', + 'fu_ftdc5fr': '', + 'fu_ftdc6fs': '', + 'fu_ftdc6fr': '', + 'fu_lange2f': '', + 'fu_lange3f': '', + 'fu_langcls': '', + 'fu_clssub': '' } if __name__ == "__main__":