# shhhivamm/lens_lab architecture

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

- Interactive diagram: https://gitdiagram.com/shhhivamm/lens_lab
- Repository: https://github.com/shhhivamm/lens_lab

## Overview

LabLens lets users upload a report for file validation, and separately enter or review structured lab values before submitting them for range-based educational analysis. The analysis results and safety notice return to the frontend. Report upload currently stops at validation and receipt: the README describes OCR and storage as planned, not implemented. The graph reflects the sampled implementation; the health-check endpoint is part of the backend API, while Swagger UI is FastAPI-provided.

Main entry points: [`frontend/src/services/reportApi.js`](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/services/reportApi.js) (API client), [`frontend/src/components/LabValueReview.jsx`](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/LabValueReview.jsx) (Value review), [`frontend/src/App.jsx`](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/App.jsx) (App shell), [`backend/app/main.py`](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py) (Analyze endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app_entry["React entry<br/>[main.jsx]"]
  node_app["App shell<br/>[App.jsx]"]
  node_header["Navigation<br/>[Header.jsx]"]
end

subgraph group_upload["Report Upload"]
  node_upload_ui["Report selection"]
  node_report_api["API client<br/>[reportApi.js]"]
end

subgraph group_analysis["Lab Values"]
  node_review_ui["Value review<br/>[LabValueReview.jsx]"]
end

subgraph group_backend["Backend"]
  node_upload_route["Upload endpoint<br/>[main.py]"]
  node_file_checks["File checks<br/>[main.py]"]
  node_verify_api["Verify endpoint<br/>[main.py]"]
  node_analyze_api["Analyze endpoint<br/>[main.py]"]
  node_value_schema["Value validation<br/>[schemas.py]"]
  node_analysis_service["Range analysis<br/>[lab_analysis.py]"]
  node_classification["Range classification<br/>[lab_analysis.py]"]
  node_analysis_note["Explanation text<br/>[lab_analysis.py]"]
end

node_user(("User"))

node_app_entry -->|"renders"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_upload_ui
node_app -->|"renders"| node_review_ui
node_user -->|"selects report"| node_upload_ui
node_upload_ui -->|"uploads file"| node_report_api
node_report_api -->|"posts file"| node_upload_route
node_upload_route -->|"validates file"| node_file_checks
node_file_checks -->|"returns size"| node_upload_route
node_user -->|"enters values"| node_review_ui
node_review_ui -->|"submits values"| node_report_api
node_report_api -->|"posts values"| node_verify_api
node_verify_api -->|"validates payload"| node_value_schema
node_report_api -->|"requests analysis"| node_analyze_api
node_analyze_api -->|"validates payload"| node_value_schema
node_analyze_api -->|"analyzes values"| node_analysis_service
node_analysis_service -->|"classifies range"| node_classification
node_analysis_service -->|"builds explanation"| node_analysis_note
node_analyze_api -->|"returns results"| node_review_ui
node_verify_api -->|"returns values"| node_review_ui

click node_app_entry "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/App.jsx"
click node_header "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/Header.jsx"
click node_upload_ui "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/UploadReportCard.jsx"
click node_report_api "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/services/reportApi.js"
click node_upload_route "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py"
click node_file_checks "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py"
click node_review_ui "https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/LabValueReview.jsx"
click node_verify_api "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py"
click node_analyze_api "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py"
click node_value_schema "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/schemas.py"
click node_analysis_service "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.py"
click node_classification "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.py"
click node_analysis_note "https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.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_app_entry,node_app,node_header,node_user toneBlue
class node_upload_ui,node_report_api toneAmber
class node_review_ui toneMint
class node_upload_route,node_file_checks,node_verify_api,node_analyze_api,node_value_schema,node_analysis_service,node_classification,node_analysis_note toneRose
```

## Components

### Frontend

- [React entry](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [App shell](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Navigation](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/Header.jsx): `frontend/src/components/Header.jsx`

### Report Upload

- [Report selection](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/UploadReportCard.jsx): `frontend/src/components/UploadReportCard.jsx`
- [API client](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/services/reportApi.js): `frontend/src/services/reportApi.js`

### Lab Values

- [Value review](https://github.com/shhhivamm/lens_lab/blob/main/frontend/src/components/LabValueReview.jsx): `frontend/src/components/LabValueReview.jsx`

### Backend

- [Upload endpoint](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py): `backend/app/main.py`
- [File checks](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py): `backend/app/main.py`
- [Verify endpoint](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py): `backend/app/main.py`
- [Analyze endpoint](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/main.py): `backend/app/main.py`
- [Value validation](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Range analysis](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.py): `backend/app/services/lab_analysis.py`
- [Range classification](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.py): `backend/app/services/lab_analysis.py`
- [Explanation text](https://github.com/shhhivamm/lens_lab/blob/main/backend/app/services/lab_analysis.py): `backend/app/services/lab_analysis.py`

### Other components

- **User**

## Connections

- React entry → App shell: renders
- App shell → Navigation: renders
- App shell → Report selection: renders
- App shell → Value review: renders
- User → Report selection: selects report
- Report selection → API client: uploads file
- API client → Upload endpoint: posts file
- Upload endpoint → File checks: validates file
- File checks → Upload endpoint: returns size
- User → Value review: enters values
- Value review → API client: submits values
- API client → Verify endpoint: posts values
- Verify endpoint → Value validation: validates payload
- API client → Analyze endpoint: requests analysis
- Analyze endpoint → Value validation: validates payload
- Analyze endpoint → Range analysis: analyzes values
- Range analysis → Range classification: classifies range
- Range analysis → Explanation text: builds explanation
- Analyze endpoint → Value review: returns results
- Verify endpoint → Value review: returns values
