# osama-alathwari/corecare architecture

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

- Interactive diagram: https://gitdiagram.com/osama-alathwari/corecare
- Repository: https://github.com/osama-alathwari/corecare

## Overview

##### High-Level Architecture Components

a) Frontend Layer (CoreCare):
- User Interface Components (showing major modules like Doctor, Patient, Healthcare Provider)
- State Management (Recoil)
- File Handling Components
- Authentication Components

b) Backend Layer (CoreCare Server):
- API Gateway
- Route Handlers
- Database Interface
- File Storage System

c) Blockchain Layer:
- Smart Contracts
- Blockchain Network Interface
- Transaction Management

##### Component Relationships

- Frontend → Backend (REST API calls)
- Backend → Blockchain (Contract interactions)
- Backend → File Storage (Patient records, documents)
- Backend → Database (User data, metadata)

##### Key Subsystems

a) User Management:
- Patient Management
- Doctor Management
- Healthcare Facility Management
- Authentication & Authorization

b) Medical Records:
- Records Storage
- Access Control
- File Processing (DICOM, PDF)

c) Healthcare Services:
- Appointments
- Prescriptions
- Lab Results
- Radiology

##### Technical Stack Indicators

Technology labels:
- Frontend: React.js, Tailwind CSS
- Backend: Node.js
- Storage: File System + Database
- Blockchain: Hardhat/Ethereum

##### Security Layer

Security components:
- Access Key Management
- Document Verification
- Emergency Access Control
- Patient Data Privacy

##### Integration Points

External integration points:
- Healthcare Provider Systems
- Laboratory Systems
- Pharmacy Systems
- Radiology Centers

##### Additional Elements

Include:
- System boundaries
- Data flow directions
- Access control points
- Backup/redundancy systems

Key Considerations:

##### Verification and authentication checkpoints

Remember to include a notes section explaining any assumptions or special considerations in the implementation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend["Frontend Application (CoreCare)"]
        UI["User Interface"]:::frontend
        SM["State Management"]:::frontend
        FH["File Handling"]:::frontend
        Auth["Authentication"]:::frontend
        
        subgraph FileProcessing["File Processing"]
            DV["DICOM Viewer"]:::frontend
            PV["PDF Viewer"]:::frontend
        end
        
        subgraph UserManagement["User Management"]
            PAM["Patient Access Management"]:::frontend
            EA["Emergency Access"]:::frontend
        end
    end

    subgraph Backend["Backend Services"]
        API["API Gateway"]:::backend
        RH["Route Handlers"]:::backend
        DBI["Database Interface"]:::backend
        FS["File Storage System"]:::backend
        
        subgraph Routes["Route Handlers"]
            PR["Patient Routes"]:::backend
            DR["Doctor Routes"]:::backend
            HPR["Healthcare Provider Routes"]:::backend
            RR["Records Routes"]:::backend
            DA["Document Authentication"]:::backend
        end
    end

    subgraph Blockchain["Blockchain Layer"]
        SC["Smart Contracts"]:::blockchain
        BC_Config["Blockchain Config"]:::blockchain
    end

    %% Relationships
    UI --> API
    SM --> UI
    FH --> FS
    Auth --> API
    
    API --> RH
    RH --> DBI
    RH --> SC
    
    %% Click events
    click UI "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare/src/component/"
    click SM "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare/src/Recoil/"
    click FH "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare/src/component/FilesUploadAndViw/"
    click Auth "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare/src/component/loginDetails/"
    
    click API "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/API/API_Documentaion.js"
    click RH "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare_Srever/routes/"
    click DBI "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/db.js"
    click FS "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/corecare_Srever/Users/"
    
    click SC "https://github.com/Osama-Alathwari/CoreCare/tree/dev/developement/blockchain_server/contracts/"
    click BC_Config "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/blockchain_server/hardhat.config.js"
    
    click DV "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare/src/component/FilesUploadAndViw/DicomViewer.js"
    click PV "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare/src/component/FilesUploadAndViw/PdfViewer.js"
    
    click PAM "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare/src/component/UserDetails/PatientAccessManagement.js"
    click EA "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare/src/component/UserDetails/EmergecyAccess.js"
    
    click PR "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/routes/patientRoutes.js"
    click DR "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/routes/doctorRoutes.js"
    click HPR "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/routes/healthcareProviderRoutes.js"
    click RR "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/routes/recordsRoutes.js"
    click DA "https://github.com/Osama-Alathwari/CoreCare/blob/dev/developement/corecare_Srever/routes/checkDocsAuthenticity.js"

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef blockchain fill:#9C27B0,stroke:#6A1B9A,color:white

    %% Legend
    subgraph Legend
        F[Frontend]:::frontend
        B[Backend]:::backend
        BC[Blockchain]:::blockchain
    end
```
