Opal Management Commands
Opal ships with a number of Django management commands which can be invoked with
python manage.py command.
Creates patients with randomised data.
--number- The number of patients to create. Defaults to 100.
python manage.py create_random_data --number 3000
Creates any subrecord singletons which are missing. This is useful when creating a new singleton subrecord to backfill existing patients or episodes.
Will not create anything if singletons exist, so safe to be run as part of e.g. a deployment script.
python manage.py create_singletons
Deletes all instances of lookuplist and synonym entries.
python manage.py delete_all_lookuplists
Examines patients in the system and looks for possible duplicates. Prints a report of patients with matching names, dates of birth or hospital numbers.
python manage.py detect_duplicates
--many-files- write lookuplists to separate files instead of printing them to stdout.
Prints current lookuplist and synonym values as JSON to stdout. Suitable to be used
as the input to
python manage.py dump_lookup_lists
Load lookuplists and synonym values.
--file- Load one specific file only.
By default this command will look in
./yourapp/data/lookuplists.json as well as in
./yourapp/data/ for any files with a name matching the API name of a lookuplist
python manage.py load_lookup_lists
Run the development server.
By default this will start a web server on
localhost:8000. Users may specify either
a port or an addr port pair to change this.
opal serve # server on localhost:8000
opal serve 7798 # server on localhost:7798
opal serve 0.0.0.0:8080 # server on 0.0.0.0:8080
Use with new record models.
Creates and runs automatic migrations, creates display and form (modal) templates.
--dry-run will run makemigrations with
--dry-run and print display
and form templates that would be generated.