The OncoAI Survival Prediction API is a web service designed to predict patient survival rates in oncology using machine learning models. This API provides endpoints for user authentication, survival prediction, and health checks.
- User Authentication: Secure user registration and login using JWT tokens.
- Survival Prediction: Predict patient survival rates based on input features.
- Health Checks: Verify the status of the API, database connection, and model loading.
The project is structured as follows:
app/: Contains the main application code.main.py: The entry point of the application.api/: Contains the API endpoints.auth.py: Authentication-related API endpoints.survival.py: Survival analysis-related API endpoints.
core/: Contains core application logic.config.py: Configuration settings.model.py: Data models.security.py: Security-related functions.utils.py: Utility functions.models/: Contains additional data models.
db/: Contains database-related code.crud.py: CRUD operations.models.py: Database models.session.py: Database session management.
schemas/: Contains Pydantic schemas.auth.py: Authentication-related schemas.survival.py: Survival analysis-related schemas.
entorno/: Contains environment-related files.static/: Contains static files.neon-app.js: JavaScript file for the Neon app.neon-dark.css: CSS file for the Neon app.oncoai-dashboard.html: HTML file for the OncoAI dashboard.
test.db: SQLite database file.
The application uses the following dependencies:
- FastAPI: A modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
- SQLAlchemy: The Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.
- Pydantic: Data validation and settings management using Python type annotations.
- Uvicorn: An ASGI server for serving FastAPI applications.
- Passlib: Password hashing library for Python.
- PyJWT: JSON Web Token implementation in Python.
- Python-dotenv: Reads key-value pairs from a .env file and sets them as environment variables.
To set up the application, follow these steps:
- Create a virtual environment and activate it.
- Install the dependencies using
pip install -r requirements.txt. - Create a
.envfile with the necessary environment variables. - Run the application using
uvicorn app.main:app --reload.
To run the tests, use the following command:
pytestPOST /auth/register: Register a new user.POST /auth/login: Log in an existing user.POST /token: Obtain an access token for authentication.
POST /api/predict: Predict patient survival rates based on input features.
GET /health: Verify the status of the API, database connection, and model loading.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License.