https://github.com/gaoux/oct-diagnosis-backend
is a Django-based backend for an Optical Coherence Tomography (OCT) diagnostic system. It provides API endpoints for image processing, classification, and data management to assist ophthalmologists in diagnosing retinal conditions.
https://github.com/gaoux/oct-diagnosis-backend
django oct
Last synced: about 2 months ago
JSON representation
is a Django-based backend for an Optical Coherence Tomography (OCT) diagnostic system. It provides API endpoints for image processing, classification, and data management to assist ophthalmologists in diagnosing retinal conditions.
- Host: GitHub
- URL: https://github.com/gaoux/oct-diagnosis-backend
- Owner: Gaoux
- License: gpl-3.0
- Created: 2025-03-11T01:10:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-27T04:24:33.000Z (about 1 year ago)
- Last Synced: 2025-06-19T10:43:35.169Z (12 months ago)
- Topics: django, oct
- Language: Python
- Homepage:
- Size: 124 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฆ OCT-Diagnosis-Backend
## ๐ง Overview
OCT-Diagnosis-Backend is a Django-based backend for an Optical Coherence Tomography (OCT) diagnostic system. This backend provides RESTful API endpoints to handle image uploads, process medical images, and return AI-driven diagnostic insights.
## ๐ Related Repositories
- **Frontend (React + Vite)**
[https://github.com/Gaoux/OCTsense](https://github.com/Gaoux/OCTsense)
- **AI Model (Hugging Face โ OCT Classification)**
[https://huggingface.co/gaoux/OCT_class](https://huggingface.co/gaoux/OCT_class)
## โจ Features
- Image upload and preprocessing
- Deep learning model inference for classification
- User authentication and role-based access
- Database for storing diagnostic results
- API endpoints following RESTful architecture
## ๐ Installation & Development with Docker Compose
This project uses Docker Compose for development and deployment.
### ๐ณ What Docker Compose Does
- Sets up a Django backend (`web` service)
- Sets up a PostgreSQL database (`db` service)
- Links both containers via a shared network
- Mounts local project files into the container
- Exposes Django at [http://localhost:8000](http://localhost:8000)
### ๐ How to Set It Up
#### 1. Clone the Repository
```bash
git clone https://github.com/gaoux/OCT-diagnosis-backend.git
cd OCT-diagnosis-backend
```
#### 2. Create a `.env` file
You can copy the provided `.env.example`:
```bash
cp .env.example .env
```
Or manually create your own `.env` with the structure of the `env.example` file.
#### 3. Build the Docker Images
```bash
docker-compose build --no-cache
```
#### 4. Run the Project
```bash
docker-compose up
```
Django will be available at:
[http://localhost:8000](http://localhost:8000)
### ๐งน Clean Up (Remove Volumes and Containers)
To stop and clean the environment, including database volumes:
```bash
docker-compose down -v
```
> โ ๏ธ Warning: This will delete all PostgreSQL data.
---
## ๐ฆ Keeping Dependencies Up to Date
If you or any team member installs or modifies dependencies inside the environment, they must update the `requirements.txt` file with:
```bash
pip freeze | grep -vE ' @ file://|^-e|pywin32|win32|colorama|pypiwin32|tensorflow-intel' > requirements.txt
```
This ensures clean, cross-platform, Docker-friendly dependencies.
---
## ๐ Project Structure
- `docker-compose.yml`: Defines services for Django and PostgreSQL
- `requirements.txt`: pip dependencies
- `environment.yml`: Defines the Conda environment (only if working outside Docker)
- `manage.py`, `settings.py`: Django backend
- `.env`: Environment variables for DB and Django setup
---
## ๐ง AI Model Integration
The backend integrates a deep learning model to classify OCT (Optical Coherence Tomography) images into four diagnostic categories. This model is based on a Keras-compatible architecture (e.g., Xception), trained to assist in ophthalmological pre-diagnosis.
## ๐ฌ API Endpoints
### ๐ค User Endpoints
| Method | Endpoint | Description |
| ------ | ---------------------------- | ---------------------------- |
| POST | `/api/users/register/` | Register a new user |
| POST | `/api/users/login/` | Log in and obtain JWT token |
| POST | `/api/users/reset-password/` | Reset password using a token |
---
### ๐ก๏ธ Admin Endpoints
| Method | Endpoint | Description |
| ------ | ------------------------ | --------------------------------- |
| POST | `/api/users/register/` | Register a new user |
| GET | `/api/users/users/` | List all users |
| GET | `/api/users/users//` | Get user details |
| PATCH | `/api/users/users//` | Update user information |
| DELETE | `/api/users/users//` | Delete a user |
| POST | `/api/oct/upload-model/` | Upload or replace the `.h5` model |
---
### ๐ Report Endpoints
| Method | Endpoint | Description |
| ------ | -------------------------------- | --------------------------------------- |
| POST | `/api/reports/create/` | Create a new report |
| GET | `/api/reports/history/` | List reports for the authenticated user |
| GET | `/api/reports/` | List all reports (admin only) |
| GET | `/api/reports//` | Get report details |
| PATCH | `/api/reports//update/` | Update report comments |
| DELETE | `/api/reports//delete/` | Delete a report |
| GET | `/api/reports//image/` | Download image associated with a report |
| GET | `/api/reports/summary/` | Get summary of reports (statistics) |
---
### ๐ค AI Prediction Endpoint
| Method | Endpoint | Description |
| ------ | ------------------- | ------------------------------ |
| POST | `/api/oct/predict/` | Run prediction on an OCT image |
> **Note:** All endpoints (except login, register and reset-password) require JWT authentication.
---
## ๐ License
This project is licensed under the GPL-3.0 license.