rm pi id refs
This commit is contained in:
parent
f4cade1b44
commit
b9b8210f8a
|
@ -1822,10 +1822,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
format: date_time
|
format: date_time
|
||||||
example: "2019-12-25T09:12:33.001Z"
|
example: "2019-12-25T09:12:33.001Z"
|
||||||
primary_investigator_id:
|
|
||||||
type: string
|
|
||||||
x-nullable: true
|
|
||||||
example: dhf8r
|
|
||||||
user_uid:
|
user_uid:
|
||||||
type: string
|
type: string
|
||||||
example: dhf8r
|
example: dhf8r
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UserView(AdminModelView):
|
||||||
|
|
||||||
|
|
||||||
class StudyView(AdminModelView):
|
class StudyView(AdminModelView):
|
||||||
column_filters = ['id', 'primary_investigator_id']
|
column_filters = ['id']
|
||||||
column_searchable_list = ['title']
|
column_searchable_list = ['title']
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,12 @@ import io
|
||||||
|
|
||||||
|
|
||||||
def add_study(body):
|
def add_study(body):
|
||||||
"""Or any study like object. Body should include a title, and primary_investigator_id """
|
"""Or any study like object. Body should include a title """
|
||||||
if 'primary_investigator_id' not in body:
|
|
||||||
raise ApiError("missing_pi", "Can't create a new study without a Primary Investigator.")
|
|
||||||
if 'title' not in body:
|
if 'title' not in body:
|
||||||
raise ApiError("missing_title", "Can't create a new study without a title.")
|
raise ApiError("missing_title", "Can't create a new study without a title.")
|
||||||
|
|
||||||
study_model = StudyModel(user_uid=UserService.current_user().uid,
|
study_model = StudyModel(user_uid=UserService.current_user().uid,
|
||||||
title=body['title'],
|
title=body['title'],
|
||||||
primary_investigator_id=body['primary_investigator_id'],
|
|
||||||
last_updated=datetime.utcnow(),
|
last_updated=datetime.utcnow(),
|
||||||
status=StudyStatus.in_progress)
|
status=StudyStatus.in_progress)
|
||||||
session.add(study_model)
|
session.add(study_model)
|
||||||
|
|
|
@ -24,7 +24,6 @@ class StudyInfo(Script):
|
||||||
"info": {
|
"info": {
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"title": "test",
|
"title": "test",
|
||||||
"primary_investigator_id": 21,
|
|
||||||
"user_uid": "dif84",
|
"user_uid": "dif84",
|
||||||
"sponsor": "sponsor",
|
"sponsor": "sponsor",
|
||||||
"ind_number": "1234",
|
"ind_number": "1234",
|
||||||
|
|
|
@ -10,7 +10,6 @@ from crc.scripts.script import Script
|
||||||
class mock_study:
|
class mock_study:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.title = ""
|
self.title = ""
|
||||||
self.principle_investigator_id = ""
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateStudy(Script):
|
class UpdateStudy(Script):
|
||||||
|
@ -47,7 +46,5 @@ update_study(title=PIComputingID.label, short_title="Really Short Name")
|
||||||
study.short_name = kwargs[arg]
|
study.short_name = kwargs[arg]
|
||||||
elif arg.lower() == "proposal_name":
|
elif arg.lower() == "proposal_name":
|
||||||
study.proposal_name = kwargs[arg]
|
study.proposal_name = kwargs[arg]
|
||||||
elif arg.lower() == "pi":
|
|
||||||
study.primary_investigator_id = kwargs[arg]
|
|
||||||
else:
|
else:
|
||||||
raise WorkflowTaskExecException(task, f"update_study() failed. {self.argument_error_message}")
|
raise WorkflowTaskExecException(task, f"update_study() failed. {self.argument_error_message}")
|
||||||
|
|
|
@ -65,7 +65,6 @@ class BaseTest(unittest.TestCase):
|
||||||
'last_updated': datetime.datetime.utcnow(),
|
'last_updated': datetime.datetime.utcnow(),
|
||||||
'status': StudyStatus.in_progress,
|
'status': StudyStatus.in_progress,
|
||||||
'progress_status': ProgressStatus.in_progress,
|
'progress_status': ProgressStatus.in_progress,
|
||||||
'primary_investigator_id': 'dhf8r',
|
|
||||||
'sponsor': 'Sartography Pharmaceuticals',
|
'sponsor': 'Sartography Pharmaceuticals',
|
||||||
'ind_number': '1234',
|
'ind_number': '1234',
|
||||||
'user_uid': 'dhf8r'
|
'user_uid': 'dhf8r'
|
||||||
|
@ -76,7 +75,6 @@ class BaseTest(unittest.TestCase):
|
||||||
'last_updated': datetime.datetime.utcnow(),
|
'last_updated': datetime.datetime.utcnow(),
|
||||||
'status': StudyStatus.in_progress,
|
'status': StudyStatus.in_progress,
|
||||||
'progress_status': ProgressStatus.in_progress,
|
'progress_status': ProgressStatus.in_progress,
|
||||||
'primary_investigator_id': 'dhf8r',
|
|
||||||
'sponsor': 'Makerspace & Co.',
|
'sponsor': 'Makerspace & Co.',
|
||||||
'ind_number': '5678',
|
'ind_number': '5678',
|
||||||
'user_uid': 'dhf8r'
|
'user_uid': 'dhf8r'
|
||||||
|
@ -261,13 +259,12 @@ class BaseTest(unittest.TestCase):
|
||||||
session.commit()
|
session.commit()
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def create_study(self, uid="dhf8r", title="Beer consumption in the bipedal software engineer",
|
def create_study(self, uid="dhf8r", title="Beer consumption in the bipedal software engineer"):
|
||||||
primary_investigator_id="lb3dp"):
|
|
||||||
study = session.query(StudyModel).filter_by(user_uid=uid).filter_by(title=title).first()
|
study = session.query(StudyModel).filter_by(user_uid=uid).filter_by(title=title).first()
|
||||||
if study is None:
|
if study is None:
|
||||||
user = self.create_user(uid=uid)
|
user = self.create_user(uid=uid)
|
||||||
study = StudyModel(title=title, status=StudyStatus.in_progress,
|
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.add(study)
|
||||||
session.commit()
|
session.commit()
|
||||||
return study
|
return study
|
||||||
|
|
|
@ -24,7 +24,6 @@ class TestStudyApi(BaseTest):
|
||||||
"title": "Phase III Trial of Genuine People Personalities (GPP) Autonomous Intelligent Emotional Agents "
|
"title": "Phase III Trial of Genuine People Personalities (GPP) Autonomous Intelligent Emotional Agents "
|
||||||
"for Interstellar Spacecraft",
|
"for Interstellar Spacecraft",
|
||||||
"last_updated": datetime.utcnow(),
|
"last_updated": datetime.utcnow(),
|
||||||
"primary_investigator_id": "tmm2x",
|
|
||||||
"user_uid": "dhf8r",
|
"user_uid": "dhf8r",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,5 @@ class TestUpdateStudyScript(BaseTest):
|
||||||
proposal_name=details.proposal_name)
|
proposal_name=details.proposal_name)
|
||||||
self.assertEqual(details.title, workflow.study.title)
|
self.assertEqual(details.title, workflow.study.title)
|
||||||
self.assertEqual(details.short_title, workflow.study.short_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.short_name, workflow.study.short_name)
|
||||||
self.assertEqual(details.proposal_name, workflow.study.proposal_name)
|
self.assertEqual(details.proposal_name, workflow.study.proposal_name)
|
||||||
|
|
|
@ -272,7 +272,6 @@ class TestAuthentication(BaseTest):
|
||||||
"title": "blah",
|
"title": "blah",
|
||||||
"last_updated": datetime.utcnow(),
|
"last_updated": datetime.utcnow(),
|
||||||
"status": StudyStatus.in_progress,
|
"status": StudyStatus.in_progress,
|
||||||
"primary_investigator_id": uid,
|
|
||||||
"user_uid": uid,
|
"user_uid": uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ class TestStudyInfoScript(BaseTest):
|
||||||
study_info, second_task = self.do_work(info_type='info')
|
study_info, second_task = self.do_work(info_type='info')
|
||||||
|
|
||||||
self.assertEqual(study_info['title'], second_task.data['info']['title'])
|
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)
|
self.assertIn(study_info['title'], second_task.documentation)
|
||||||
|
|
||||||
def test_info_script_updated_study_info(self):
|
def test_info_script_updated_study_info(self):
|
||||||
|
|
Loading…
Reference in New Issue