# suisan-neki/sechack365_electronic-medical-record architecture

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

- Interactive diagram: https://gitdiagram.com/suisan-neki/sechack365_electronic-medical-record
- Repository: https://github.com/suisan-neki/sechack365_electronic-medical-record

## Overview

This repository implements a secure patient-information sharing system, with a clinician workflow to select patient records, enter and share clinical notes, and let patients review them. The Flask application provides the primary web/API entry point; React pages and a separate mobile client provide user interfaces. A simulated EHR supports record exchange, while shared core modules provide authentication, authorization, encryption, signatures, and audit integrity. The README documents the product capabilities and EHR exchange flow; some subsystem relationships below rely on the source index because their implementations were not excerpted.

Main entry points: [`SecHack365_project/info_sharing_system/app/app.py`](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/info_sharing_system/app/app.py) (Sharing API), [`SecHack365_project/src/App.tsx`](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/App.tsx) (Web application), [`dummy_ehr_system/app/app.py`](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/dummy_ehr_system/app/app.py) (Simulated EHR), [`SecHack365_project/core/ehr_integrator.py`](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/ehr_integrator.py) (EHR integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Sharing application"]
  node_webapp["Sharing API<br/>[app.py]"]
  node_records[("Record storage<br/>[database.py]")]
end

subgraph group_security["Security and audit"]
  node_auth["Authentication<br/>[authentication.py]"]
  node_authorization["Access control<br/>[authorization.py]"]
  node_encryption["Data encryption<br/>[data_encryption.py]"]
  node_signature["Digital signatures"]
  node_audit["Audit logging<br/>[audit_logger.py]"]
  node_hashchain["Audit integrity<br/>[hash_chain.py]"]
end

subgraph group_exchange["EHR exchange"]
  node_ehr_integrator["EHR integration<br/>[ehr_integrator.py]"]
  node_csv["CSV exchange<br/>[csv_handler.py]"]
  node_fhir["FHIR adapter<br/>[fhir_adapter.py]"]
  node_dummy_ehr["Simulated EHR<br/>[app.py]"]
end

subgraph group_clients["User clients"]
  node_webclient["Web application<br/>[App.tsx]"]
  node_dashboard["Clinician dashboard<br/>[DashboardPage.tsx]"]
  node_input_form["Clinical record entry<br/>[InputFormPage.tsx]"]
  node_patient_view["Patient display"]
  node_admin["Admin dashboard"]
  node_phase1["Phase 1 management"]
  node_web_store["Web client state<br/>[useAppStore.ts]"]
  node_mobile["Mobile client<br/>[App.tsx]"]
  node_mobile_store["Mobile state and API<br/>[useAppStore.ts]"]
end

node_clinician(("Clinician"))
node_patient(("Patient"))

node_clinician -->|"uses"| node_webclient
node_patient -->|"reviews records"| node_webclient
node_webclient -->|"routes to"| node_dashboard
node_webclient -->|"routes to"| node_input_form
node_webclient -->|"routes to"| node_patient_view
node_webclient -->|"routes to"| node_admin
node_webclient -->|"routes to"| node_phase1
node_webclient -->|"reads state"| node_web_store
node_dashboard -.->|"requests records"| node_webapp
node_input_form -.->|"submits notes"| node_webapp
node_webapp -->|"reads and writes"| node_records
node_webapp -->|"delegates exchange"| node_ehr_integrator
node_webapp -->|"authenticates users"| node_auth
node_webapp -->|"checks access"| node_authorization
node_webapp -->|"protects data"| node_encryption
node_webapp -->|"verifies records"| node_signature
node_webapp -->|"records actions"| node_audit
node_webapp -->|"checks integrity"| node_hashchain
node_ehr_integrator -.->|"exchanges records"| node_dummy_ehr
node_dummy_ehr -->|"exports CSV"| node_csv
node_dummy_ehr -->|"exports FHIR"| node_fhir
node_mobile -->|"uses state"| node_mobile_store
node_mobile_store -->|"calls API"| node_webapp

click node_webapp "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/info_sharing_system/app/app.py"
click node_records "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/database.py"
click node_ehr_integrator "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/ehr_integrator.py"
click node_csv "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/csv_handler.py"
click node_fhir "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/fhir_adapter.py"
click node_dummy_ehr "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/dummy_ehr_system/app/app.py"
click node_auth "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/authentication.py"
click node_authorization "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/authorization.py"
click node_encryption "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/data_encryption.py"
click node_signature "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/digital_signature.py"
click node_audit "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/audit_logger.py"
click node_hashchain "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/hash_chain.py"
click node_webclient "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/App.tsx"
click node_dashboard "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/DashboardPage.tsx"
click node_input_form "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/InputFormPage.tsx"
click node_patient_view "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/PatientDisplayPage.tsx"
click node_admin "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/AdminDashboardPage.tsx"
click node_phase1 "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/Phase1ManagementPage.tsx"
click node_web_store "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/store/useAppStore.ts"
click node_mobile "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/mobile/App.tsx"
click node_mobile_store "https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/mobile/src/store/useAppStore.ts"

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_webapp,node_records toneBlue
class node_auth,node_authorization,node_encryption,node_signature,node_audit,node_hashchain toneAmber
class node_ehr_integrator,node_csv,node_fhir,node_dummy_ehr toneMint
class node_webclient,node_dashboard,node_input_form,node_patient_view,node_admin,node_phase1,node_web_store,node_mobile,node_mobile_store toneRose
class node_clinician,node_patient toneIndigo
```

## Components

### Sharing application

- [Sharing API](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/info_sharing_system/app/app.py): `SecHack365_project/info_sharing_system/app/app.py`
- [Record storage](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/database.py): `SecHack365_project/core/database.py`

### Security and audit

- [Authentication](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/authentication.py): `SecHack365_project/core/authentication.py`
- [Access control](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/authorization.py): `SecHack365_project/core/authorization.py`
- [Data encryption](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/data_encryption.py): `SecHack365_project/core/data_encryption.py`
- [Digital signatures](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/digital_signature.py): `SecHack365_project/core/digital_signature.py`
- [Audit logging](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/audit_logger.py): `SecHack365_project/core/audit_logger.py`
- [Audit integrity](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/hash_chain.py): `SecHack365_project/core/hash_chain.py`

### EHR exchange

- [EHR integration](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/ehr_integrator.py): `SecHack365_project/core/ehr_integrator.py`
- [CSV exchange](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/csv_handler.py): `SecHack365_project/core/csv_handler.py`
- [FHIR adapter](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/core/fhir_adapter.py): `SecHack365_project/core/fhir_adapter.py`
- [Simulated EHR](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/dummy_ehr_system/app/app.py): `dummy_ehr_system/app/app.py`

### User clients

- [Web application](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/App.tsx): `SecHack365_project/src/App.tsx`
- [Clinician dashboard](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/DashboardPage.tsx): `SecHack365_project/src/pages/DashboardPage.tsx`
- [Clinical record entry](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/InputFormPage.tsx): `SecHack365_project/src/pages/InputFormPage.tsx`
- [Patient display](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/PatientDisplayPage.tsx): `SecHack365_project/src/pages/PatientDisplayPage.tsx`
- [Admin dashboard](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/AdminDashboardPage.tsx): `SecHack365_project/src/pages/AdminDashboardPage.tsx`
- [Phase 1 management](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/pages/Phase1ManagementPage.tsx): `SecHack365_project/src/pages/Phase1ManagementPage.tsx`
- [Web client state](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/src/store/useAppStore.ts): `SecHack365_project/src/store/useAppStore.ts`
- [Mobile client](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/mobile/App.tsx): `SecHack365_project/mobile/App.tsx`
- [Mobile state and API](https://github.com/suisan-neki/sechack365_electronic-medical-record/blob/main/SecHack365_project/mobile/src/store/useAppStore.ts): `SecHack365_project/mobile/src/store/useAppStore.ts`

### Other components

- **Clinician**
- **Patient**

## Connections

- Clinician → Web application: uses (evidence: `README.md`)
- Patient → Web application: reviews records (evidence: `README.md`)
- Web application → Clinician dashboard: routes to (evidence: `SecHack365_project/src/App.tsx`)
- Web application → Clinical record entry: routes to (evidence: `SecHack365_project/src/App.tsx`)
- Web application → Patient display: routes to (evidence: `SecHack365_project/src/App.tsx`)
- Web application → Admin dashboard: routes to (evidence: `SecHack365_project/src/App.tsx`)
- Web application → Phase 1 management: routes to (evidence: `SecHack365_project/src/App.tsx`)
- Web application → Web client state: reads state (evidence: `SecHack365_project/src/App.tsx`)
- Clinician dashboard → Sharing API: requests records
- Clinical record entry → Sharing API: submits notes
- Sharing API → Record storage: reads and writes (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → EHR integration: delegates exchange (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Authentication: authenticates users (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Access control: checks access (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Data encryption: protects data (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Digital signatures: verifies records (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Audit logging: records actions (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- Sharing API → Audit integrity: checks integrity (evidence: `SecHack365_project/info_sharing_system/app/app.py`)
- EHR integration → Simulated EHR: exchanges records (evidence: `README.md`)
- Simulated EHR → CSV exchange: exports CSV (evidence: `dummy_ehr_system/app/app.py`)
- Simulated EHR → FHIR adapter: exports FHIR (evidence: `dummy_ehr_system/app/app.py`)
- Mobile client → Mobile state and API: uses state (evidence: `SecHack365_project/mobile/App.tsx`)
- Mobile state and API → Sharing API: calls API (evidence: `SecHack365_project/mobile/src/store/useAppStore.ts`)
