dashboard.blueprints.redcap package¶
Module contents¶
- dashboard.blueprints.redcap.register_bp(app)¶
Submodules¶
dashboard.blueprints.redcap.emails module¶
Email functions used by the redcap blueprint.
- dashboard.blueprints.redcap.emails.missing_session_data(session, study=None, dest_emails=None)¶
dashboard.blueprints.redcap.monitors module¶
Monitors used by the redcap blueprint.
Any scheduler jobs that the redcap blueprint needs will require a monitor function and a check function here. See dashboard.monitors for more information on monitors and check functions.
- dashboard.blueprints.redcap.monitors.check_scans(name, num, recipients=None)¶
Sends an email if the given session does not have data.
- Parameters:
name (
str
) – The session namenum (int) – The repeat number
recipients (
list
ofstr
, optional) – A list of email addresses to contact if no data exists. If not set, dashboard admins will receive the notification.
- Raises:
dashboard.exceptions.MonitorException – If a matching session can’t be found.
- dashboard.blueprints.redcap.monitors.download_session(name, num, end_time)¶
- dashboard.blueprints.redcap.monitors.monitor_scan_download(session, end_time=None)¶
Add a job to download a session.
Note: This one directly downloads a subject while monitor_scan_import just notifies users if download doesnt occur within a time window.
- Parameters:
session (
dashboard.models.Session
) – The session to download.end_time (
datetime.datetime
) – The date and time for when to stop download attempts. If not set, attempts will stop two days from the first time the function is called. Defaults to None.
- Raises:
dashboard.exceptions.MonitorException – if a
dashboard.models.Session
object is not given for session or adatetime.datetime
object is not given for end_time, if end_time is provided.dashboard.exceptions.SchedulerException – if a job to retry download can’t be added to the scheduler server.
- dashboard.blueprints.redcap.monitors.monitor_scan_import(session, users=None)¶
Add a scheduler job to track whether a session’s data is imported.
This creates a scheduler job that will run
check_scans
two days after job submission.- Parameters:
session (
dashboard.models.Session
) – The session to track
- :param users (
list
ofdashboard.models.User
or:dashboard.models.User
, optional): The user(s) to email. If none are provided, dashboard admins will be emailed.
- Raises:
dashboard.exceptions.MonitorException – if a
dashboard.models.Session
object is not given, or users can’t be found to send the notification to, or none of the found users have an email defined.dashboard.exceptions.SchedulerException – if the job can’t be added to the server.
dashboard.blueprints.redcap.utils module¶
- dashboard.blueprints.redcap.utils.create_from_request(request)¶
- dashboard.blueprints.redcap.utils.find_study(ident)¶
- dashboard.blueprints.redcap.utils.get_redcap_record(record_id, fail_url=None)¶
- dashboard.blueprints.redcap.utils.get_timepoint(ident)¶
- dashboard.blueprints.redcap.utils.set_session(name)¶
dashboard.blueprints.redcap.views module¶
- dashboard.blueprints.redcap.views.redcap()¶
URL endpoint to receive redcap data entry triggers.
A redcap server can send a notification to this URL when a survey is saved and the record will be retrieved and saved to the database.
- dashboard.blueprints.redcap.views.redcap_redirect(record_id)¶
Used to provide a link from the session page to a redcap session complete record on the redcap server itself.