Skip to content

Commit

Permalink
feat: year 2 dashboard updates
Browse files Browse the repository at this point in the history
  • Loading branch information
greenstick committed Nov 7, 2024
1 parent 8d98dae commit f37a654
Show file tree
Hide file tree
Showing 7 changed files with 372 additions and 165 deletions.
4 changes: 2 additions & 2 deletions apis/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def get(self, study_id: str, dashboard_id: str):
if not is_granted("view", study):
return "Access denied, you can not view this dashboard", 403

# Retrieve Dashboard Redis Cache if Available
# # Retrieve Dashboard Redis Cache if Available
# cached_redcap_project_dashboard = caching.cache.get(
# f"$study_id#{study_id}$dashboard_id#{dashboard_id}"
# )
Expand Down Expand Up @@ -657,7 +657,7 @@ def get(self, study_id: str):
# Public Dashboard ID
dashboard_id = redcap_project_dashboard["id"]

# Retrieve Dashboard Redis Cache if Available
# # Retrieve Dashboard Redis Cache if Available
# cached_redcap_project_dashboard = caching.cache.get(
# f"$study_id#{study_id}$dashboard_id#{dashboard_id}#public"
# )
Expand Down
83 changes: 0 additions & 83 deletions apis/redcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,86 +247,3 @@ def delete(self, study_id: str, redcap_id: str):
model.db.session.commit()
return 204


# @api.route("/study/<study_id>/redcap")
# class EditRedcapProjectAPI(Resource):
# @api.doc(parser=project_parser)
# @api.response(200, "Success")
# @api.response(400, "Validation Error")
# @api.marshal_with(redcap_project_api_view_model)
# def put(self, study_id: int):
# """Update REDCap project API link"""
# study = model.Study.query.get(study_id)
# if not is_granted("update_redcap", study):
# return "Access denied, you can not modify this redcap project", 403
# # Schema validation
# data: Union[Any, dict] = request.json
# schema = {
# "type": "object",
# "additionalProperties": False,
# "required": [
# "api_pid",
# "title",
# "api_url",
# "api_active",
# ],
# "properties": {
# "api_pid": {"type": "string", "minLength": 1, "maxLength": 12},
# "title": {"type": "string", "minLength": 1},
# "api_url": {"type": "string", "minLength": 1},
# "api_active": {"type": "boolean"},
# },
# }
# try:
# validate(request.json, schema)
# except ValidationError as e:
# return e.message, 400

# if len(data["api_pid"]) < 1:
# return (
# f"""redcap api_pid is required for redcap access:
# {data['api_pid']}""",
# 400,
# )
# if len(data["title"]) < 1:
# return (
# f"""redcap title is required for redcap access:
# {data['title']}""",
# 400,
# )
# if len(data["api_url"]) < 1:
# return (
# f"""redcap api_url is required for redcap access:
# {data['api_url']}""",
# 400,
# )
# if not isinstance(data["api_active"], bool):
# return (
# f"""redcap api_active is required for redcap access:
# {data['api_active']}""",
# 400,
# )
# update_redcap_project_view = model.StudyRedcap.query.get(
# data["api_pid"]
# )
# update_redcap_project_view.update(data)
# model.db.session.commit()
# update_redcap_project_view = update_redcap_project_view.to_dict()
# return update_redcap_project_view, 201


# @api.route("/study/<study_id>/redcap")
# class DeleteRedcapProjectAPI(Resource):
# @api.doc(parser=project_parser)
# @api.response(200, "Success")
# @api.response(400, "Validation Error")
# @api.marshal_with(redcap_project_api_view_model)
# def delete(self, study_id: int):
# """Delete REDCap project API link"""
# study = model.Study.query.get(study_id)
# if not is_granted("delete_redcap", study):
# return "Access denied, you can not delete this redcap project", 403
# api_pid = project_parser.parse_args()["api_pid"]
# model.StudyRedcap.query.filter_by(api_pid=api_pid).delete()
# model.db.session.commit()
# return 204
Loading

0 comments on commit f37a654

Please sign in to comment.