9.11. Developer functions

Additional testing functions are provided for those superusers who have the “developer” flag set. They allow breaking of the usual restrictions on the RDBM, and should be used for authorized testing (generally on systems with fictional data) only.

9.11.1. Developer admin site

This Django admin site allows you full control over all models used by the site. In addition to the objects managed by the RDBM admin site, this includes:

Some additional permissions are also added for the other models.

The developer views are those ending in DevAdmin within crate_anon.crateweb.core.admin.

9.11.2. Generate random NHS numbers for testing

Self-explanatory. All are completely random (so there is a risk of generating a real one!) and pass the NHS number checksum system.

9.11.3. Test patient lookup without saving data

This function takes an NHS number and looks up (identifiable) patient details without saving anything. Use it to test the identity lookup system.

9.11.5. Test templates

This section offers all the templates used by the consent-to-contact system (most in HTML and PDF versions), using a specific fictional patient, study, researcher, and clinician (ID number -1).

The templates vary by patient age, consent mode, and so on. You can therefore view variants by altering the default URLs to use these URL query parameters:

  • age=<age_years>
  • age_months=<age_months>
  • consent_mode=<value>; for the consent mode, specify red, yellow, green, or anything else for None
  • request_direct_approach=<value> (use 0 or 1)
  • consent_after_discharge=<value> (use 0 or 1)

An example is therefore ?age=40;age_months=2;consent_mode=yellow;request_direct_approach=1;consent_after_discharge=0.

The fictional patient’s DOB is synthesized from the age you specify and today’s date.

See crate_anon.crateweb.consent.models.make_dummy_objects() for defaults.