# mukulsonker/curana-risk-compass architecture

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

- Interactive diagram: https://gitdiagram.com/mukulsonker/curana-risk-compass
- Repository: https://github.com/mukulsonker/curana-risk-compass

## Overview

##### Project type and purpose
- From the README and file tree, this is a single-page dashboard application built with Vite + React + TypeScript, styled with Tailwind CSS and shadcn-ui component library. It provides various “pages” (e.g., CareGapReports, PatientRiskTable) presenting healthcare metrics via charts, tables, and widgets. No backend services are in this repo—it’s purely a front-end client consuming mock data for demonstration.

##### File structure
- Top-level config/build files:
- vite.config.ts, tsconfig*.json, postcss.config.js, tailwind.config.ts, package.json, bun.lockb, package-lock.json
- Public/static assets:
- public/robots.txt, index.html
- Source code under src/:
- main.tsx – app entry point, mounts React tree
- App.tsx & App.css – root layout, global styles
- pages/ – route components (e.g., Index.tsx, PatientRiskTable.tsx)
- components/ – reusable UI parts and domain-specific cards, tables, charts
- components/ui/ – primitive UI building blocks from shadcn-ui (buttons, dialogs, inputs, etc.)
- hooks/ – custom React hooks (use-mobile, use-toast)
- services/mockData.ts – data layer providing sample data
- lib/utils.ts – shared utility functions
- types/ – TypeScript interfaces for dashboard data
- No backend, no microservices; follows a component-driven, single-page-app (SPA) architecture.

##### README for additional insights
- Confirms tech stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS
- Deployment model: static hosting via Lovable, no server-side code

a. Main components
- Browser/client
- Static asset host (e.g., Lovable’s CDN or any static file server)
- Vite build pipeline (dev server & bundler)
- React SPA
- UI library (shadcn-ui + Tailwind)
- Data layer (mockData service)
- Custom hooks & utils
b. Relationships & interactions
- Browser requests index.html from static host → loads bundled JS/CSS
- main.tsx initializes React Router → renders App → routes to pages
- Each page imports domain components (e.g., PatientTable, RiskTierChart)
- Components invoke services/mockData to fetch data → pass into charts/tables
- UI primitives (components/ui) are composed by domain components
- Hooks (use-mobile, use-toast) intercede in component logic (responsiveness, notifications)
c. Architectural patterns/principles
- SPA with client-side routing (React Router implied)
- Component-driven design: primitive UI layer vs. domain components vs. pages
- Unidirectional data flow: services → components → UI
- Separation of concerns: hooks for cross-cutting concerns, utils for pure functions, types for contracts
d. Relevant technologies
- Vite (dev server + bundler)
- React + ReactDOM + React Router
- TypeScript
- Tailwind CSS
- shadcn-ui primitives

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Deployment Layer
    subgraph "Build & Deployment" 
        direction TB
        viteConfig["vite.config.ts"]:::deployment
        postcssConfig["postcss.config.js"]:::deployment
        tailwindConfig["tailwind.config.ts"]:::deployment
        tsconfig["tsconfig.json"]:::deployment
        tsconfigApp["tsconfig.app.json"]:::deployment
        tsconfigNode["tsconfig.node.json"]:::deployment
        VitePipeline["Vite Build Pipeline"]:::deployment
        viteConfig -->|reads| VitePipeline
        postcssConfig -->|reads| VitePipeline
        tailwindConfig -->|reads| VitePipeline
        tsconfig -->|reads| VitePipeline
        tsconfigApp -->|reads| VitePipeline
        tsconfigNode -->|reads| VitePipeline
        VitePipeline -->|outputs| indexHTML
        VitePipeline -->|bundles| mainEntry
    end

    %% Static Host
    indexHTML["index.html"]:::deployment
    mainEntry["src/main.tsx"]:::deployment
    StaticHost["Static Host/CDN"]:::deployment
    VitePipeline -->|deploys| StaticHost
    StaticHost -->|serves| indexHTML
    StaticHost -->|serves| mainEntry

    %% Runtime Layer
    Browser["Browser"]:::runtime
    Browser -->|HTTP GET| StaticHost
    Browser -->|loads| indexHTML
    Browser -->|executes| mainEntry

    %% React SPA
    subgraph "React SPA" 
        direction TB
        AppEntry["App (src/App.tsx)"]:::runtime
        AppCSS["App.css"]:::runtime
        IndexCSS["index.css"]:::runtime
        AppEntry -->|imports styles| AppCSS
        AppEntry -->|imports styles| IndexCSS
        Router["Router & Pages"]:::runtime
        AppEntry -->|renders| Router

        subgraph "Pages" 
            direction TB
            PageIndex["Index.tsx"]:::runtime
            PatientRisk["PatientRiskTable.tsx"]:::runtime
            CareGap["CareGapReports.tsx"]:::runtime
            Palliative["PalliativeEligibility.tsx"]:::runtime
            RiskDefs["RiskTierDefinitions.tsx"]:::runtime
            NotFound["NotFound.tsx"]:::runtime
        end
        Router -->|routes to| PageIndex
        Router -->|routes to| PatientRisk
        Router -->|routes to| CareGap
        Router -->|routes to| Palliative
        Router -->|routes to| RiskDefs
        Router -->|routes to| NotFound
    end

    %% Domain Components
    subgraph "Domain Components" 
        direction TB
        Header["Header.tsx"]:::domain
        KeyMetrics["KeyMetricsCard.tsx"]:::domain
        PatientTable["PatientTable.tsx"]:::domain
        RiskChart["RiskTierChart.tsx"]:::domain
        Sidebar["SidebarPanel.tsx"]:::domain
        TierWidget["TierBreakdownWidget.tsx"]:::domain
    end
    PageIndex -->|uses| Header
    PatientRisk -->|uses| PatientTable
    PatientRisk -->|uses| TierWidget
    CareGap -->|uses| KeyMetrics
    CareGap -->|uses| RiskChart
    Palliative -->|uses| Sidebar
    RiskDefs -->|uses| Header
    NotFound -->|uses| Header

    %% UI Primitives
    UIModules["src/components/ui/*"]:::primitive
    Header -->|composes| UIModules
    KeyMetrics -->|composes| UIModules
    PatientTable -->|composes| UIModules
    RiskChart -->|composes| UIModules
    Sidebar -->|composes| UIModules
    TierWidget -->|composes| UIModules

    %% Data Services
    MockData["services/mockData.ts"]:::service
    DomainComponentsParticipants(Header)
    Header -->|fetches| MockData
    KeyMetrics -->|fetches| MockData
    PatientTable -->|fetches| MockData
    RiskChart -->|fetches| MockData
    Sidebar -->|fetches| MockData
    TierWidget -->|fetches| MockData

    %% Hooks & Utils
    subgraph "Hooks & Utilities"
        direction TB
        HookMobile["use-mobile.tsx"]:::hook
        HookToast["use-toast.ts"]:::hook
        Utils["utils.ts"]:::util
    end
    DomainComponentsParticipants(Header)
    Header -->|uses| HookMobile
    Header -->|uses| HookToast
    KeyMetrics -->|uses| HookMobile
    PatientTable -->|uses| HookToast
    RiskChart -->|uses| Utils
    Sidebar -->|uses| HookMobile
    TierWidget -->|uses| Utils

    %% Click Events
    click viteConfig "https://github.com/mukulsonker/curana-risk-compass/blob/main/vite.config.ts"
    click postcssConfig "https://github.com/mukulsonker/curana-risk-compass/blob/main/postcss.config.js"
    click tailwindConfig "https://github.com/mukulsonker/curana-risk-compass/blob/main/tailwind.config.ts"
    click tsconfig "https://github.com/mukulsonker/curana-risk-compass/blob/main/tsconfig.json"
    click tsconfigApp "https://github.com/mukulsonker/curana-risk-compass/blob/main/tsconfig.app.json"
    click tsconfigNode "https://github.com/mukulsonker/curana-risk-compass/blob/main/tsconfig.node.json"
    click indexHTML "https://github.com/mukulsonker/curana-risk-compass/blob/main/index.html"
    click mainEntry "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/main.tsx"
    click AppEntry "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/App.tsx"
    click AppCSS "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/App.css"
    click IndexCSS "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/index.css"
    click PageIndex "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/Index.tsx"
    click PatientRisk "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/PatientRiskTable.tsx"
    click CareGap "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/CareGapReports.tsx"
    click Palliative "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/PalliativeEligibility.tsx"
    click RiskDefs "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/RiskTierDefinitions.tsx"
    click NotFound "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/pages/NotFound.tsx"
    click Header "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/Header.tsx"
    click KeyMetrics "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/KeyMetricsCard.tsx"
    click PatientTable "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/PatientTable.tsx"
    click RiskChart "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/RiskTierChart.tsx"
    click Sidebar "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/SidebarPanel.tsx"
    click TierWidget "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/components/TierBreakdownWidget.tsx"
    click UIModules "https://github.com/mukulsonker/curana-risk-compass/tree/main/src/components/ui/"
    click MockData "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/services/mockData.ts"
    click HookMobile "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/hooks/use-mobile.tsx"
    click HookToast "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/hooks/use-toast.ts"
    click Utils "https://github.com/mukulsonker/curana-risk-compass/blob/main/src/lib/utils.ts"

    %% Styles
    classDef deployment fill:#D6EAF8,stroke:#1B4F72
    classDef runtime fill:#D5F5E3,stroke:#1D8348
    classDef domain fill:#F9E79F,stroke:#B7950B
    classDef primitive fill:#FADBD8,stroke:#C0392B
    classDef service fill:#D2B4DE,stroke:#6C3483
    classDef hook fill:#F5CBA7,stroke:#AF601A
    classDef util fill:#ABEBC6,stroke:#1E8449
```
