# thecodeycorner/medcheck architecture

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

- Interactive diagram: https://gitdiagram.com/thecodeycorner/medcheck
- Repository: https://github.com/thecodeycorner/medcheck

## Overview

MedCheck is a Flask medicine-search app. Its main workflow sends a browser search for a medicine name or active ingredient to the server, queries the medicine CSV, calculates comparable unit costs, renders medicine cards, and returns HTML to the page. Search results are also saved to a CSV file. The source shows a favorites route, but its template and supporting implementation are absent from the supplied tree. The README gives no further capability details.

Main entry points: [`app.py`](https://github.com/thecodeycorner/medcheck/blob/main/app.py) (Search endpoint), [`templates/index.html`](https://github.com/thecodeycorner/medcheck/blob/main/templates/index.html) (Search page), [`static/script.js`](https://github.com/thecodeycorner/medcheck/blob/main/static/script.js) (Search client), [`database/medicines.csv`](https://github.com/thecodeycorner/medcheck/blob/main/database/medicines.csv) (Medicine catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser interface"]
  node_page["Search page<br/>[index.html]"]
  node_search_js["Search client<br/>[script.js]"]
end

subgraph group_server["Flask application"]
  node_home["Home route<br/>[app.py]"]
  node_search_route["Search endpoint<br/>[app.py]"]
  node_medicine_query["Medicine query<br/>[app.py]"]
  node_cost["Unit cost<br/>[app.py]"]
  node_card["Card renderer<br/>[app.py]"]
  node_favorites_route["Favorites route<br/>[app.py]"]
end

subgraph group_data["Medicine data"]
  node_medicine_csv[("Medicine catalog<br/>[medicines.csv]")]
  node_results_csv[("Search results<br/>[results.csv]")]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_home -->|"renders"| node_page
node_page -->|"loads"| node_search_js
node_search_js -->|"posts search"| node_search_route
node_search_route -->|"queries"| node_medicine_query
node_medicine_query -->|"reads"| node_medicine_csv
node_search_route -->|"writes results"| node_results_csv
node_search_route -->|"calculates"| node_cost
node_search_route -->|"renders cards"| node_card
node_search_route -->|"returns HTML"| node_search_js

click node_page "https://github.com/thecodeycorner/medcheck/blob/main/templates/index.html"
click node_search_js "https://github.com/thecodeycorner/medcheck/blob/main/static/script.js"
click node_home "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_search_route "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_medicine_query "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_cost "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_card "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_favorites_route "https://github.com/thecodeycorner/medcheck/blob/main/app.py"
click node_medicine_csv "https://github.com/thecodeycorner/medcheck/blob/main/database/medicines.csv"
click node_results_csv "https://github.com/thecodeycorner/medcheck/blob/main/database/results.csv"

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_page,node_search_js,node_user toneBlue
class node_home,node_search_route,node_medicine_query,node_cost,node_card,node_favorites_route toneAmber
class node_medicine_csv,node_results_csv toneMint
```

## Components

### Browser interface

- [Search page](https://github.com/thecodeycorner/medcheck/blob/main/templates/index.html): `templates/index.html`
- [Search client](https://github.com/thecodeycorner/medcheck/blob/main/static/script.js): `static/script.js`

### Flask application

- [Home route](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`
- [Search endpoint](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`
- [Medicine query](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`
- [Unit cost](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`
- [Card renderer](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`
- [Favorites route](https://github.com/thecodeycorner/medcheck/blob/main/app.py): `app.py`

### Medicine data

- [Medicine catalog](https://github.com/thecodeycorner/medcheck/blob/main/database/medicines.csv): `database/medicines.csv`
- [Search results](https://github.com/thecodeycorner/medcheck/blob/main/database/results.csv): `database/results.csv`

### Other components

- **User**

## Connections

- User → Search page: uses
- Home route → Search page: renders
- Search page → Search client: loads
- Search client → Search endpoint: posts search
- Search endpoint → Medicine query: queries
- Medicine query → Medicine catalog: reads
- Search endpoint → Search results: writes results
- Search endpoint → Unit cost: calculates
- Search endpoint → Card renderer: renders cards
- Search endpoint → Search client: returns HTML
