14.3.10. crate_anon.crateweb.config.constants

crate_anon/crateweb/config/constants.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/>.


Configuration constants for the CRATE web interface.

class crate_anon.crateweb.config.constants.ClinicalDatabaseType[source]

Possible source clinical database types that CRATE knows about, and can look up patient details for the consent-to-contact system.

class crate_anon.crateweb.config.constants.ResearchDbInfoKeys[source]

Keys for each dictionary within settings.RESEARCH_DB_INFO, representing a description of a research database that CRATE will provide a view on.

class crate_anon.crateweb.config.constants.UrlKeys[source]

Keys used in GET parameters as part of a query string: `...path?a=1&b=2, etc.

class crate_anon.crateweb.config.constants.UrlNames[source]

Strings used as Django names for CRATE views; see crate_anon.crateweb.config.urls.

We should use this lookup method throughout the Python code, e.g. for calls to reverse() and redirect().

We could also use them in the templates, rather than using hard-coded strings. We can do that via our common context, crate_anon.crateweb.core.context_processors.common_context(). However, the (runtime) failure message then becomes e.g.

Reverse for '' not found. '' is not a valid view function or pattern
name.

rather than the more informative

Reverse for 'ridlookup2' not found. 'ridlookup2' is not a valid view
function or pattern name.

… so probably best not to (there is also no PyCharm checking of the Django context).