# parthchhabra-wq/crispr_platform architecture

> Architecture diagram of the GitHub repository parthchhabra-wq/crispr_platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/parthchhabra-wq/crispr_platform
- Repository: https://github.com/parthchhabra-wq/crispr_platform

## Overview

This is a FastAPI CRISPR guide RNA designer. Its principal workflow accepts and validates a DNA sequence, extracts SpCas9 guide candidates on both strands, scans a synthetic reference genome for near matches, scores and ranks candidates, then returns ranked guides and an explanation. Separate API capabilities expose genome metadata and health status. The shown sources establish the backend calls; the frontend contains only an index file in the supplied tree, so its behavior and connections cannot be determined.

Main entry points: [`backend/main.py`](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/main.py) (FastAPI endpoints), [`backend/services/off_target_analysis.py`](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/off_target_analysis.py) (Off-target scan), [`backend/services/scoring.py`](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/scoring.py) (Scoring and ranking), [`backend/models/schemas.py`](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py) (Guide candidate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_api["FastAPI endpoints<br/>[main.py]"]
end

subgraph group_design["Guide design"]
  node_guide["Guide extraction"]
end

subgraph group_analysis["Specificity analysis"]
  node_offtarget["Off-target scan"]
  node_genome["Synthetic genome"]
  node_scoring["Scoring and ranking<br/>[scoring.py]"]
end

subgraph group_contracts["Data contracts"]
  node_request["Request validation<br/>[schemas.py]"]
  node_candidate["Guide candidate<br/>[schemas.py]"]
  node_response["Response models<br/>[schemas.py]"]
end

node_user(("API client"))
node_frontend["Frontend shell<br/>[index.html]"]

node_user -->|"submits request"| node_api
node_api -->|"validates via"| node_request
node_api -->|"extracts guides"| node_guide
node_guide -->|"creates candidates"| node_candidate
node_api -->|"annotates candidates"| node_offtarget
node_offtarget -->|"reads genome"| node_genome
node_offtarget -->|"updates hit counts"| node_candidate
node_api -->|"ranks candidates"| node_scoring
node_scoring -->|"reads candidate fields"| node_candidate
node_api -->|"builds best explanation"| node_scoring
node_api -->|"returns typed response"| node_response
node_api -->|"gets metadata"| node_genome

click node_api "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/main.py"
click node_request "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py"
click node_guide "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/sequence_generator.py"
click node_candidate "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py"
click node_offtarget "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/off_target_analysis.py"
click node_genome "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/genome_simulator.py"
click node_scoring "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/scoring.py"
click node_response "https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py"
click node_frontend "https://github.com/parthchhabra-wq/crispr_platform/blob/main/frontend/index.html"

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_api,node_user,node_frontend toneBlue
class node_guide toneAmber
class node_offtarget,node_genome,node_scoring toneMint
class node_request,node_candidate,node_response toneRose
```

## Components

### API boundary

- [FastAPI endpoints](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/main.py): `backend/main.py`

### Guide design

- [Guide extraction](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/sequence_generator.py): `backend/services/sequence_generator.py`

### Specificity analysis

- [Off-target scan](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/off_target_analysis.py): `backend/services/off_target_analysis.py`
- [Synthetic genome](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/genome_simulator.py): `backend/services/genome_simulator.py`
- [Scoring and ranking](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/services/scoring.py): `backend/services/scoring.py`

### Data contracts

- [Request validation](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py): `backend/models/schemas.py`
- [Guide candidate](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py): `backend/models/schemas.py`
- [Response models](https://github.com/parthchhabra-wq/crispr_platform/blob/main/backend/models/schemas.py): `backend/models/schemas.py`

### Other components

- **API client**
- [Frontend shell](https://github.com/parthchhabra-wq/crispr_platform/blob/main/frontend/index.html): `frontend/index.html`

## Connections

- API client → FastAPI endpoints: submits request (evidence: `backend/main.py`)
- FastAPI endpoints → Request validation: validates via (evidence: `backend/main.py`)
- FastAPI endpoints → Guide extraction: extracts guides (evidence: `backend/main.py`)
- Guide extraction → Guide candidate: creates candidates (evidence: `backend/services/sequence_generator.py`)
- FastAPI endpoints → Off-target scan: annotates candidates (evidence: `backend/main.py`)
- Off-target scan → Synthetic genome: reads genome (evidence: `backend/services/off_target_analysis.py`)
- Off-target scan → Guide candidate: updates hit counts (evidence: `backend/services/off_target_analysis.py`)
- FastAPI endpoints → Scoring and ranking: ranks candidates (evidence: `backend/main.py`)
- Scoring and ranking → Guide candidate: reads candidate fields (evidence: `backend/services/scoring.py`)
- FastAPI endpoints → Scoring and ranking: builds best explanation (evidence: `backend/main.py`)
- FastAPI endpoints → Response models: returns typed response (evidence: `backend/main.py`)
- FastAPI endpoints → Synthetic genome: gets metadata (evidence: `backend/main.py`)
