Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinHanson committed Dec 15, 2020
2 parents 7af6c6b + 75dbdb3 commit 71b2515
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 74 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
Changelog
=========
## [1.6.0] - 2020-12-15
### Summary
This change was implemented after getting feedback from OHSU. Some ADRCs do
not have the optional forms like A2 or A3 in their REDCap project at all, since
they will not be used for that center. NACCulator used to run with the
requirement that all forms be present in a REDCap project, whether they were
optional or not. This change is very similar to the one made previously that
made the CLS, Z1, and C1 forms optional for the REDCap csv input.
I also fixed a bug in the FTLD FVP builder that would cause it to look for the
IVP Z1X form.

### added
* Make optional forms for FTLD optional in REDCap project
* Make all optional UDS3 forms optional in REDCap project


### changed
* Fix cruft in FVP builder (Samantha Emerson)
* Update README to account for cappy install complication
* Fix ftld fvp builder to take followup Z1X instead of initial

## [1.5.0] - 2020-12-08
### Summary

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ HOW TO Convert from REDCap to NACC

To install NACCulator, run:

$ python3 -m pip install git+https://github.com/ctsit/[email protected]#egg=cappy-2.0.0
$ pip3 install git+https://github.com/ctsit/nacculator.git

Once the project data is exported from REDCap to the CSV file `data.csv`, run:
Expand Down
30 changes: 21 additions & 9 deletions nacc/ftld/fvp/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,32 @@ def build_ftld_fvp_form(record: dict, err=sys.stderr):
# Forms B3F, B9F, C1F, C2F, C3F, E2F, and E3F are REQUIRED.
# Forms A3A, C4F, C5F, and C6F are OPTIONAL and must be specifically
# marked as present for nacculator to process them
if record['ivp_z1x_complete'] in ['1', '2']:
if record['ftda3afs'] == '1':
add_a3a(record, packet)
if record['fvp_z1x_complete'] in ['1', '2']:
try:
if record['fu_ftda3afs'] == '1':
add_a3a(record, packet)
except KeyError:
pass
add_b3f(record, packet)
add_b9f(record, packet)
add_c1f(record, packet)
add_c2f(record, packet)
add_c3f(record, packet)
if record['ftdc4fs'] == '1':
add_c4f(record, packet)
if record['ftdc5fs'] == '1':
add_c5f(record, packet)
if record['ftdc6fs'] == '1':
add_c6f(record, packet)
try:
if record['fu_ftdc4fs'] == '1':
add_c4f(record, packet)
except KeyError:
pass
try:
if record['fu_ftdc5fs'] == '1':
add_c5f(record, packet)
except KeyError:
pass
try:
if record['fu_ftdc6fs'] == '1':
add_c6f(record, packet)
except KeyError:
pass
else:
print("ptid " + str(record['ptid']) +
": No Z1X form found.", file=err)
Expand Down
28 changes: 20 additions & 8 deletions nacc/ftld/ivp/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,31 @@ def build_ftld_ivp_form(record: dict, err=sys.stderr):
# Forms A3A, C4F, C5F, and C6F are OPTIONAL and must be specifically
# marked as present for nacculator to process them
if record['ivp_z1x_complete'] in ['1', '2']:
if record['ftda3afs'] == '1':
add_a3a(record, packet)
try:
if record['ftda3afs'] == '1':
add_a3a(record, packet)
except KeyError:
pass
add_b3f(record, packet)
add_b9f(record, packet)
add_c1f(record, packet)
add_c2f(record, packet)
add_c3f(record, packet)
if record['ftdc4fs'] == '1':
add_c4f(record, packet)
if record['ftdc5fs'] == '1':
add_c5f(record, packet)
if record['ftdc6fs'] == '1':
add_c6f(record, packet)
try:
if record['ftdc4fs'] == '1':
add_c4f(record, packet)
except KeyError:
pass
try:
if record['ftdc5fs'] == '1':
add_c5f(record, packet)
except KeyError:
pass
try:
if record['ftdc6fs'] == '1':
add_c6f(record, packet)
except KeyError:
pass
else:
print("ptid " + str(record['ptid']) +
": No Z1X form found.", file=err)
Expand Down
2 changes: 2 additions & 0 deletions nacc/redcap2nacc.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def check_redcap_event(options, record) -> bool:
form_match_z1 = record['ivp_z1_complete']
except KeyError:
form_match_z1 = ''
record['ivp_z1_complete'] = ''
form_match_z1x = record['ivp_z1x_complete']
if form_match_z1 in ['0', ''] and form_match_z1x in ['0', '']:
return False
Expand All @@ -207,6 +208,7 @@ def check_redcap_event(options, record) -> bool:
form_match_z1 = record['fvp_z1_complete']
except KeyError:
form_match_z1 = ''
record['ivp_z1_complete'] = ''
form_match_z1x = record['fvp_z1x_complete']
if form_match_z1 in ['0', ''] and form_match_z1x in ['0', '']:
return False
Expand Down
98 changes: 70 additions & 28 deletions nacc/uds3/fvp/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,79 @@ def build_uds3_fvp_form(record, err=sys.stderr):
add_z1_or_z1x(record, packet)
add_a1(record, packet)
if record['fvp_z1x_complete'] in ['1', '2']:
if record['fu_a2sub'] == '1':
add_a2(record, packet)
if record['fu_a3sub'] == '1':
add_a3(record, packet)
if record['fu_a4sub'] == '1':
add_a4(record, packet)
if record['fu_b1sub'] == '1':
add_b1(record, packet)
try:
if record['fu_a2sub'] == '1':
add_a2(record, packet)
except KeyError:
pass
try:
if record['fu_a3sub'] == '1':
add_a3(record, packet)
except KeyError:
pass
try:
if record['fu_a4sub'] == '1':
add_a4(record, packet)
except KeyError:
pass
try:
if record['fu_b1sub'] == '1':
add_b1(record, packet)
except KeyError:
pass
add_b4(record, packet)
if record['fu_b5sub'] == '1':
add_b5(record, packet)
if record['fu_b6sub'] == '1':
add_b6(record, packet)
if record['fu_b7sub'] == '1':
add_b7(record, packet)
try:
if record['fu_b5sub'] == '1':
add_b5(record, packet)
except KeyError:
pass
try:
if record['fu_b6sub'] == '1':
add_b6(record, packet)
except KeyError:
pass
try:
if record['fu_b7sub'] == '1':
add_b7(record, packet)
except KeyError:
pass
elif record['fvp_z1_complete'] in ['1', '2']:
if record['fu_a2_sub'] == '1':
add_a2(record, packet)
if record['fu_a3_sub'] == '1':
add_a3(record, packet)
if record['fu_a4_sub'] == '1':
add_a4(record, packet)
if record['fu_b1_sub'] == '1':
add_b1(record, packet)
try:
if record['fu_a2_sub'] == '1':
add_a2(record, packet)
except KeyError:
pass
try:
if record['fu_a3_sub'] == '1':
add_a3(record, packet)
except KeyError:
pass
try:
if record['fu_a4_sub'] == '1':
add_a4(record, packet)
except KeyError:
pass
try:
if record['fu_b1_sub'] == '1':
add_b1(record, packet)
except KeyError:
pass
add_b4(record, packet)
if record['fu_b5_sub'] == '1':
add_b5(record, packet)
if record['fu_b6_sub'] == '1':
add_b6(record, packet)
if record['fu_b7_sub'] == '1':
add_b7(record, packet)
try:
if record['fu_b5_sub'] == '1':
add_b5(record, packet)
except KeyError:
pass
try:
if record['fu_b6_sub'] == '1':
add_b6(record, packet)
except KeyError:
pass
try:
if record['fu_b7_sub'] == '1':
add_b7(record, packet)
except KeyError:
pass
else:
print("ptid " + str(record['ptid']) +
": No Z1X or Z1 form found.", file=err)
Expand Down
98 changes: 70 additions & 28 deletions nacc/uds3/ivp/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,81 @@ def build_uds3_ivp_form(record, err=sys.stderr):
add_z1_or_z1x(record, packet)
add_a1(record, packet)
if record['ivp_z1x_complete'] in ['1', '2']:
if record['a2sub'] == '1':
add_a2(record, packet)
if record['a3sub'] == '1':
add_a3(record, packet)
if record['a4sub'] == '1':
add_a4(record, packet)
try:
if record['a2sub'] == '1':
add_a2(record, packet)
except KeyError:
pass
try:
if record['a3sub'] == '1':
add_a3(record, packet)
except KeyError:
pass
try:
if record['a4sub'] == '1':
add_a4(record, packet)
except KeyError:
pass
add_a5(record, packet)
if record['b1sub'] == '1':
add_b1(record, packet)
try:
if record['b1sub'] == '1':
add_b1(record, packet)
except KeyError:
pass
add_b4(record, packet)
if record['b5sub'] == '1':
add_b5(record, packet)
if record['b6sub'] == '1':
add_b6(record, packet)
if record['b7sub'] == '1':
add_b7(record, packet)
try:
if record['b5sub'] == '1':
add_b5(record, packet)
except KeyError:
pass
try:
if record['b6sub'] == '1':
add_b6(record, packet)
except KeyError:
pass
try:
if record['b7sub'] == '1':
add_b7(record, packet)
except KeyError:
pass
elif record['ivp_z1_complete'] in ['1', '2']:
if record['a2_sub'] == '1':
add_a2(record, packet)
if record['a3_sub'] == '1':
add_a3(record, packet)
if record['a4_sub'] == '1':
add_a4(record, packet)
try:
if record['a2_sub'] == '1':
add_a2(record, packet)
except KeyError:
pass
try:
if record['a3_sub'] == '1':
add_a3(record, packet)
except KeyError:
pass
try:
if record['a4_sub'] == '1':
add_a4(record, packet)
except KeyError:
pass
add_a5(record, packet)
if record['b1_sub'] == '1':
add_b1(record, packet)
try:
if record['b1_sub'] == '1':
add_b1(record, packet)
except KeyError:
pass
add_b4(record, packet)
if record['b5_sub'] == '1':
add_b5(record, packet)
if record['b6_sub'] == '1':
add_b6(record, packet)
if record['b7_sub'] == '1':
add_b7(record, packet)
try:
if record['b5_sub'] == '1':
add_b5(record, packet)
except KeyError:
pass
try:
if record['b6_sub'] == '1':
add_b6(record, packet)
except KeyError:
pass
try:
if record['b7_sub'] == '1':
add_b7(record, packet)
except KeyError:
pass
else:
print("ptid " + str(record['ptid']) +
": No Z1X or Z1 form found.", file=err)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from setuptools import setup, find_packages

VERSION = "1.5.0"
VERSION = "1.6.0"

setup(
name="nacculator",
Expand Down

0 comments on commit 71b2515

Please sign in to comment.