# yichenlu0719/cloudmedicine architecture

> Architecture diagram of the GitHub repository yichenlu0719/cloudmedicine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yichenlu0719/cloudmedicine
- Repository: https://github.com/yichenlu0719/cloudmedicine

## Overview

##### Project type and purpose
- This is a small, standalone automation tool (not a full-stack web app or microservice).
- From the README (“CloudMedicine 查詢雲端藥歷自動下載”) and file names, its sole purpose is to automatically query/download cloud-hosted medical records.

##### File structure
- Top-level files only:
- medicine.py – the main Python script
- chromedriver.exe / LICENSE.chromedriver – the Selenium WebDriver binary & license
- 錯誤紀錄.txt – error log output by the script
- README.md – project description
- No front-end or back-end folders, no database schema, no config directory.

##### Key architectural insights from the README
- It’s a command-line Python application using a headless or automated Chrome (via Selenium) to fetch records.
- It writes output to the local file system and logs errors.

##### Main components & their relationships
a. User / Operator
– Invokes `medicine.py` on the command line, possibly passing credentials or parameters.
b. Python Automation Script (`medicine.py`)
– Contains application logic for credentials, navigation, downloading.
c. ChromeDriver (`chromedriver.exe`)
– A bridge: Python’s Selenium library calls ChromeDriver, which drives a real (or headless) Chrome instance.
d. Remote Cloud Medicine Service (external web server)
– The target web interface/API that hosts user’s medical records.
e. Local File System
– Stores downloaded records (e.g., PDF or HTML)
– Appends errors to `錯誤紀錄.txt`.

##### Architectural patterns & design principles
- Single-process, sequential automation script.
- Dependency inversion: `medicine.py` depends on a well-defined WebDriver interface rather than raw HTTP.
- External dependency isolation: ChromeDriver is kept in the repo alongside the script for portability.

##### Detail is key
- Even though it’s a small project, capture each piece:
- Python runtime
- Selenium library (optional annotation)
- ChromeDriver binary
- External website endpoints
- Output files & logs

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Internal Components"
        User["User (CLI)"]:::internal
        Python["medicine.py (Python + Selenium)"]:::internal
        ChromedriverBinary["chromedriver.exe (WebDriver)"]:::internal
        License["LICENSE.chromedriver"]:::internal
    end

    subgraph "External Systems"
        Cloud["Cloud Medicine Web Service"]:::external
        Downloaded[(Downloaded Records)]:::storage
        ErrorLog[(錯誤紀錄.txt)]:::storage
        Docs["README.md"]:::external
    end

    User -->|"invoke script"| Python
    Python -->|"calls WebDriver"| ChromedriverBinary
    ChromedriverBinary -->|"HTTP drive"| Cloud
    Cloud -->|"response pages/data"| ChromedriverBinary
    ChromedriverBinary -->|"returns data"| Python
    Python -->|"write records"| Downloaded
    Python -->|"append errors"| ErrorLog

    click Python "https://github.com/yichenlu0719/cloudmedicine/blob/main/medicine.py"
    click ChromedriverBinary "https://github.com/yichenlu0719/cloudmedicine/blob/main/chromedriver.exe"
    click License "https://github.com/yichenlu0719/cloudmedicine/blob/main/LICENSE.chromedriver"
    click ErrorLog "https://github.com/yichenlu0719/cloudmedicine/blob/main/錯誤紀錄.txt"
    click Docs "https://github.com/yichenlu0719/cloudmedicine/blob/main/README.md"

    classDef internal fill:#E8F0FE,stroke:#1A73E8;
    classDef external fill:#FCE8E6,stroke:#D93025;
    classDef storage fill:#E6F4EA,stroke:#34A853;
```
