# 15-ab/medimage architecture

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

- Interactive diagram: https://gitdiagram.com/15-ab/medimage
- Repository: https://github.com/15-ab/medimage

## Overview

MedImage is a medical-bill image OCR application. Users sign up or log in, upload and select a bill, run OCR, inspect structured invoice data, and compare extracted medicine prices with official prices. The graph includes authentication, image management, OCR and price comparison, plus the backend data layer. Some backend routes and frontend components are unsampled; those capabilities are included where documented, but uncertain internal links are omitted.

Main entry points: [`back server/app.js`](https://github.com/15-ab/medimage/blob/main/back%20server/app.js) (Express API), [`front client/src/App.js`](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/App.js) (App routes), [`front client/src/components/PerformOCR.js`](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/PerformOCR.js) (OCR and parsing), [`front client/src/components/userDetails.js`](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/userDetails.js) (Image dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routes<br/>[App.js]"]
  node_profile["Image dashboard<br/>[userDetails.js]"]
  node_dialog["Image actions"]
  node_router["Route adapter<br/>[withRouter.js]"]
end

subgraph group_identity["Identity"]
  node_signup["Phone signup"]
  node_login["Login<br/>[login.component.js]"]
  node_reset["Password reset<br/>[reset.js]"]
  node_firebase["Firebase auth<br/>[firbase_config.js]"]
end

subgraph group_bill["Bill processing"]
  node_ocr["OCR and parsing<br/>[PerformOCR.js]"]
  node_priceview["Structured results<br/>[PerformOCR.js]"]
end

subgraph group_server["Backend and data"]
  node_api["Express API<br/>[app.js]"]
  node_usermodel[("User records<br/>[userDetails.js]")]
  node_imagemodel[("Image records<br/>[imageDetails.js]")]
  node_medicinemodel[("Medicine catalog<br/>[medicineDetails.js]")]
  node_medroutes["Official prices API<br/>[medicineRoutes.js]"]
end

node_user(("User"))
node_mongo[("MongoDB")]
node_tesseract["Tesseract OCR"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_reset
node_app -->|"routes to"| node_ocr
node_profile -->|"shows"| node_dialog
node_profile -->|"requests images"| node_api
node_profile -->|"opens"| node_ocr
node_signup -->|"verifies phone"| node_firebase
node_signup -->|"registers"| node_api
node_login -.->|"authenticates"| node_api
node_ocr -->|"gets route ID"| node_router
node_ocr -->|"fetches and logs"| node_api
node_ocr -->|"recognizes text"| node_tesseract
node_ocr -->|"renders results"| node_priceview
node_api -->|"uses user data"| node_usermodel
node_api -->|"uses image data"| node_imagemodel
node_api -->|"mounts routes"| node_medroutes
node_medroutes -->|"queries prices"| node_medicinemodel
node_api -->|"compares prices"| node_medicinemodel
node_usermodel -->|"persists records"| node_mongo
node_imagemodel -->|"persists images"| node_mongo
node_medicinemodel -.->|"stores prices"| node_mongo

click node_app "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/App.js"
click node_profile "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/userDetails.js"
click node_dialog "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/ConfirmationDialog.js"
click node_ocr "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/PerformOCR.js"
click node_router "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/withRouter.js"
click node_signup "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/signup.component.js"
click node_login "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/login.component.js"
click node_reset "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/reset.js"
click node_firebase "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/firbase_config.js"
click node_api "https://github.com/15-ab/medimage/blob/main/back%20server/app.js"
click node_usermodel "https://github.com/15-ab/medimage/blob/main/back%20server/userDetails.js"
click node_imagemodel "https://github.com/15-ab/medimage/blob/main/back%20server/imageDetails.js"
click node_medicinemodel "https://github.com/15-ab/medimage/blob/main/back%20server/medicineDetails.js"
click node_medroutes "https://github.com/15-ab/medimage/blob/main/back%20server/medicineRoutes.js"
click node_priceview "https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/PerformOCR.js"

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,node_profile,node_dialog,node_router,node_user toneBlue
class node_signup,node_login,node_reset,node_firebase,node_mongo toneAmber
class node_ocr,node_priceview toneMint
class node_api,node_usermodel,node_imagemodel,node_medicinemodel,node_medroutes toneRose
class node_tesseract toneIndigo
```

## Components

### Web client

- [App routes](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/App.js): `front client/src/App.js`
- [Image dashboard](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/userDetails.js): `front client/src/components/userDetails.js`
- [Image actions](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/ConfirmationDialog.js): `front client/src/components/ConfirmationDialog.js`
- [Route adapter](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/withRouter.js): `front client/src/components/withRouter.js`

### Identity

- [Phone signup](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/signup.component.js): `front client/src/components/signup.component.js`
- [Login](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/login.component.js): `front client/src/components/login.component.js`
- [Password reset](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/reset.js): `front client/src/components/reset.js`
- [Firebase auth](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/firbase_config.js): `front client/src/components/firbase_config.js`

### Bill processing

- [OCR and parsing](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/PerformOCR.js): `front client/src/components/PerformOCR.js`
- [Structured results](https://github.com/15-ab/medimage/blob/main/front%20%20client/src/components/PerformOCR.js): `front client/src/components/PerformOCR.js`

### Backend and data

- [Express API](https://github.com/15-ab/medimage/blob/main/back%20server/app.js): `back server/app.js`
- [User records](https://github.com/15-ab/medimage/blob/main/back%20server/userDetails.js): `back server/userDetails.js`
- [Image records](https://github.com/15-ab/medimage/blob/main/back%20server/imageDetails.js): `back server/imageDetails.js`
- [Medicine catalog](https://github.com/15-ab/medimage/blob/main/back%20server/medicineDetails.js): `back server/medicineDetails.js`
- [Official prices API](https://github.com/15-ab/medimage/blob/main/back%20server/medicineRoutes.js): `back server/medicineRoutes.js`

### Other components

- **User**
- **MongoDB**
- **Tesseract OCR**

## Connections

- User → App routes: uses (evidence: `README.md`)
- App routes → Image dashboard: routes to (evidence: `front  client/src/App.js`)
- App routes → Login: routes to (evidence: `front  client/src/App.js`)
- App routes → Phone signup: routes to (evidence: `front  client/src/App.js`)
- App routes → Password reset: routes to (evidence: `front  client/src/App.js`)
- App routes → OCR and parsing: routes to (evidence: `front  client/src/App.js`)
- Image dashboard → Image actions: shows (evidence: `front  client/src/components/userDetails.js`)
- Image dashboard → Express API: requests images (evidence: `front  client/src/components/userDetails.js`)
- Image dashboard → OCR and parsing: opens (evidence: `front  client/src/components/userDetails.js`)
- Phone signup → Firebase auth: verifies phone (evidence: `front  client/src/components/signup.component.js`)
- Phone signup → Express API: registers (evidence: `README.md`)
- Login → Express API: authenticates
- OCR and parsing → Route adapter: gets route ID (evidence: `front  client/src/components/PerformOCR.js`)
- OCR and parsing → Express API: fetches and logs (evidence: `front  client/src/components/PerformOCR.js`)
- OCR and parsing → Tesseract OCR: recognizes text (evidence: `front  client/src/components/PerformOCR.js`)
- OCR and parsing → Structured results: renders results (evidence: `front  client/src/components/PerformOCR.js`)
- Express API → User records: uses user data (evidence: `back server/app.js`)
- Express API → Image records: uses image data (evidence: `back server/app.js`)
- Express API → Official prices API: mounts routes (evidence: `back server/app.js`)
- Official prices API → Medicine catalog: queries prices (evidence: `back server/medicineRoutes.js`)
- Express API → Medicine catalog: compares prices (evidence: `back server/app.js`)
- User records → MongoDB: persists records (evidence: `README.md`)
- Image records → MongoDB: persists images (evidence: `README.md`)
- Medicine catalog → MongoDB: stores prices
