From b9b8210f8af5d8c5ce15125a04d83362407f3743 Mon Sep 17 00:00:00 2001 From: alicia pritchett Date: Fri, 18 Mar 2022 12:04:20 -0400 Subject: [PATCH] rm pi id refs --- crc/api.yml | 4 ---- crc/api/admin.py | 2 +- crc/api/study.py | 5 +---- crc/scripts/study_info.py | 1 - crc/scripts/update_study.py | 3 --- tests/base_test.py | 7 ++----- tests/study/test_study_api.py | 1 - tests/study/test_update_study_script.py | 1 - tests/test_authentication.py | 1 - tests/test_study_info_script.py | 1 - 10 files changed, 4 insertions(+), 22 deletions(-) diff --git a/crc/api.yml b/crc/api.yml index 9b73736d..f52cc63b 100755 --- a/crc/api.yml +++ b/crc/api.yml @@ -1822,10 +1822,6 @@ components: type: string format: date_time example: "2019-12-25T09:12:33.001Z" - primary_investigator_id: - type: string - x-nullable: true - example: dhf8r user_uid: type: string example: dhf8r diff --git a/crc/api/admin.py b/crc/api/admin.py index d68c6559..79567343 100644 --- a/crc/api/admin.py +++ b/crc/api/admin.py @@ -42,7 +42,7 @@ class UserView(AdminModelView): class StudyView(AdminModelView): - column_filters = ['id', 'primary_investigator_id'] + column_filters = ['id'] column_searchable_list = ['title'] diff --git a/crc/api/study.py b/crc/api/study.py index 660a7486..c4e5c6f3 100644 --- a/crc/api/study.py +++ b/crc/api/study.py @@ -20,15 +20,12 @@ import io def add_study(body): - """Or any study like object. Body should include a title, and primary_investigator_id """ - if 'primary_investigator_id' not in body: - raise ApiError("missing_pi", "Can't create a new study without a Primary Investigator.") + """Or any study like object. Body should include a title """ if 'title' not in body: raise ApiError("missing_title", "Can't create a new study without a title.") study_model = StudyModel(user_uid=UserService.current_user().uid, title=body['title'], - primary_investigator_id=body['primary_investigator_id'], last_updated=datetime.utcnow(), status=StudyStatus.in_progress) session.add(study_model) diff --git a/crc/scripts/study_info.py b/crc/scripts/study_info.py index 3f91e95b..28c5f73c 100644 --- a/crc/scripts/study_info.py +++ b/crc/scripts/study_info.py @@ -24,7 +24,6 @@ class StudyInfo(Script): "info": { "id": 12, "title": "test", - "primary_investigator_id": 21, "user_uid": "dif84", "sponsor": "sponsor", "ind_number": "1234", diff --git a/crc/scripts/update_study.py b/crc/scripts/update_study.py index 5711c22c..6140ad6e 100644 --- a/crc/scripts/update_study.py +++ b/crc/scripts/update_study.py @@ -10,7 +10,6 @@ from crc.scripts.script import Script class mock_study: def __init__(self): self.title = "" - self.principle_investigator_id = "" class UpdateStudy(Script): @@ -47,7 +46,5 @@ update_study(title=PIComputingID.label, short_title="Really Short Name") study.short_name = kwargs[arg] elif arg.lower() == "proposal_name": study.proposal_name = kwargs[arg] - elif arg.lower() == "pi": - study.primary_investigator_id = kwargs[arg] else: raise WorkflowTaskExecException(task, f"update_study() failed. {self.argument_error_message}") diff --git a/tests/base_test.py b/tests/base_test.py index 3fa5504d..383304fb 100644 --- a/tests/base_test.py +++ b/tests/base_test.py @@ -65,7 +65,6 @@ class BaseTest(unittest.TestCase): 'last_updated': datetime.datetime.utcnow(), 'status': StudyStatus.in_progress, 'progress_status': ProgressStatus.in_progress, - 'primary_investigator_id': 'dhf8r', 'sponsor': 'Sartography Pharmaceuticals', 'ind_number': '1234', 'user_uid': 'dhf8r' @@ -76,7 +75,6 @@ class BaseTest(unittest.TestCase): 'last_updated': datetime.datetime.utcnow(), 'status': StudyStatus.in_progress, 'progress_status': ProgressStatus.in_progress, - 'primary_investigator_id': 'dhf8r', 'sponsor': 'Makerspace & Co.', 'ind_number': '5678', 'user_uid': 'dhf8r' @@ -261,13 +259,12 @@ class BaseTest(unittest.TestCase): session.commit() return user - def create_study(self, uid="dhf8r", title="Beer consumption in the bipedal software engineer", - primary_investigator_id="lb3dp"): + def create_study(self, uid="dhf8r", title="Beer consumption in the bipedal software engineer"): study = session.query(StudyModel).filter_by(user_uid=uid).filter_by(title=title).first() if study is None: user = self.create_user(uid=uid) study = StudyModel(title=title, status=StudyStatus.in_progress, - user_uid=user.uid, primary_investigator_id=primary_investigator_id) + user_uid=user.uid) session.add(study) session.commit() return study diff --git a/tests/study/test_study_api.py b/tests/study/test_study_api.py index 0684fbdd..e7a15c8f 100644 --- a/tests/study/test_study_api.py +++ b/tests/study/test_study_api.py @@ -24,7 +24,6 @@ class TestStudyApi(BaseTest): "title": "Phase III Trial of Genuine People Personalities (GPP) Autonomous Intelligent Emotional Agents " "for Interstellar Spacecraft", "last_updated": datetime.utcnow(), - "primary_investigator_id": "tmm2x", "user_uid": "dhf8r", } diff --git a/tests/study/test_update_study_script.py b/tests/study/test_update_study_script.py index 94cd85ed..0b9d151d 100644 --- a/tests/study/test_update_study_script.py +++ b/tests/study/test_update_study_script.py @@ -36,6 +36,5 @@ class TestUpdateStudyScript(BaseTest): proposal_name=details.proposal_name) self.assertEqual(details.title, workflow.study.title) self.assertEqual(details.short_title, workflow.study.short_title) - self.assertEqual(details.pi, workflow.study.primary_investigator_id) self.assertEqual(details.short_name, workflow.study.short_name) self.assertEqual(details.proposal_name, workflow.study.proposal_name) diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 1da98ac6..0c287c14 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -272,7 +272,6 @@ class TestAuthentication(BaseTest): "title": "blah", "last_updated": datetime.utcnow(), "status": StudyStatus.in_progress, - "primary_investigator_id": uid, "user_uid": uid, } diff --git a/tests/test_study_info_script.py b/tests/test_study_info_script.py index db886735..fe869f8b 100644 --- a/tests/test_study_info_script.py +++ b/tests/test_study_info_script.py @@ -34,7 +34,6 @@ class TestStudyInfoScript(BaseTest): study_info, second_task = self.do_work(info_type='info') self.assertEqual(study_info['title'], second_task.data['info']['title']) - self.assertEqual(study_info['primary_investigator_id'], second_task.data['info']['primary_investigator_id']) self.assertIn(study_info['title'], second_task.documentation) def test_info_script_updated_study_info(self):