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 @staticmethod
def _is_valid_study(study_id): def _is_valid_study(study_id):
# TODO: Determine if this is always a list now study_details = ProtocolBuilderService().get_study_details(study_id)
# TODO: If so, just grab the first item, and get rid of this `if` statement if len(study_details) > 0:
study_info = ProtocolBuilderService().get_study_details(study_id) study_info = study_details[0]
if isinstance(study_info, list) and len(study_info) > 0: else:
study_info = study_info[0] 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]: 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 True
return False return False
@ -275,9 +277,8 @@ class StudyService(object):
for code, doc in doc_dictionary.items(): for code, doc in doc_dictionary.items():
doc['required'] = False doc['required'] = False
# TODO: figure out the correct test here
if ProtocolBuilderService.is_enabled() and doc['id'] != '': 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: if pb_data:
doc['required'] = True doc['required'] = True