This project is a FastAPI-based medical device recommender that suggests alternative medical devices based on their FDA classification.
✅ Search for a medical device by Product Code
✅ Find strong matches (same classification code)
✅ Find potential alternatives (same medical specialty)
✅ View grouped classification data
✅ Export results to CSV or PDF
✅ Web-based frontend using HTML, CSS, and jQuery
✅ API testing with Pytest
✅ Continuous Deployment using GitHub Actions
git clone https://github.com/YOUR_USERNAME/medical-device-recommender.git
cd medical-device-recommender python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows pip install -r requirements.txt uvicorn app.main:app --reload✅ The API will now be running at: http://127.0.0.1:8000
✅ API Docs available at: http://127.0.0.1:8000/docs
Run the following script to fetch medical device classifications and store them in SQLite:
python app/database.pyThis will:
- Create the SQLite database (
medical_devices.db) - Fetch classification data from the FDA API
- Store it in the database
This project includes unit tests using pytest. Run tests with:
pytest tests/
# or for verbose version
python -m pytest -v Tests include:
- Checking if the API is reachable
- Verifying device recommendations
- Handling edge cases (invalid product codes)
- Open your browser
- Go to: http://127.0.0.1:8000/static/index.html
- Enter a Product Code (e.g.,
KNY) - Click "Search" to see recommendations
- Click "Load Grouped Data" to view classification groups
- Export results as CSV or PDF
This project includes a CI/CD pipeline using GitHub Actions.
- Runs Tests on every push to
main - Deploys to the server after successful tests
Go to GitHub Repository → Settings → Secrets and Variables → Actions → New Repository Secret
Add the following secrets:
SSH_PRIVATE_KEY→ Your private SSH key for deploymentSERVER_IP→ Your server’s IP addressSERVER_USER→ Your server’s username
Push your code to GitHub:
git add .
git commit -m "New feature added"
git push origin mainThis will:
- Run tests automatically
- Deploy the app if tests pass
ssh user@your-server-ip git clone https://github.com/YOUR_USERNAME/medical-device-recommender.git
cd medical-device-recommender python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt uvicorn app.main:app --host 0.0.0.0 --port 8000 &✅ Your API is now live on your server!
If you want the API to run even after you close SSH, use pm2:
pip install pm2
pm2 start "uvicorn app.main:app --host 0.0.0.0 --port 8000" --name fastapi
pm2 save✅ Now, your API auto-restarts if the server reboots!
✅ Clone Repo → Install Dependencies → Run FastAPI 🚀
✅ Fetch Data → Use Web UI → Export Reports 📊
✅ Run Tests → Deploy Automatically with GitHub Actions 🔄
✅ Deploy to Server → Keep Running in Background 💡
- Found a bug? Open an issue on GitHub!
- Want to contribute? Fork & submit a PR ✨
📌 Made with ❤️ using FastAPI & openFDA API