Added comment to _is_valid_study.

Fixed get_required_docs. The data returned for get_required_dcs from UVA PB was *very* different than what we had.
This commit is contained in:
mike cullerton 2021-11-05 14:37:41 -04:00
parent d186b24de3
commit 6f09b0d7dd
1 changed files with 10 additions and 9 deletions

View File

@ -37,11 +37,13 @@ class StudyService(object):
@staticmethod
def _is_valid_study(study_id):
# TODO: Determine if this is always a list now
# TODO: If so, just grab the first item, and get rid of this `if` statement
study_info = ProtocolBuilderService().get_study_details(study_id)
if isinstance(study_info, list) and len(study_info) > 0:
study_info = study_info[0]
study_details = ProtocolBuilderService().get_study_details(study_id)
if len(study_details) > 0:
study_info = study_details[0]
else:
study_info = None
# The review types 2, 3, 23, 24 correspond to review type names
# `Full Committee`, `Expedited`, `Non-UVA IRB Full Board`, and `Non-UVA IRB Expedited`
if isinstance(study_info, dict) and 'REVIEW_TYPE' in study_info.keys() and study_info['REVIEW_TYPE'] in [2, 3, 23, 24]:
return True
return False
@ -275,9 +277,8 @@ class StudyService(object):
for code, doc in doc_dictionary.items():
doc['required'] = False
# TODO: figure out the correct test here
if ProtocolBuilderService.is_enabled() and doc['id'] != '':
pb_data = next((item for item in pb_docs if int(item['AUXDOCID']) == int(doc['id'])), None)
pb_data = next((item for item in pb_docs['AUXDOCS'] if int(item['SS_AUXILIARY_DOC_TYPE_ID']) == int(doc['id'])), None)
if pb_data:
doc['required'] = True