14.3.104. 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: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, clinician_response_id: str, token: str) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, clinician_response_id: str) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, contact_request_id: str, viewtype: str) django.http.response.HttpResponse[source]

Developer view: decision form to patient about a study.

Parameters
crate_anon.crateweb.consent.views.download_privatestorage(request: django.http.request.HttpRequest, filename: str) django.http.response.HttpResponseBase[source]

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: django.http.request.HttpRequest, contact_request_id: str) django.http.response.HttpResponse[source]

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

Parameters
crate_anon.crateweb.consent.views.draft_approval_letter(request: django.http.request.HttpRequest, contact_request_id: str, viewtype: str) django.http.response.HttpResponse[source]

Developer view: draft letter to researcher, giving permission.

Parameters
crate_anon.crateweb.consent.views.draft_clinician_email(request: django.http.request.HttpRequest, contact_request_id: str) django.http.response.HttpResponse[source]

Developer view: draft e-mail to clinician.

Parameters
crate_anon.crateweb.consent.views.draft_confirm_traffic_light_letter(request: django.http.request.HttpRequest, consent_mode_id: str, viewtype: str) django.http.response.HttpResponse[source]

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

Parameters
crate_anon.crateweb.consent.views.draft_first_traffic_light_letter(request: django.http.request.HttpRequest, patient_lookup_id: str, viewtype: str) django.http.response.HttpResponse[source]

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

Parameters
crate_anon.crateweb.consent.views.draft_letter_clinician_to_pt_re_study(request: django.http.request.HttpRequest, contact_request_id: str, viewtype: str) django.http.response.HttpResponse[source]

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

Parameters
crate_anon.crateweb.consent.views.draft_researcher_cover_letter(request: django.http.request.HttpRequest, viewtype: str) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, patient_lookup_id: str, viewtype: str) django.http.response.HttpResponse[source]

Developer view: draft traffic-light decision form.

Parameters
crate_anon.crateweb.consent.views.draft_traffic_light_decision_form_generic(request: django.http.request.HttpRequest, viewtype: str) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, contact_request_id: str) django.http.response.HttpResponse[source]

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

Parameters
crate_anon.crateweb.consent.views.draft_withdrawal_letter(request: django.http.request.HttpRequest, contact_request_id: str, viewtype: str) django.http.response.HttpResponse[source]

Developer view: draft letter to researcher, withdrawing permission.

Parameters
crate_anon.crateweb.consent.views.exclusion_report(request: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, clinician_response: crate_anon.crateweb.consent.models.ClinicianResponse) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, n: str = 10) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest, contact_request_id: str) crate_anon.crateweb.consent.models.ContactRequest[source]

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: django.http.request.HttpRequest, patient_lookup_id: str) crate_anon.crateweb.consent.models.PatientLookup[source]

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: django.http.request.HttpRequest, study_id: str) django.http.response.HttpResponseBase[source]

View details of a study.

Parameters
crate_anon.crateweb.consent.views.study_form(request: django.http.request.HttpRequest, study_id: str) django.http.response.HttpResponseBase[source]

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

Parameters
crate_anon.crateweb.consent.views.study_pack(request: django.http.request.HttpRequest, study_id: str) django.http.response.HttpResponseBase[source]

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: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: django.http.request.HttpRequest) django.http.response.HttpResponse[source]

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: crate_anon.crateweb.consent.models.Email) None[source]

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: crate_anon.crateweb.consent.models.Letter) None[source]

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: django.http.request.HttpRequest, attachment_id: str) django.http.response.HttpResponseBase[source]

View the HTML for an e-mail.

Parameters
Raises

django.http.Http404

crate_anon.crateweb.consent.views.view_email_html(request: django.http.request.HttpRequest, email_id: str) django.http.response.HttpResponse[source]

View the HTML for an e-mail.

Parameters
Raises

django.http.Http404

crate_anon.crateweb.consent.views.view_leaflet(request: django.http.request.HttpRequest, leaflet_name: str) django.http.response.HttpResponseBase[source]

Views a system-wide leaflet.

Parameters
crate_anon.crateweb.consent.views.view_letter(request: django.http.request.HttpRequest, letter_id: str) django.http.response.HttpResponseBase[source]

View a letter (as a PDF).

Parameters
Raises

django.http.Http404