Skip to content

Commit e720ccd

Browse files
committed
Merge branch 'release/1.8.1'
2 parents 5806b77 + 507df67 commit e720ccd

8 files changed

+43
-32
lines changed

CHANGELOG

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Changelog
22
=========
3+
## [1.8.1] - 2021-11-04
4+
### Summary
5+
This release provides one major bug fix in the FTLD follow-up packet, updated
6+
installation instructions, and a few minor fixes for bugs in error logging
7+
etc.
8+
9+
### Updated
10+
* Fix cappy install instructions in README
11+
* Update FTLD FVP Z1X with fixed column spacing
12+
13+
314
## [1.8.0] - 2021-09-13
415
### Summary
516

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ HOW TO Convert from REDCap to NACC
2121

2222
To install NACCulator, run:
2323

24-
$ python3 -m pip install git+https://github.com/ctsit/cappy.git@2.0.0#egg=cappy-2.0.0
24+
$ python3 -m pip install git+https://github.com/ctsit/cappy.git@2.0.0
2525
$ pip3 install git+https://github.com/ctsit/nacculator.git
2626

2727
Once the project data is exported from REDCap to the CSV file `data.csv`, run:
@@ -59,7 +59,7 @@ the `-file` flag._
5959
[-lbd | -ftld] [-file FILE] [-meta FILTER_META] [-ptid PTID]
6060
[-vnum VNUM] [-vtype VTYPE]
6161

62-
Process redcap form output to nacculator.
62+
Process redcap export data through nacculator.
6363

6464
optional arguments:
6565
-h, --help show this help message and exit

nacc/ftld/fvp/builder.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ def add_z1x(record, packet):
124124
Z1X.B6LNOT = record['fu_b6lnot']
125125
except KeyError:
126126
try:
127-
if record['fu_lbudspch'] is not None:
128-
Z1X.B2LSUB = '1'
129-
Z1X.B2LNOT = ''
130-
if record['fu_lbspcgim'] is not None:
127+
if record['fu_lbudspch'] in ['0', '1']:
131128
Z1X.B2LSUB = '1'
132129
Z1X.B2LNOT = ''
130+
if record['fu_lbspcgim'] in ['0', '1']:
131+
Z1X.B6LSUB = '1'
132+
Z1X.B6LNOT = ''
133133
# And leave the LBD fields blank if the project does not contain the
134134
# LBD module
135135
except KeyError:

nacc/ftld/fvp/forms.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,22 @@ def __init__(self):
4646
self.fields['LANGA4'] = nacc.uds3.Field(name='LANGA4', typename='Num', position=(61, 61), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 4b A4SUB = 0 (No)'])
4747
self.fields['A4SUB'] = nacc.uds3.Field(name='A4SUB', typename='Num', position=(63, 63), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
4848
self.fields['A4NOT'] = nacc.uds3.Field(name='A4NOT', typename='Num', position=(65, 66), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 4b A4SUB = 1 (Yes)'])
49-
self.fields['LANGB1'] = nacc.uds3.Field(name='LANGB1', typename='Num', position=(70, 70), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 6b B1SUB = 0 (No)'])
50-
self.fields['B1SUB'] = nacc.uds3.Field(name='B1SUB', typename='Num', position=(72, 72), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
51-
self.fields['B1NOT'] = nacc.uds3.Field(name='B1NOT', typename='Num', position=(74, 75), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 6b B1SUB = 1 (Yes)'])
52-
self.fields['LANGB4'] = nacc.uds3.Field(name='LANGB4', typename='Num', position=(77, 77), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
53-
self.fields['LANGB5'] = nacc.uds3.Field(name='LANGB5', typename='Num', position=(79, 79), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 8b B5SUB = 0 (No)'])
54-
self.fields['B5SUB'] = nacc.uds3.Field(name='B5SUB', typename='Num', position=(81, 81), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
55-
self.fields['B5NOT'] = nacc.uds3.Field(name='B5NOT', typename='Num', position=(83, 84), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 8b B5SUB = 1 (Yes)'])
56-
self.fields['LANGB6'] = nacc.uds3.Field(name='LANGB6', typename='Num', position=(86, 86), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 9b B6SUB = 0 (No)'])
57-
self.fields['B6SUB'] = nacc.uds3.Field(name='B6SUB', typename='Num', position=(88, 88), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
58-
self.fields['B6NOT'] = nacc.uds3.Field(name='B6NOT', typename='Num', position=(90, 91), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 9b B6SUB = 1 (Yes)'])
59-
self.fields['LANGB7'] = nacc.uds3.Field(name='LANGB7', typename='Num', position=(93, 93), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 10b B7SUB = 0 (No)'])
60-
self.fields['B7SUB'] = nacc.uds3.Field(name='B7SUB', typename='Num', position=(95, 95), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
61-
self.fields['B7NOT'] = nacc.uds3.Field(name='B7NOT', typename='Num', position=(97, 98), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 10b B7SUB = 1 (Yes)'])
62-
self.fields['LANGB8'] = nacc.uds3.Field(name='LANGB8', typename='Num', position=(100, 100), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
63-
self.fields['LANGB9'] = nacc.uds3.Field(name='LANGB9', typename='Num', position=(102, 102), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
49+
self.fields['LANGB1'] = nacc.uds3.Field(name='LANGB1', typename='Num', position=(68, 68), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 6b B1SUB = 0 (No)'])
50+
self.fields['B1SUB'] = nacc.uds3.Field(name='B1SUB', typename='Num', position=(70, 70), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
51+
self.fields['B1NOT'] = nacc.uds3.Field(name='B1NOT', typename='Num', position=(72, 73), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 6b B1SUB = 1 (Yes)'])
52+
self.fields['LANGB4'] = nacc.uds3.Field(name='LANGB4', typename='Num', position=(75, 75), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
53+
self.fields['LANGB5'] = nacc.uds3.Field(name='LANGB5', typename='Num', position=(77, 77), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 8b B5SUB = 0 (No)'])
54+
self.fields['B5SUB'] = nacc.uds3.Field(name='B5SUB', typename='Num', position=(79, 79), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
55+
self.fields['B5NOT'] = nacc.uds3.Field(name='B5NOT', typename='Num', position=(81, 82), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 8b B5SUB = 1 (Yes)'])
56+
self.fields['LANGB6'] = nacc.uds3.Field(name='LANGB6', typename='Num', position=(84, 84), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 9b B6SUB = 0 (No)'])
57+
self.fields['B6SUB'] = nacc.uds3.Field(name='B6SUB', typename='Num', position=(86, 86), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
58+
self.fields['B6NOT'] = nacc.uds3.Field(name='B6NOT', typename='Num', position=(88, 89), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 9b B6SUB = 1 (Yes)'])
59+
self.fields['LANGB7'] = nacc.uds3.Field(name='LANGB7', typename='Num', position=(91, 91), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 10b B7SUB = 0 (No)'])
60+
self.fields['B7SUB'] = nacc.uds3.Field(name='B7SUB', typename='Num', position=(93, 93), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
61+
self.fields['B7NOT'] = nacc.uds3.Field(name='B7NOT', typename='Num', position=(95, 96), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98'], blanks=['Blank if Question 10b B7SUB = 1 (Yes)'])
62+
self.fields['LANGB8'] = nacc.uds3.Field(name='LANGB8', typename='Num', position=(98, 98), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
63+
self.fields['LANGB9'] = nacc.uds3.Field(name='LANGB9', typename='Num', position=(100, 100), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
64+
self.fields['LANGC1'] = nacc.uds3.Field(name='LANGC1', typename='Num', position=(102, 102), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
6465
self.fields['LANGC2'] = nacc.uds3.Field(name='LANGC2', typename='Num', position=(104, 104), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
6566
self.fields['LANGD1'] = nacc.uds3.Field(name='LANGD1', typename='Num', position=(106, 106), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
6667
self.fields['LANGD2'] = nacc.uds3.Field(name='LANGD2', typename='Num', position=(108, 108), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
@@ -85,7 +86,6 @@ def __init__(self):
8586
self.fields['LANGE3F'] = nacc.uds3.Field(name='LANGE3F', typename='Num', position=(150, 150), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=[])
8687
self.fields['LANGCLS'] = nacc.uds3.Field(name='LANGCLS', typename='Num', position=(152, 152), length=1, inclusive_range=(1, 2), allowable_values=['1', '2'], blanks=['Blank if Question 27b CLSSUB = 0 (No)'])
8788
self.fields['CLSSUB'] = nacc.uds3.Field(name='CLSSUB', typename='Num', position=(154, 154), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
88-
self.fields['CLSSUB'] = nacc.uds3.Field(name='CLSSUB', typename='Num', position=(154, 154), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
8989
self.fields['B2LSUB'] = nacc.uds3.Field(name='B2LSUB', typename='Num', position=(156, 156), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])
9090
self.fields['B2LNOT'] = nacc.uds3.Field(name='B2LNOT', typename='Num', position=(158, 159), length=2, inclusive_range=None, allowable_values=['95', '96', '97', '98', '99'], blanks=['Blank if Question 28b B2LSUB = 1 (Yes)'])
9191
self.fields['B6LSUB'] = nacc.uds3.Field(name='B6LSUB', typename='Num', position=(161, 161), length=1, inclusive_range=(0, 1), allowable_values=['0', '1'], blanks=[])

nacc/ftld/ivp/builder.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def add_z1x(record, packet):
125125
Z1X.B6LNOT = record['b6lnot']
126126
except KeyError:
127127
try:
128-
if record['lbudspch'] is not None:
129-
Z1X.B2LSUB = '1'
130-
Z1X.B2LNOT = ''
131-
if record['lbspcgim'] is not None:
128+
if record['lbudspch'] in ['0', '1']:
132129
Z1X.B2LSUB = '1'
133130
Z1X.B2LNOT = ''
131+
if record['lbspcgim'] in ['0', '1']:
132+
Z1X.B6LSUB = '1'
133+
Z1X.B6LNOT = ''
134134
# And leave the LBD fields blank if the project does not contain the
135135
# LBD module
136136
except KeyError:

nacc/redcap2nacc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def check_for_bad_characters(field: Field) -> typing.List:
167167
return incompatible
168168

169169

170-
def check_redcap_event(options, record) -> bool:
170+
def check_redcap_event(options, record, out=sys.stdout, err=sys.stderr) -> bool:
171171
"""
172172
Determines if the record's redcap_event_name and filled forms match the
173173
options flag
@@ -230,7 +230,7 @@ def check_redcap_event(options, record) -> bool:
230230
form_match_z1 = record['fvp_z1_complete']
231231
except KeyError:
232232
form_match_z1 = ''
233-
record['ivp_z1_complete'] = ''
233+
record['fvp_z1_complete'] = ''
234234
form_match_z1x = record['fvp_z1x_complete']
235235
if form_match_z1 in ['0', ''] and form_match_z1x in ['0', '']:
236236
return False
@@ -256,7 +256,7 @@ def check_redcap_event(options, record) -> bool:
256256
if followup_match in ['', '0']:
257257
return False
258258
except KeyError:
259-
print("Could not find a REDCap field for TFP Z1X form.")
259+
print("Could not find a REDCap field for TFP Z1X form.", file=err)
260260
return False
261261
elif options.tfp3:
262262
event_name = 'tele'

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from setuptools import setup, find_packages
88

9-
VERSION = "1.8.0"
9+
VERSION = "1.8.1"
1010

1111
setup(
1212
name="nacculator",

tests/test_skip_optional_forms_ftld.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_a3a_ivp_skip(self):
1414

1515
expected = record['ftdothis']
1616
result = ivp_builder.build_ftld_ivp_form(record)
17-
self.assertEqual(expected, result['FTDOThIS'])
17+
self.assertEqual(expected, result['FTDOTHIS'])
1818

1919
def test_a3a_fvp_skip(self):
2020
""" If the FVP A3a is not present in the csv, it should be skipped
@@ -24,7 +24,7 @@ def test_a3a_fvp_skip(self):
2424

2525
expected = record['fu_ftdothis']
2626
result = fvp_builder.build_ftld_fvp_form(record)
27-
self.assertEqual(expected, result['FTDOThIS'])
27+
self.assertEqual(expected, result['FTDOTHIS'])
2828

2929
def test_ivp_b3f_not_skipped(self):
3030
""" Form B3F is required and should never be skipped. """

0 commit comments

Comments
 (0)