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.
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
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
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/
A list from all doctors in Belgium was obtained on 04/06/2025
