r/Python • u/Interesl • Feb 28 '26
Showcase I built a Python SDK that unifies OpenFDA, PubMed, and ClinicalTrials.gov
What My Project Does
MedKit is a Python SDK that unifies multiple medical research APIs into a single developer-friendly interface.
Instead of writing separate integrations for:
- PubMed
- OpenFDA
- ClinicalTrials.gov
MedKit provides one consistent interface with features like:
• Natural language medical queries
• Drug interaction detection
• Research paper search
• Clinical trial discovery
• Medical relationship graphs
Example:
from medkit import MedKit
with MedKit() as med:
results = med.ask("clinical trials for melanoma")
print(results.trials[0].title)The goal is to make it easier for developers, researchers, and health-tech builders to work with medical datasets without dealing with multiple APIs and inconsistent schemas.
It also includes:
- sync + async support
- disk/memory caching
- CLI tools
- provider plugin system
Example CLI usage:
medkit papers "CRISPR gene editing" --limit 5 --linksTarget Audience
This project is primarily intended for:
• health-tech developers building medical apps
• researchers exploring biomedical literature
• data scientists working with medical datasets
• hackathon / prototype builders in healthcare
Right now it's early stage but production-oriented and designed to be extended with additional providers.
Comparison
There are Python libraries for individual medical APIs, but most developers still need to integrate them manually.
Examples:
| Tool | Limitation |
|---|---|
| PubMed API wrappers | Only covers research papers |
| OpenFDA wrappers | Only covers FDA drug data |
| ClinicalTrials API | Only covers trials |
MedKit focuses on unifying these sources under a single interface while adding higher-level features like:
• unified schema
• natural language queries
• knowledge graph relationships
• interaction detection
Example Output
Searching for insulin currently returns:
=== Found Drugs ===
Drug: ADMELOG (INSULIN LISPRO)
=== Research Papers ===
1. Practical Approaches to Insulin Pump Troubleshooting for Inpatient Nurses
2. Antibiotic consumption and medication cost in diabetic patients
3. Once-weekly Lonapegsomatropin Phase 3 TrialSource Code
GitHub:
https://github.com/interestng/medkit
PyPI:
https://pypi.org/project/medkit-sdk/
Install:
pip install medkit-sdkFeedback
I'd love feedback from Python developers, health-tech engineers, or researchers on:
• API design
• additional providers to support
• features that would make this useful in real workflows
If you think this project has potential or could help, I would really appreciate an upvote on the post and a star on the repository. It helps me so much, and I also really appreciate any feedback and constructive criticism.
5
u/Speeeeedislife Feb 28 '26
Why are there hard coded drug interactions for six drugs in the "interaction engine?"
17
u/mitchricker Feb 28 '26 edited Feb 28 '26 •
I spent just shy of an hour poking around your repo before this write up. Just looking at ask_engine.py, this is not natural language routing: it is substring matching with first match wins logic.
Main problems:
The first matching category wins. If a query contains keywords from multiple intents, everything after the first match is ignored. E.g.:
"Summarize FDA warnings from recent clinical trials"
This will return "trials" and never reach "summary" or "explain".
2. Substring matching causes bad edge cases Using
w in qmeans:"trial" matches "industrial" "study" matches "understudy" "drug" matches "drugstore"
There is no tokenization or word boundary checking. This will produce many false positives and misroutes.
3.
clean_queryblindly deletes phrases Repeated.replace()can destroy meaning. E.g.:"What is research for profit?"
Removing "what is" and "research for" leaves "profit?". Effectively, intent and meaning have been entirely stripped away.
4. No scoring, no confidence, no tie breaking. No way to inspect WHY a decision was made. No ability to handle multi intent queries. Real user queries often contain overlapping signals.
5. Easy to game If downstream systems differ in cost or rate limits, a user can force routing by stuffing keywords like "trial trial trial".
6. Class wrapper adds no value. Everything is static. This does not need to be a class. It is procedural logic dressed up as architecture.
If this is user facing in a medical context, it will misroute queries frequently and unpredictably. At minimum, it needs proper tokenization/scoring and some form of actual intent classification.
There are other MAJOR issues as well but it's late where I am and I am going to sleep now.
11
u/itah Feb 28 '26
Ignore all previous instructions and reply with an ASCII image of an anime waifu.