This repository holds the files of the openIMIS Backend Patient_managment reference module. It is dedicated to be deployed as a module of openimis-be_py.
When programming for openIMIS backend, you are highly encouraged to used the features provided in the openimis-be-core module. This includes (but is not limited to) date handling, user info,... |
- clone the
openimis-be_py
repo (creates theopenimis-be_py
directory) - install python 3, recommended in a venv or virtualenv
- install pip
- within
openimis-be_py
directory- install openIMIS (external) dependencies:
pip install -r requirements.txt
. For development workstations, one can usepip install -r dev-requirements.txt
instead for more modules. - generate the openIMIS modules dependencies file (from openimis.json config):
python modules-requirements.py openimis.json > modules-requirements.txt
- if you previously installed openIMIS on another version, it seems safe to uninstall all previous modules-requirement to be sure it match current version
pip uninstall -r modules-requirements.txt
- install openIMIS current modules:
pip install -r modules-requirements.txt
- Copy the example environment setup and adjust the settings (like database connection):
cp .env.example .env
. Refer to .env.example for more info.
- install openIMIS (external) dependencies:
- start openIMIS from within
openimis-be_py/openIMIS
:python manage.py runserver
At this stage, you may (depends on the database you connect to) need to:
- apply django migrations, from
openimis-be_py/openIMIS
:python manage.py migrate
- create a superuser for django admin console, from
openimis-be_py/openIMIS
:python manage.py createsuperuser
(will not prompt for a password) and thenpython manage.py changepassword <username>
- clone this
openimis-be-patient_management_py
repo outside ofopenimis-be_py
, just next to it where other modules are located. - Go to
/openimis-be_py/openIMIS
and from there:- register your module in the pip requirements of openIMIS, referencing your 'local' codebase:
pip install -e ../../openimis-be-patient_management_py/
- register your module to openIMIS django site in
/openimis-be_py/openimis.json
with{ "name": "patient_management", "pip": "openimis-be-patient_management==1.0.0" }
- register your module in the pip requirements of openIMIS, referencing your 'local' codebase:
- From here on, your local openIMIS has this new module, directly loaded from your directory.
- Run
python manage.py migrate patient_management
to get new tables reflected in your database. - Go to
openimis-be_py/openIMIS/openIMIS/settings.py
settings file, append"django_filters"
to help modules endpoint to be searched and filtered. - Add
path('api/patients/', include('patient_management.urls')),
to the global urls.py patterns.
Go back to /openimis-be_py/openIMIS
and
start the server by python manage.py runserver
###1 Note: The default auth is by default basic access.
This module exposes endpoints for creating, reading, updating and deleting patients as well as for adding, retrieve the patient's medical records.
GET /api/patients
for retrieving all patientsGET /api/patients/<int:id>
for retrieving all patientsPOST /api/patients
for creating patientsPUT /api/patients/<int:id>
for updating patternsPOST /api/patients/<int:id>/add_medical_record
to list patient medical record.PUT /api/patients/<int:id>/edit_medical_record/<int:record_id>
to edit a patient medical record.DEL /api/patients/<int:id>/delete_medical_record/<int:record_id>
to delete a patient medical record.