Skip to content

Flask based webservice to validate GP credentials and provide typeahead for diseases and medication

License

Notifications You must be signed in to change notification settings

raeslab/medical-ms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: CC BY-NC-SA 4.0

Medical Microservice

A microservice to provide typeahead and validation of medicine and disease names as well as general practitioner names and addresses.

When using on-line questionnaires to collect data, good practice is to make it as easy as possible for participants to complete the questionnairres correctly with little effort. Specifically when asking about medical history, free-text fields result in a lot of different terms describing the same disease (e.g. Irritable bowel syndrome & IBS) or drug (e.g. Panadol, Paracetamol & Acetaminophen) as well as miss spelled terms.

To avoid this we created this webservice that can be used to provide suggestions for drug names, diseases and autocomplete an address (e.g. from the general practitioner).

Furthermore, the webservice can also validate (as in, check if a record exists) input without providing a suggestion.

Installing the webservice

Clone the repository, create a virtual environment, install required python packages

git clone https://github.com/raeslab/medical-ms
cd medical-ms

python -m venv venv
source venv/bin/activate

pip install -r requirements.txt

Creating the database

Next a database needs to be created and populated with diseases, drug names and addresses. More details on the formats can be found here: file formats

The flag --drop-existing will remove existing data from the database. As imports are done ORM-free for speed, the index needs to be rebuilt once everything is added to the database using flask rebuild_index.

flask initdb

flask load_doctors --drop-existing --csv ./data/Phys_Visa_Nl.csv
flask load_drugs --drop-existing ./data/drugs.tab
flask load_diseases --drop-existing ./data/diseases/common_NL.txt 
flask load_diseases ./data/diseases/rare_NL.txt


flask rebuild_index

Running the webservice

You can start the webservice once there is some data in the database.

flask run

If everything worked, you should be able to find the demo page on http://localhost:5000/. Note that for putting this webservice into production it is not recommended to use the built-in server, but rather set it up behind e.g. NGINX. Instructions how to do this can be found here: https://flask.palletsprojects.com/en/1.1.x/deploying/

demo page screenshot

Data Sources

A list from all doctors in Belgium was obtained on 04/06/2025

About

Flask based webservice to validate GP credentials and provide typeahead for diseases and medication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published