14.3.108. crate_anon.crateweb.consent.views

crate_anon/crateweb/consent/views.py


Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).

This file is part of CRATE.

CRATE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CRATE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CRATE. If not, see <https://www.gnu.org/licenses/>.


Django views for the consent-to-contact system.

crate_anon.crateweb.consent.views.charity_report(request: HttpRequest) HttpResponse

Show a summary of charity payments (triggered in response to clinicians answering requests).

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.clinician_initiated_contact_request(request: HttpRequest) HttpResponse

For clinicians to request that their patient is contacted about a study.

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.clinician_pack(request: HttpRequest, clinician_response_id: str, token: str) HttpResponse

Shows a clinician “pack” as a PDF, including a letter from them to the patient, details of the study, forms for the patient to respond, etc.

Parameters:
crate_anon.crateweb.consent.views.clinician_response_view(request: HttpRequest, clinician_response_id: str) HttpResponse

Shows the response choices to the clinician. They’ll get here by clicking on a link in an e-mail.

REC DOCUMENTS 09, 11, 13 (B): Web form for clinicians to respond with.

Parameters:
crate_anon.crateweb.consent.views.decision_form_to_pt_re_study(request: HttpRequest, contact_request_id: str, viewtype: str) HttpResponse

Developer view: decision form to patient about a study.

Parameters:
crate_anon.crateweb.consent.views.download_privatestorage(request: HttpRequest, filename: str) HttpResponseBase

Download a file from the private storage area.

Superuser access function, used for admin interface only.

Parameters:
  • request – the django.http.request.HttpRequest

  • filename – filename within the private storage area

crate_anon.crateweb.consent.views.draft_approval_email(request: HttpRequest, contact_request_id: str) HttpResponse

Developer view: draft e-mail to researcher, giving permission.

Parameters:
crate_anon.crateweb.consent.views.draft_approval_letter(request: HttpRequest, contact_request_id: str, viewtype: str) HttpResponse

Developer view: draft letter to researcher, giving permission.

Parameters:
crate_anon.crateweb.consent.views.draft_clinician_email(request: HttpRequest, contact_request_id: str) HttpResponse

Developer view: draft e-mail to clinician.

Parameters:
crate_anon.crateweb.consent.views.draft_confirm_traffic_light_letter(request: HttpRequest, consent_mode_id: str, viewtype: str) HttpResponse

Developer view: draft letter to patient confirming traffic-light decision.

Parameters:
crate_anon.crateweb.consent.views.draft_first_traffic_light_letter(request: HttpRequest, patient_lookup_id: str, viewtype: str) HttpResponse

Developer view: draft first traffic-light letter to patient.

Parameters:
crate_anon.crateweb.consent.views.draft_letter_clinician_to_pt_re_study(request: HttpRequest, contact_request_id: str, viewtype: str) HttpResponse

Developer view: draft letter from clinician to patient, offering a study.

Parameters:
crate_anon.crateweb.consent.views.draft_researcher_cover_letter(request: HttpRequest, viewtype: str) HttpResponse

Developer view: decision form to patient about a study.

Parameters:
  • request – the django.http.request.HttpRequest

  • viewtype"pdf" or "html"

crate_anon.crateweb.consent.views.draft_traffic_light_decision_form(request: HttpRequest, patient_lookup_id: str, viewtype: str) HttpResponse

Developer view: draft traffic-light decision form.

Parameters:
crate_anon.crateweb.consent.views.draft_traffic_light_decision_form_generic(request: HttpRequest, viewtype: str) HttpResponse

Developer view: draft traffic-light decision form, in the generic version with no patient details.

Parameters:
  • request – the django.http.request.HttpRequest

  • viewtype"pdf" or "html"

crate_anon.crateweb.consent.views.draft_withdrawal_email(request: HttpRequest, contact_request_id: str) HttpResponse

Developer view: draft e-mail to researcher, withdrawing permission.

Parameters:
crate_anon.crateweb.consent.views.draft_withdrawal_letter(request: HttpRequest, contact_request_id: str, viewtype: str) HttpResponse

Developer view: draft letter to researcher, withdrawing permission.

Parameters:
crate_anon.crateweb.consent.views.exclusion_report(request: HttpRequest) HttpResponse

Show NHS numbers of patients to exclude from the anonymised database entirely.

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.finalize_clinician_response_in_background(request: HttpRequest, clinician_response: ClinicianResponse) HttpResponse

Submits a background processing job to complete processing a clinician’s response, and return a short thank-you response to the clinician.

Parameters:
crate_anon.crateweb.consent.views.generate_random_nhs(request: HttpRequest, n: str = 10) HttpResponse

Display random NHS numbers to the requestor.

Parameters:
  • request – the django.http.request.HttpRequest

  • n – how many random NHS numbers to generate?

Return the specified consent mode.

Parameters:
  • request – the django.http.request.HttpRequest

  • consent_mode_id – PK

Returns:

crate_anon.crateweb.consent.models.ConsentMode

Raises:

django.http.Http404

crate_anon.crateweb.consent.views.get_contact_request(request: HttpRequest, contact_request_id: str) ContactRequest

Return the specified contact request.

Parameters:
  • request – the django.http.request.HttpRequest

  • contact_request_id – PK

Returns:

crate_anon.crateweb.consent.models.ContactRequest

Raises:

django.http.Http404

crate_anon.crateweb.consent.views.get_patient_lookup(request: HttpRequest, patient_lookup_id: str) PatientLookup

Return the specified patient lookup.

Parameters:
  • request – the django.http.request.HttpRequest

  • patient_lookup_id – PK

Returns:

crate_anon.crateweb.consent.models.PatientLookup

Raises:

django.http.Http404

crate_anon.crateweb.consent.views.study_details(request: HttpRequest, study_id: str) HttpResponseBase

View details of a study.

Parameters:
crate_anon.crateweb.consent.views.study_form(request: HttpRequest, study_id: str) HttpResponseBase

For a study, view the PDF form that researchers would like clinicians to complete.

Parameters:
crate_anon.crateweb.consent.views.study_pack(request: HttpRequest, study_id: str) HttpResponseBase

View a PDF “pack” for a study, including the study details and its additional form for clinicians, if provided.

Parameters:
crate_anon.crateweb.consent.views.submit_contact_request(request: HttpRequest) HttpResponse

Submits a contact request for a study, potentially for multiple patients.

Parameters:

request – the django.http.request.HttpRequest

Looks up a patient’s consent mode and shows the results without saving the lookup.

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.test_email_rdbm(request: HttpRequest) HttpResponse

Tests the backend system (Celery etc.) by sending an e-mail to the RDBM.

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.test_patient_lookup(request: HttpRequest) HttpResponse

Looks up a patient’s details and shows the results without saving the lookup.

Parameters:

request – the django.http.request.HttpRequest

crate_anon.crateweb.consent.views.validate_email_request(user: auth.User, email: Email) None

Checks that the current user has permission to view the specified e-mail.

Args:class

user: current Django user object email: crate_anon.crateweb.consent.models.Email

Raises:

django.core.exceptions.PermissionDenied

crate_anon.crateweb.consent.views.validate_letter_request(user: auth.User, letter: Letter) None

Checks that the current user has permission to view the specified letter.

Parameters:
Raises:

django.core.exceptions.PermissionDenied

crate_anon.crateweb.consent.views.view_email_attachment(request: HttpRequest, attachment_id: str) HttpResponseBase

View the HTML for an e-mail.

Parameters:
Raises:

django.http.Http404

crate_anon.crateweb.consent.views.view_email_html(request: HttpRequest, email_id: str) HttpResponse

View the HTML for an e-mail.

Parameters:
Raises:

django.http.Http404

crate_anon.crateweb.consent.views.view_leaflet(request: HttpRequest, leaflet_name: str) HttpResponseBase

Views a system-wide leaflet.

Parameters:
crate_anon.crateweb.consent.views.view_letter(request: HttpRequest, letter_id: str) HttpResponseBase

View a letter (as a PDF).

Parameters:
Raises:

django.http.Http404