<commit_before>.. _howtocreatearegistry:
How To Create a Registry in Ten Minutes
=======================================

Modelling
---------

Do this first on pen and paper! 


* Gather requirements of the data fields ( :ref:`"CDEs" <cdes>` ) required:

  * For each data field required , decide its :ref:`datatype <cdedatatype>`
  * If a field is logically a :ref:`range <permittedvaluegroup>` , work out the allowed :ref:`permitted values <permittedvalue>`.
  * Depending on the :ref:`datatype <cdedatatype>`, decide any validation rules for a
    numeric (:ref:`integer <datatypeinteger>` or :ref:`float <datatypefloat>`) field max and/or min, 
    for a :ref:`string <datatypestring>` field, the maximum length or pattern. 
  * Decide if any :ref:`calculated fields <datatypecalculated>` are required.

* Split them into logical groups (:ref:`sections`). Decide whether a section might be multiple.

* Portion related sections into :ref:`forms`.
    * If a questionnaire is required for the registry, nominate a single form as a questionnaire.


Creation
--------

* Login as an admin and :ref:`navigate <navigation>` to "Registries" via the "Settings" button
* Create a :ref:`registry <registries>` object and give it a name and code 
* Create any :ref:`permitted value groups <permittedvaluegroup>` required ( adding
  any :ref:`permitted values <permittedvalue>` to the range.
* Create cdes ( one per data field ) - OR note an existing CDE that does the job (*IMPORTANT* deleting a cde
  may affect other registries which use this cde - in the current version there are no safeguards to prevent
  a used CDE from being deleted. Proceed with caution!)
* Create the section objects and enter the cde codes required into the elements field
  NB. This *MUST* be a comma-delimited list (E,g  "CDEName, CDEAge" - no quotes)
  
* Create forms and link them to the registry
* Add section codes to the sections field

That's it as far as registry definition goes. The RDRF database now contains the definition of the registry.
It is already usable by end users without any re-start - the defined forms are created entirely dynamically
when loaded from the :ref:`dashboard`.

Registry Use
------------
* To begin using the registry, login as a curator and assign patients to the registry.
* Patients can be added by navigating to the "Patient List" from the "Menu" button. Forms are then accessed for each Patient by clicking on "Modules".

Demo Site
---------<commit_msg>howtocreatearegistry.rst edited online with Bitbucket<commit_after>.. _howtocreatearegistry:
How To Create a Registry in Ten Minutes
=======================================


Modelling
---------
1. Do this first on pen and paper!
2. Gather requirements of the data fields ( :ref:`"DEs" <des>` ) required
3. For each data field required, decide its :ref:`datatype <datatype>`. If a field is logically a :ref:`range <permittedvaluegroup>`, 
   work out the allowed :ref:`permitted values <permittedvaluegroup>`. Depending on the :ref:`datatype <datatype>`, decide any validation rules 
   for a numeric or float data type (max and/or min), and for a string data type, 
   the maximum length or pattern. Decide if any Derived Data Elements (calculated data type) are required.
4. Split them into logical groups (:ref:`sections <registries>`). Decide whether a section might be multiple
5. Portion related sections into :ref:`forms <registries>`
6. If a questionnaire is required for the registry, nominate a single form as a questionnaire


Creation
--------
1. Login as an admin and :ref:`navigate <navigation>` to "Registries" via the "Settings" button
2. Create a :ref:`registry <registries>` object and give it a name and code 
3. Create any :ref:`permitted value groups <permittedvaluegroup>` required ( adding
  any :ref:`permitted values <permittedvalue>` to the range.
4. Create DEs (one per data field ) - OR note an existing DE that does the job (*IMPORTANT* deleting a DE
  may affect other registries which use this cde - in the current version there are no safeguards to prevent
  a used DE from being deleted. Proceed with caution!)
5. Create the section objects and enter the cde codes required into the elements field
  NB. This *MUST* be a comma-delimited list (E,g  "CDEName, CDEAge" - no quotes)
6. Create forms and link them to the registry
7. Add section codes to the sections field

That's it as far as registry definition goes. The RDRF database now contains the definition of the registry.
It is already usable by end users without any re-start - the defined forms are created entirely dynamically.

Registry Use
------------
* To begin using the registry, login as a curator and assign patients to the registry.
* Patients can be added by navigating to the "Patient List" from the "Menu" button. Forms are then accessed for each Patient by clicking on "Modules".

Demo Site
---------
{'fraction_non_alphanumeric': 0.1001025641025641, 'fraction_numerical': 0.0026666666666666666, 'mean_word_length': 4.1380400421496315, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3283183', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1260, 'n_words': 686}