# rishik2007-sudo/bioactive-ps-project architecture

> Architecture diagram of the GitHub repository rishik2007-sudo/bioactive-ps-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishik2007-sudo/bioactive-ps-project
- Repository: https://github.com/rishik2007-sudo/bioactive-ps-project

## Overview

This is a compound-catalog and bioactivity-prediction application: users submit a SMILES structure and receive an active/inactive COX-2 prediction with confidence and molecular descriptors; the API records prediction history. A catalog API supports browsing and editing compounds, categories, and health checks. The backend initializes its database and starter catalog at startup. The README describes a Streamlit deployment, but the tree instead contains a separate frontend; its runtime connection to the API is not shown, so that link is marked unverified.

Main entry points: [`Backend/app/database.py`](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/database.py) (SQL database access), [`Backend/app/api/v1/endpoints/predict.py`](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/predict.py) (Prediction endpoint), [`Backend/app/main.py`](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/main.py) (FastAPI application), [`Backend/app/api/v1/router.py`](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/router.py) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Web interface<br/>[script.js]"]
end

subgraph group_api["API orchestration"]
  node_app["FastAPI application<br/>[main.py]"]
  node_router["API router<br/>[router.py]"]
  node_health["Health endpoint<br/>[system.py]"]
  node_settings["Application settings<br/>[config.py]"]
end

subgraph group_prediction["Prediction workflow"]
  node_predict_api["Prediction endpoint<br/>[predict.py]"]
  node_prediction_service["Descriptor and prediction service<br/>[prediction.py]"]
  node_model_artifact["Trained XGBoost model<br/>[xgb_cox2.joblib]"]
  node_prediction_contracts["Prediction schemas"]
end

subgraph group_catalog["Catalog and persistence"]
  node_compound_api["Compound catalog endpoints<br/>[compounds.py]"]
  node_compound_contracts["Compound schemas<br/>[schemas.py]"]
  node_orm_models["Catalog and history models<br/>[models.py]"]
  node_database[("SQL database access<br/>[database.py]")]
  node_seed["Starter catalog seeding<br/>[seed.py]"]
end

node_user(("Molecule researcher"))

node_user -->|"enters SMILES"| node_frontend
node_frontend -.->|"uses API"| node_app
node_app -->|"mounts routes"| node_router
node_app -->|"initializes schema"| node_database
node_app -->|"seeds catalog"| node_seed
node_router -->|"registers route"| node_health
node_router -->|"registers routes"| node_compound_api
node_router -->|"registers route"| node_predict_api
node_health -->|"reads settings"| node_settings
node_database -->|"reads settings"| node_settings
node_predict_api -->|"requests prediction"| node_prediction_service
node_predict_api -->|"validates and returns"| node_prediction_contracts
node_prediction_service -->|"loads model"| node_model_artifact
node_predict_api -->|"records history"| node_orm_models
node_predict_api -->|"queries and writes"| node_database
node_compound_api -->|"validates responses"| node_compound_contracts
node_compound_api -->|"queries and edits"| node_orm_models
node_compound_api -->|"queries and writes"| node_database
node_seed -->|"creates compounds"| node_orm_models
node_seed -.->|"commits seed data"| node_database
node_orm_models -->|"maps tables"| node_database

click node_frontend "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Frontend/script.js"
click node_app "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/main.py"
click node_router "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/router.py"
click node_health "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/system.py"
click node_settings "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/config.py"
click node_predict_api "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/predict.py"
click node_prediction_service "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/services/prediction.py"
click node_model_artifact "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/models/xgb_cox2.joblib"
click node_prediction_contracts "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/schemas_prediction.py"
click node_compound_api "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/compounds.py"
click node_compound_contracts "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/schemas.py"
click node_orm_models "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/models.py"
click node_database "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/database.py"
click node_seed "https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/seed.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend toneBlue
class node_app,node_router,node_health,node_settings toneAmber
class node_predict_api,node_prediction_service,node_model_artifact,node_prediction_contracts toneMint
class node_compound_api,node_compound_contracts,node_orm_models,node_database,node_seed toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Frontend/script.js): `Frontend/script.js`

### API orchestration

- [FastAPI application](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/main.py): `Backend/app/main.py`
- [API router](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/router.py): `Backend/app/api/v1/router.py`
- [Health endpoint](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/system.py): `Backend/app/api/v1/endpoints/system.py`
- [Application settings](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/config.py): `Backend/app/config.py`

### Prediction workflow

- [Prediction endpoint](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/predict.py): `Backend/app/api/v1/endpoints/predict.py`
- [Descriptor and prediction service](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/services/prediction.py): `Backend/app/services/prediction.py`
- [Trained XGBoost model](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/models/xgb_cox2.joblib): `Backend/models/xgb_cox2.joblib`
- [Prediction schemas](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/schemas_prediction.py): `Backend/app/schemas_prediction.py`

### Catalog and persistence

- [Compound catalog endpoints](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/api/v1/endpoints/compounds.py): `Backend/app/api/v1/endpoints/compounds.py`
- [Compound schemas](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/schemas.py): `Backend/app/schemas.py`
- [Catalog and history models](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/models.py): `Backend/app/models.py`
- [SQL database access](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/database.py): `Backend/app/database.py`
- [Starter catalog seeding](https://github.com/rishik2007-sudo/bioactive-ps-project/blob/main/Backend/app/seed.py): `Backend/app/seed.py`

### Other components

- **Molecule researcher**

## Connections

- Molecule researcher → Web interface: enters SMILES (evidence: `README.md`)
- Web interface → FastAPI application: uses API
- FastAPI application → API router: mounts routes (evidence: `Backend/app/main.py`)
- FastAPI application → SQL database access: initializes schema (evidence: `Backend/app/main.py`)
- FastAPI application → Starter catalog seeding: seeds catalog (evidence: `Backend/app/main.py`)
- API router → Health endpoint: registers route (evidence: `Backend/app/api/v1/router.py`)
- API router → Compound catalog endpoints: registers routes (evidence: `Backend/app/api/v1/router.py`)
- API router → Prediction endpoint: registers route (evidence: `Backend/app/api/v1/router.py`)
- Health endpoint → Application settings: reads settings (evidence: `Backend/app/api/v1/endpoints/system.py`)
- SQL database access → Application settings: reads settings (evidence: `Backend/app/database.py`)
- Prediction endpoint → Descriptor and prediction service: requests prediction (evidence: `Backend/app/api/v1/endpoints/predict.py`)
- Prediction endpoint → Prediction schemas: validates and returns (evidence: `Backend/app/api/v1/endpoints/predict.py`)
- Descriptor and prediction service → Trained XGBoost model: loads model (evidence: `Backend/app/services/prediction.py`)
- Prediction endpoint → Catalog and history models: records history (evidence: `Backend/app/api/v1/endpoints/predict.py`)
- Prediction endpoint → SQL database access: queries and writes (evidence: `Backend/app/api/v1/endpoints/predict.py`)
- Compound catalog endpoints → Compound schemas: validates responses (evidence: `Backend/app/api/v1/endpoints/compounds.py`)
- Compound catalog endpoints → Catalog and history models: queries and edits (evidence: `Backend/app/api/v1/endpoints/compounds.py`)
- Compound catalog endpoints → SQL database access: queries and writes (evidence: `Backend/app/api/v1/endpoints/compounds.py`)
- Starter catalog seeding → Catalog and history models: creates compounds (evidence: `Backend/app/seed.py`)
- Starter catalog seeding → SQL database access: commits seed data
- Catalog and history models → SQL database access: maps tables (evidence: `Backend/app/models.py`)
