https://github.com/azazh/expose-the-medical-wearhouse-data-using-fast-api
A high-performance FastAPI-based REST API for managing detection results using SQLAlchemy, PostgreSQL, and Pydantic. Features: ✅ FastAPI for asynchronous API ✅ SQLAlchemy ORM & PostgreSQL ✅ Pydantic for data validation 🚀 Get started by following the README.
https://github.com/azazh/expose-the-medical-wearhouse-data-using-fast-api
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.6%) to scientific vocabulary
Repository
A high-performance FastAPI-based REST API for managing detection results using SQLAlchemy, PostgreSQL, and Pydantic. Features: ✅ FastAPI for asynchronous API ✅ SQLAlchemy ORM & PostgreSQL ✅ Pydantic for data validation 🚀 Get started by following the README.
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
FastAPI Detection Results API
Overview
This project is a FastAPI-based web application for managing detection results. It provides RESTful API endpoints to create, retrieve, and delete detection results stored in a PostgreSQL database.
Features
- FastAPI framework for high-performance API development
- SQLAlchemy ORM for database interactions
- Pydantic for data validation and serialization
- PostgreSQL as the database backend
- Dependency injection for database sessions
- Exception handling for robustness
Project Structure
my_project/
├── main.py # Entry point for FastAPI application
├── database.py # Database configuration and connection
├── models.py # SQLAlchemy database models
├── schemas.py # Pydantic schemas for request and response validation
├── crud.py # CRUD operations for database interactions
├── requirements.txt # Project dependencies
└── README.md # Project documentation
Installation
Prerequisites
- Python 3.9+
- PostgreSQL installed and running
Step 1: Clone the Repository
sh
git clone https://github.com/Azazh/Expose-the-Medical-Wearhouse-Data-Using-Fast-API.git
cd Expose-the-Medical-Wearhouse-Data-Using-Fast-API
Step 2: Create a Virtual Environment
sh
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
Step 3: Install Dependencies
sh
pip install -r requirements.txt
Step 4: Configure Environment Variables
Create a .env file in the project root with the following content:
ini
DATABASE_URL=postgresql://postgres:yourpassword@localhost:5432/medical_dw
Step 5: Run Database Migrations (If Needed)
sh
python -c 'from database import Base, engine; Base.metadata.create_all(bind=engine)'
Step 6: Start the FastAPI Application
sh
uvicorn main:app --reload
The API will be accessible at: http://127.0.0.1:8000
API Endpoints
1. Create a Detection Result
http
POST /detection_results/
Request Body:
json
{
"image_path": "path/to/image.jpg",
"class_label": "object",
"confidence": 0.95,
"x_min": 10,
"y_min": 20,
"x_max": 50,
"y_max": 80
}
Response:
json
{
"id": 1,
"image_path": "path/to/image.jpg",
"class_label": "object",
"confidence": 0.95,
"x_min": 10,
"y_min": 20,
"x_max": 50,
"y_max": 80
}
2. Retrieve All Detection Results
http
GET /detection_results/
3. Retrieve a Detection Result by ID
http
GET /detection_results/{result_id}
4. Delete a Detection Result
http
DELETE /detection_results/{result_id}
Testing the API
You can use tools like Postman or cURL to test API endpoints.
Example using cURL:
sh
curl -X GET http://127.0.0.1:8000/detection_results/
License
This project is licensed under the MIT License.
Author
azazh(https://github.com/azazh)
Owner
- Login: Azazh
- Kind: user
- Repositories: 1
- Profile: https://github.com/Azazh
GitHub Events
Total
- Push event: 2
- Create event: 2
Last Year
- Push event: 2
- Create event: 2
Dependencies
- fastapi *
- psycopg2-binary *
- pydantic *
- sqlalchemy *
- uvicorn *