# itsasmaa/know-your-normal architecture

> Architecture diagram of the GitHub repository itsasmaa/know-your-normal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itsasmaa/know-your-normal
- Repository: https://github.com/itsasmaa/know-your-normal

## Overview

Know Your Normal is a synthetic astronaut-health monitoring dashboard. The main workflow loads crew-day records, combines them with browser check-ins, analyzes each crew member against their first 30 mission days, and presents statuses, trends, emotion history, and pattern scores as the user replays mission days. Users can add simulated readings, compare crew, and export reports or CSV data. The README also documents a Streamlit entry point. Edges reflect shown imports and calls or README statements; unsampled feature wiring is omitted where it cannot be verified.

Main entry points: [`src/App.tsx`](https://github.com/itsasmaa/know-your-normal/blob/main/src/App.tsx) (Dashboard coordinator), [`src/lib/engine.ts`](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/engine.ts) (Rule-based analysis), [`src/components/PatternSection.tsx`](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/PatternSection.tsx) (Pattern check), [`src/lib/data.ts`](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/data.ts) (CSV data parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_app["Dashboard coordinator<br/>[App.tsx]"]
  node_status["Status cards<br/>[StatusCards.tsx]"]
  node_trends["Health trends<br/>[TrendCharts.tsx]"]
  node_emotion["Emotion history<br/>[EmotionSection.tsx]"]
  node_pattern["Pattern check<br/>[PatternSection.tsx]"]
  node_crew["Crew comparison<br/>[CrewTable.tsx]"]
  node_checkin["Daily check-in<br/>[CheckInForm.tsx]"]
  node_report["Surgeon report<br/>[engine.ts]"]
  node_streamlit["Streamlit dashboard<br/>[app.py]"]
end

subgraph group_records["Crew records"]
  node_csv[("Supplied crew records<br/>[crew_daily.csv]")]
  node_parser["CSV data parser<br/>[data.ts]"]
  node_types["Health record types<br/>[types.ts]"]
end

subgraph group_analysis["Health analysis"]
  node_model["Rule-based analysis<br/>[engine.ts]"]
  node_constants["Rule constants<br/>[engineConstants.ts]"]
  node_forest["Isolation Forest<br/>[iforest.ts]"]
  node_reference["scikit-learn reference"]
end

subgraph group_persistence["Browser state and exports"]
  node_browser["Browser storage and export<br/>[browser.ts]"]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_app
node_app -->|"loads records"| node_parser
node_csv -->|"parsed by"| node_parser
node_app -->|"analyzes crew"| node_model
node_model -->|"uses rules"| node_constants
node_model -->|"scores patterns"| node_forest
node_app -->|"renders"| node_status
node_app -->|"renders"| node_trends
node_app -->|"renders"| node_emotion
node_app -->|"renders"| node_pattern
node_app -->|"renders"| node_crew
node_app -->|"renders"| node_checkin
node_emotion -->|"reads analysis"| node_model
node_pattern -->|"reads analysis"| node_model
node_pattern -->|"plots comparison"| node_reference
node_checkin -->|"collects readings"| node_user
node_app -->|"loads and saves"| node_browser
node_app -->|"shows report"| node_report
node_app -->|"exports data"| node_browser
node_parser -->|"creates rows"| node_types
node_streamlit -->|"presents dashboard"| node_user

click node_app "https://github.com/itsasmaa/know-your-normal/blob/main/src/App.tsx"
click node_status "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/StatusCards.tsx"
click node_trends "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/TrendCharts.tsx"
click node_emotion "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/EmotionSection.tsx"
click node_pattern "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/PatternSection.tsx"
click node_crew "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/CrewTable.tsx"
click node_checkin "https://github.com/itsasmaa/know-your-normal/blob/main/src/components/CheckInForm.tsx"
click node_report "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/engine.ts"
click node_streamlit "https://github.com/itsasmaa/know-your-normal/blob/main/app.py"
click node_csv "https://github.com/itsasmaa/know-your-normal/blob/main/src/data/crew_daily.csv"
click node_parser "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/data.ts"
click node_model "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/engine.ts"
click node_constants "https://github.com/itsasmaa/know-your-normal/blob/main/src/data/engineConstants.ts"
click node_forest "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/iforest.ts"
click node_reference "https://github.com/itsasmaa/know-your-normal/blob/main/src/data/sklearnReference.ts"
click node_browser "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/browser.ts"
click node_types "https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/types.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_app,node_status,node_trends,node_emotion,node_pattern,node_crew,node_checkin,node_report,node_streamlit,node_user toneBlue
class node_csv,node_parser,node_types toneAmber
class node_model,node_constants,node_forest,node_reference toneMint
class node_browser toneRose
```

## Components

### Dashboard experience

- [Dashboard coordinator](https://github.com/itsasmaa/know-your-normal/blob/main/src/App.tsx): `src/App.tsx`
- [Status cards](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/StatusCards.tsx): `src/components/StatusCards.tsx`
- [Health trends](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/TrendCharts.tsx): `src/components/TrendCharts.tsx`
- [Emotion history](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/EmotionSection.tsx): `src/components/EmotionSection.tsx`
- [Pattern check](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/PatternSection.tsx): `src/components/PatternSection.tsx`
- [Crew comparison](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/CrewTable.tsx): `src/components/CrewTable.tsx`
- [Daily check-in](https://github.com/itsasmaa/know-your-normal/blob/main/src/components/CheckInForm.tsx): `src/components/CheckInForm.tsx`
- [Surgeon report](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/engine.ts): `src/lib/engine.ts`
- [Streamlit dashboard](https://github.com/itsasmaa/know-your-normal/blob/main/app.py): `app.py`

### Crew records

- [Supplied crew records](https://github.com/itsasmaa/know-your-normal/blob/main/src/data/crew_daily.csv): `src/data/crew_daily.csv`
- [CSV data parser](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/data.ts): `src/lib/data.ts`
- [Health record types](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/types.ts): `src/lib/types.ts`

### Health analysis

- [Rule-based analysis](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/engine.ts): `src/lib/engine.ts`
- [Rule constants](https://github.com/itsasmaa/know-your-normal/blob/main/src/data/engineConstants.ts): `src/data/engineConstants.ts`
- [Isolation Forest](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/iforest.ts): `src/lib/iforest.ts`
- [scikit-learn reference](https://github.com/itsasmaa/know-your-normal/blob/main/src/data/sklearnReference.ts): `src/data/sklearnReference.ts`

### Browser state and exports

- [Browser storage and export](https://github.com/itsasmaa/know-your-normal/blob/main/src/lib/browser.ts): `src/lib/browser.ts`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard coordinator: uses (evidence: `README.md`)
- Dashboard coordinator → CSV data parser: loads records (evidence: `src/App.tsx`)
- Supplied crew records → CSV data parser: parsed by (evidence: `README.md`)
- Dashboard coordinator → Rule-based analysis: analyzes crew (evidence: `src/App.tsx`)
- Rule-based analysis → Rule constants: uses rules (evidence: `src/lib/engine.ts`)
- Rule-based analysis → Isolation Forest: scores patterns (evidence: `src/lib/engine.ts`)
- Dashboard coordinator → Status cards: renders (evidence: `src/App.tsx`)
- Dashboard coordinator → Health trends: renders (evidence: `src/App.tsx`)
- Dashboard coordinator → Emotion history: renders (evidence: `src/App.tsx`)
- Dashboard coordinator → Pattern check: renders (evidence: `src/App.tsx`)
- Dashboard coordinator → Crew comparison: renders (evidence: `src/App.tsx`)
- Dashboard coordinator → Daily check-in: renders (evidence: `src/App.tsx`)
- Emotion history → Rule-based analysis: reads analysis (evidence: `src/components/EmotionSection.tsx`)
- Pattern check → Rule-based analysis: reads analysis (evidence: `src/components/PatternSection.tsx`)
- Pattern check → scikit-learn reference: plots comparison (evidence: `src/components/PatternSection.tsx`)
- Daily check-in → Dashboard user: collects readings (evidence: `README.md`)
- Dashboard coordinator → Browser storage and export: loads and saves (evidence: `src/App.tsx`)
- Dashboard coordinator → Surgeon report: shows report (evidence: `README.md`)
- Dashboard coordinator → Browser storage and export: exports data (evidence: `README.md`)
- CSV data parser → Health record types: creates rows (evidence: `src/lib/data.ts`)
- Streamlit dashboard → Dashboard user: presents dashboard (evidence: `README.md`)
