Fixed Associate API Endpoint description

This commit is contained in:
NWalker4483 2021-07-20 13:57:32 -04:00
parent 4632c6374f
commit a73d1794eb
419 changed files with 33 additions and 43 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ local.properties
.settings/
.loadpath
.recommenders
.vscode/
# External tool builders
.externalToolBuilders/

0
.sonarcloud.properties Normal file → Executable file
View File

0
.travis.yml Normal file → Executable file
View File

0
Dockerfile Normal file → Executable file
View File

0
LICENSE.md Normal file → Executable file
View File

0
Pipfile Normal file → Executable file
View File

0
Pipfile.lock generated Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
config/default.py Normal file → Executable file
View File

0
config/logging_example.py Normal file → Executable file
View File

0
config/testing.py Normal file → Executable file
View File

0
crc/__init__.py Normal file → Executable file
View File

48
crc/api.yml Normal file → Executable file
View File

@ -399,22 +399,24 @@ paths:
- name: study_id
in: path
required: true
description: The id of the study for which workflows should be returned.
description: The id of the study for which associates should be returned.
schema:
type: integer
format: int32
get:
operationId: crc.api.study.get_study_associates
summary: Provides a single study
summary: Provides a list of associates for a particular study
tags:
- Studies
responses:
'200':
description: An Study Associate Object
description: list of Study Associate Objects
content:
application/json:
schema:
$ref: "#/components/schemas/StudyAssociate"
type: array
items:
$ref: "#/components/schemas/StudyAssociate"
/workflow-specification:
get:
@ -1589,39 +1591,15 @@ components:
example: "27b-6-1212"
StudyAssociate:
properties:
id:
type: integer
example: 1234
title:
uid:
type: string
example: The impact of fried pickles on beer consumption in bipedal software developers.
last_updated:
example: "dhf8r"
access:
type: boolean
example: False
role:
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
status:
type: string
enum: ['in_progress', 'hold', 'open_for_enrollment', 'abandoned']
example: done
sponsor:
type: string
x-nullable: true
example: "Sartography Pharmaceuticals"
ind_number:
type: string
x-nullable: true
example: "27b-6-42"
hsr_number:
type: string
x-nullable: true
example: "27b-6-1212"
example: "TODO"
DocumentDirectory:
properties:
level:

0
crc/api/__init__.py Normal file → Executable file
View File

0
crc/api/admin.py Normal file → Executable file
View File

0
crc/api/common.py Normal file → Executable file
View File

0
crc/api/data_store.py Normal file → Executable file
View File

0
crc/api/document.py Normal file → Executable file
View File

0
crc/api/file.py Normal file → Executable file
View File

0
crc/api/study.py Normal file → Executable file
View File

0
crc/api/tools.py Normal file → Executable file
View File

0
crc/api/user.py Normal file → Executable file
View File

0
crc/api/workflow.py Normal file → Executable file
View File

0
crc/api/workflow_sync.py Normal file → Executable file
View File

0
crc/models/__init__.py Normal file → Executable file
View File

0
crc/models/api_models.py Normal file → Executable file
View File

0
crc/models/data_store.py Normal file → Executable file
View File

0
crc/models/email.py Normal file → Executable file
View File

0
crc/models/file.py Normal file → Executable file
View File

0
crc/models/ldap.py Normal file → Executable file
View File

0
crc/models/protocol_builder.py Normal file → Executable file
View File

1
crc/models/study.py Normal file → Executable file
View File

@ -79,6 +79,7 @@ class StudyAssociated(db.Model):
role = db.Column(db.String, nullable=True)
send_email = db.Column(db.Boolean, nullable=True)
access = db.Column(db.Boolean, nullable=True)
class StudyAssociatedSchema(ma.Schema):
class Meta:
model = StudyAssociated

0
crc/models/task_event.py Normal file → Executable file
View File

0
crc/models/user.py Normal file → Executable file
View File

0
crc/models/workflow.py Normal file → Executable file
View File

0
crc/scripts/__init__.py Normal file → Executable file
View File

0
crc/scripts/check_study.py Normal file → Executable file
View File

0
crc/scripts/complete_template.py Normal file → Executable file
View File

0
crc/scripts/delete_file.py Normal file → Executable file
View File

0
crc/scripts/email.py Normal file → Executable file
View File

0
crc/scripts/fact_service.py Normal file → Executable file
View File

0
crc/scripts/failing_script.py Normal file → Executable file
View File

0
crc/scripts/file_data_get.py Normal file → Executable file
View File

0
crc/scripts/file_data_set.py Normal file → Executable file
View File

0
crc/scripts/get_dashboard_url.py Normal file → Executable file
View File

0
crc/scripts/get_irb_info.py Normal file → Executable file
View File

0
crc/scripts/get_study_associate.py Normal file → Executable file
View File

0
crc/scripts/get_study_associates.py Normal file → Executable file
View File

0
crc/scripts/is_file_uploaded.py Normal file → Executable file
View File

0
crc/scripts/ldap.py Normal file → Executable file
View File

0
crc/scripts/reset_workflow.py Normal file → Executable file
View File

0
crc/scripts/script.py Normal file → Executable file
View File

0
crc/scripts/study_data_get.py Normal file → Executable file
View File

0
crc/scripts/study_data_set.py Normal file → Executable file
View File

0
crc/scripts/study_info.py Normal file → Executable file
View File

0
crc/scripts/update_study.py Normal file → Executable file
View File

0
crc/scripts/update_study_associate.py Normal file → Executable file
View File

0
crc/scripts/update_study_associates.py Normal file → Executable file
View File

0
crc/scripts/user_data_get.py Normal file → Executable file
View File

0
crc/scripts/user_data_set.py Normal file → Executable file
View File

0
crc/services/__init__.py Normal file → Executable file
View File

0
crc/services/cache_service.py Normal file → Executable file
View File

0
crc/services/data_store_service.py Normal file → Executable file
View File

0
crc/services/document_service.py Normal file → Executable file
View File

0
crc/services/email_service.py Normal file → Executable file
View File

0
crc/services/error_service.py Normal file → Executable file
View File

0
crc/services/failing_service.py Normal file → Executable file
View File

0
crc/services/file_service.py Normal file → Executable file
View File

0
crc/services/ldap_service.py Normal file → Executable file
View File

0
crc/services/lookup_service.py Normal file → Executable file
View File

0
crc/services/protocol_builder.py Normal file → Executable file
View File

21
crc/services/study_service.py Normal file → Executable file
View File

@ -24,6 +24,7 @@ from crc.models.task_event import TaskEventModel, TaskEvent
from crc.models.workflow import WorkflowSpecCategoryModel, WorkflowModel, WorkflowSpecModel, WorkflowState, \
WorkflowStatus, WorkflowSpecDependencyFile
from crc.services.document_service import DocumentService
from crc.services.file_service import FileService
from crc.services.ldap_service import LdapService
from crc.services.lookup_service import LookupService
@ -122,14 +123,18 @@ class StudyService(object):
raise ApiError('uid not specified','A valid uva uid is required for this function')
if uid == study.user_uid:
return {'uid': ownerid, 'role': 'owner', 'send_email': True, 'access': True}
return {'uid': uid, 'role': 'owner', 'send_email': True, 'access': True}
person = db.session.query(StudyAssociated).filter((StudyAssociated.study_id == study_id)&(
StudyAssociated.uid == uid)).first()
if person:
return StudyAssociatedSchema().dump(person)
newAssociate = {'uid': person.uid}
newAssociate['role'] = person.role
newAssociate['send_email'] = person.send_email
newAssociate['access'] = person.access
return newAssociate
raise ApiError('uid_not_associated_with_study',"user id %s was not associated with study number %d"%(uid,
study_id))
@ -148,7 +153,12 @@ class StudyService(object):
people = db.session.query(StudyAssociated).filter(StudyAssociated.study_id == study_id)
people_list = [{'uid':ownerid,'role':'owner','send_email':True,'access':True}]
people_list += StudyAssociatedSchema().dump(people, many=True)
for person in people:
newAssociate = {'uid':person.uid}
newAssociate['role'] = person.role
newAssociate['send_email'] = person.send_email
newAssociate['access'] = person.access
people_list.append(newAssociate)
return people_list
@ -227,6 +237,7 @@ class StudyService(object):
for workflow in session.query(WorkflowModel).filter_by(study_id=study_id):
StudyService.delete_workflow(workflow.id)
study = session.query(StudyModel).filter_by(id=study_id).first()
study = session.query(StudyModel).filter_by(id=study_id).first()
session.delete(study)
session.commit()
@ -382,7 +393,6 @@ class StudyService(object):
in sync with the studies available in protocol builder. """
if ProtocolBuilderService.is_enabled():
app.logger.info("The Protocol Builder is enabled. app.config['PB_ENABLED'] = " +
str(app.config['PB_ENABLED']))
@ -398,10 +408,11 @@ class StudyService(object):
for pb_study in pb_studies:
new_status = None
db_study = next((s for s in db_studies if s.id == pb_study.STUDYID), None)
if not db_study:
if not db_study: # Create a Study
db_study = StudyModel(id=pb_study.STUDYID)
db_study.status = None # Force a new sa
new_status = StudyStatus.in_progress
session.add(db_study)
db_studies.append(db_study)

0
crc/services/user_service.py Normal file → Executable file
View File

0
crc/services/workflow_processor.py Normal file → Executable file
View File

4
crc/services/workflow_service.py Normal file → Executable file
View File

@ -765,7 +765,7 @@ class WorkflowService(object):
else:
if not hasattr(spiff_task.task_spec, 'lane') or spiff_task.task_spec.lane is None:
associated = StudyService.get_study_associates(processor.workflow_model.study.id)
return [user['uid'] for user in associated if user['access']]
return [user['uid'] for user in associated if user.get("access")]
if spiff_task.task_spec.lane not in spiff_task.data:
return [] # No users are assignable to the task at this moment
lane_users = spiff_task.data[spiff_task.task_spec.lane]
@ -775,7 +775,7 @@ class WorkflowService(object):
lane_uids = []
for user in lane_users:
if isinstance(user, dict):
if 'value' in user and user['value'] is not None:
if user.get("value"):
lane_uids.append(user['value'])
else:
raise ApiError.from_task(code="task_lane_user_error", message="Spiff Task %s lane user dict must have a key called 'value' with the user's uid in it." %

0
crc/services/workflow_sync.py Normal file → Executable file
View File

0
crc/static/bpmn/abandoned/abandoned.bpmn Normal file → Executable file
View File

0
crc/static/bpmn/core_info/SponsorList.xls Normal file → Executable file
View File

0
crc/static/bpmn/core_info/core_info.bpmn Normal file → Executable file
View File

View File

View File

View File

0
crc/static/bpmn/data_security_plan/HIPAA_Ids.xls Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

0
crc/static/bpmn/enrollment_date/enrollment_date.bpmn Normal file → Executable file
View File

0
crc/static/bpmn/finance/finance.bpmn Normal file → Executable file
View File

0
crc/static/bpmn/hold/hold.bpmn Normal file → Executable file
View File

0
crc/static/bpmn/ide_supplement/SponsorList.xls Normal file → Executable file
View File

0
crc/static/bpmn/ide_supplement/decision_ide_check.dmn Normal file → Executable file
View File

0
crc/static/bpmn/ide_supplement/ide_update.bpmn Normal file → Executable file
View File

View File

View File

0
crc/static/bpmn/ids_full_submission/ivrs_iwrs_ixrs.dmn Normal file → Executable file
View File

View File

0
crc/static/bpmn/ids_waiver/ids_waiver.bpmn Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More