# gourav-s-m/sakhicare architecture

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

- Interactive diagram: https://gitdiagram.com/gourav-s-m/sakhicare
- Repository: https://github.com/gourav-s-m/sakhicare

## Overview

SakhiCare is a Bengaluru menstrual-health platform for finding resources, accessing educational guidance, and privately tracking periods. The user workflow enters through the React app, then branches into resource discovery, coverage, AI guidance, emergency/healthcare listings, learning, and an on-device calendar. Backend API handlers own database-backed operations; the calendar remains local. The README documents mapping and AI integrations, but unsampled implementation details are not inferred, so some external links are omitted or marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/App.tsx) (Web Router), [`backend/app/core/database.py`](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/core/database.py) (PostgreSQL Store), [`backend/app/main.py`](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/main.py) (FastAPI Application), [`backend/app/api/v1/resources.py`](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/resources.py) (Resource Endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Experience"]
  node_app["Web Router<br/>[App.tsx]"]
end

subgraph group_discovery["Resource Discovery"]
  node_explore["Resource Explorer<br/>[ExplorePage.tsx]"]
  node_map["Resource Map<br/>[ResourceMap.tsx]"]
  node_resource_client["Resource API Client<br/>[resourceApi.ts]"]
  node_coverage_client["Coverage API Client<br/>[coverageApi.ts]"]
  node_coverage_types["Coverage Types<br/>[coverage.ts]"]
  node_resource_types["Resource Types<br/>[resource.ts]"]
  node_osm["OSM Ingestion<br/>[osm_ingestion.py]"]
end

subgraph group_guidance["Health Guidance"]
  node_ai_page["AI Chat<br/>[AiChatPage.tsx]"]
  node_rag["RAG Guidance<br/>[rag.py]"]
  node_learn["Learning Content<br/>[LearnPage.tsx]"]
  node_finder_page["Emergency Finder<br/>[EmergencyPage.tsx]"]
  node_healthcare_page["Healthcare Finder<br/>[HealthcarePage.tsx]"]
end

subgraph group_backend["API Platform"]
  node_resources_api["Resource Endpoints<br/>[resources.py]"]
  node_coverage_api["Coverage Grid<br/>[coverage.py]"]
  node_localities["Bengaluru Localities<br/>[localities.py]"]
  node_scoring["Resource Scoring<br/>[scoring.py]"]
  node_database[("PostgreSQL Store<br/>[database.py]")]
  node_ai_api["AI Endpoint<br/>[ai.py]"]
  node_finder_api["Finder Endpoints<br/>[services.py]"]
  node_reports_api["Resource Reports<br/>[reports.py]"]
  node_report_service["Report Processing<br/>[reports.py]"]
  node_api_main["FastAPI Application<br/>[main.py]"]
end

subgraph group_privacy["Private Tracking"]
  node_calendar["Cycle Calendar<br/>[CalendarPage.tsx]"]
  node_cycle_storage[("Local Cycle Store<br/>[cycleStorage.ts]")]
  node_cycle_estimator["Cycle Estimates<br/>[cycleEstimator.ts]"]
end

node_visitor(("Visitor"))
node_gemini["Google Gemini"]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_explore
node_app -->|"routes to"| node_ai_page
node_app -->|"routes to"| node_calendar
node_app -->|"routes to"| node_learn
node_app -->|"routes to"| node_finder_page
node_app -->|"routes to"| node_healthcare_page
node_explore -->|"loads resources"| node_resource_client
node_explore -->|"loads coverage"| node_coverage_client
node_explore -->|"renders map"| node_map
node_map -->|"uses types"| node_resource_types
node_map -->|"uses types"| node_coverage_types
node_coverage_client -->|"returns data"| node_coverage_types
node_resource_client -.->|"requests resources"| node_resources_api
node_coverage_client -.->|"requests grid"| node_coverage_api
node_api_main -->|"registers"| node_resources_api
node_api_main -->|"registers"| node_coverage_api
node_api_main -->|"registers"| node_ai_api
node_api_main -->|"registers"| node_finder_api
node_api_main -->|"registers"| node_reports_api
node_resources_api -->|"queries"| node_database
node_resources_api -->|"scores results"| node_scoring
node_resources_api -->|"uses locality data"| node_localities
node_coverage_api -->|"counts resources"| node_database
node_coverage_api -->|"uses locality data"| node_localities
node_osm -.->|"ingests records"| node_database
node_ai_page -.->|"sends queries"| node_ai_api
node_ai_api -->|"requests answers"| node_rag
node_ai_api -->|"loads context"| node_database
node_rag -.->|"generates guidance"| node_gemini
node_finder_page -.->|"requests listings"| node_finder_api
node_healthcare_page -.->|"requests listings"| node_finder_api
node_finder_api -->|"queries listings"| node_database
node_calendar -->|"reads and writes"| node_cycle_storage
node_calendar -->|"estimates cycles"| node_cycle_estimator
node_reports_api -->|"stores reports"| node_database
node_reports_api -->|"processes reports"| node_report_service

click node_app "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/App.tsx"
click node_explore "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/ExplorePage.tsx"
click node_map "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/components/map/ResourceMap.tsx"
click node_resource_client "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/resourceApi.ts"
click node_coverage_client "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/coverageApi.ts"
click node_coverage_types "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/types/coverage.ts"
click node_resource_types "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/types/resource.ts"
click node_resources_api "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/resources.py"
click node_coverage_api "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/coverage.py"
click node_localities "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/core/localities.py"
click node_scoring "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/scoring.py"
click node_database "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/core/database.py"
click node_osm "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/osm_ingestion.py"
click node_ai_page "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/AiChatPage.tsx"
click node_ai_api "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/ai.py"
click node_rag "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/rag.py"
click node_learn "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/LearnPage.tsx"
click node_finder_page "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/EmergencyPage.tsx"
click node_healthcare_page "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/HealthcarePage.tsx"
click node_finder_api "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/finders/services.py"
click node_calendar "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/CalendarPage.tsx"
click node_cycle_storage "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/calendar/cycleStorage.ts"
click node_cycle_estimator "https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/calendar/cycleEstimator.ts"
click node_reports_api "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/reports.py"
click node_report_service "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/reports.py"
click node_api_main "https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/main.py"

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 toneBlue
class node_explore,node_map,node_resource_client,node_coverage_client,node_coverage_types,node_resource_types,node_osm toneAmber
class node_ai_page,node_rag,node_learn,node_finder_page,node_healthcare_page toneMint
class node_resources_api,node_coverage_api,node_localities,node_scoring,node_database,node_ai_api,node_finder_api,node_reports_api,node_report_service,node_api_main toneRose
class node_calendar,node_cycle_storage,node_cycle_estimator,node_visitor,node_gemini toneIndigo
```

## Components

### Web Experience

- [Web Router](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### Resource Discovery

- [Resource Explorer](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/ExplorePage.tsx): `frontend/src/pages/ExplorePage.tsx`
- [Resource Map](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/components/map/ResourceMap.tsx): `frontend/src/components/map/ResourceMap.tsx`
- [Resource API Client](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/resourceApi.ts): `frontend/src/services/resourceApi.ts`
- [Coverage API Client](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/coverageApi.ts): `frontend/src/services/coverageApi.ts`
- [Coverage Types](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/types/coverage.ts): `frontend/src/types/coverage.ts`
- [Resource Types](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/types/resource.ts): `frontend/src/types/resource.ts`
- [OSM Ingestion](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/osm_ingestion.py): `backend/app/services/osm_ingestion.py`

### Health Guidance

- [AI Chat](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/AiChatPage.tsx): `frontend/src/pages/AiChatPage.tsx`
- [RAG Guidance](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/rag.py): `backend/app/services/rag.py`
- [Learning Content](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/LearnPage.tsx): `frontend/src/pages/LearnPage.tsx`
- [Emergency Finder](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/EmergencyPage.tsx): `frontend/src/pages/EmergencyPage.tsx`
- [Healthcare Finder](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/HealthcarePage.tsx): `frontend/src/pages/HealthcarePage.tsx`

### API Platform

- [Resource Endpoints](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/resources.py): `backend/app/api/v1/resources.py`
- [Coverage Grid](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/coverage.py): `backend/app/api/v1/coverage.py`
- [Bengaluru Localities](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/core/localities.py): `backend/app/core/localities.py`
- [Resource Scoring](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/scoring.py): `backend/app/services/scoring.py`
- [PostgreSQL Store](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [AI Endpoint](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/ai.py): `backend/app/api/v1/ai.py`
- [Finder Endpoints](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/finders/services.py): `backend/app/api/v1/finders/services.py`
- [Resource Reports](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/api/v1/reports.py): `backend/app/api/v1/reports.py`
- [Report Processing](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/services/reports.py): `backend/app/services/reports.py`
- [FastAPI Application](https://github.com/gourav-s-m/sakhicare/blob/main/backend/app/main.py): `backend/app/main.py`

### Private Tracking

- [Cycle Calendar](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/pages/CalendarPage.tsx): `frontend/src/pages/CalendarPage.tsx`
- [Local Cycle Store](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/calendar/cycleStorage.ts): `frontend/src/services/calendar/cycleStorage.ts`
- [Cycle Estimates](https://github.com/gourav-s-m/sakhicare/blob/main/frontend/src/services/calendar/cycleEstimator.ts): `frontend/src/services/calendar/cycleEstimator.ts`

### Other components

- **Visitor**
- **Google Gemini**

## Connections

- Visitor → Web Router: opens
- Web Router → Resource Explorer: routes to (evidence: `frontend/src/App.tsx`)
- Web Router → AI Chat: routes to (evidence: `frontend/src/App.tsx`)
- Web Router → Cycle Calendar: routes to (evidence: `frontend/src/App.tsx`)
- Web Router → Learning Content: routes to (evidence: `frontend/src/App.tsx`)
- Web Router → Emergency Finder: routes to (evidence: `frontend/src/App.tsx`)
- Web Router → Healthcare Finder: routes to (evidence: `frontend/src/App.tsx`)
- Resource Explorer → Resource API Client: loads resources (evidence: `frontend/src/pages/ExplorePage.tsx`)
- Resource Explorer → Coverage API Client: loads coverage (evidence: `frontend/src/pages/ExplorePage.tsx`)
- Resource Explorer → Resource Map: renders map (evidence: `frontend/src/pages/ExplorePage.tsx`)
- Resource Map → Resource Types: uses types (evidence: `frontend/src/components/map/ResourceMap.tsx`)
- Resource Map → Coverage Types: uses types (evidence: `frontend/src/components/map/ResourceMap.tsx`)
- Coverage API Client → Coverage Types: returns data (evidence: `frontend/src/services/coverageApi.ts`)
- Resource API Client → Resource Endpoints: requests resources
- Coverage API Client → Coverage Grid: requests grid
- FastAPI Application → Resource Endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI Application → Coverage Grid: registers (evidence: `backend/app/main.py`)
- FastAPI Application → AI Endpoint: registers (evidence: `backend/app/main.py`)
- FastAPI Application → Finder Endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI Application → Resource Reports: registers (evidence: `backend/app/main.py`)
- Resource Endpoints → PostgreSQL Store: queries (evidence: `backend/app/api/v1/resources.py`)
- Resource Endpoints → Resource Scoring: scores results (evidence: `backend/app/api/v1/resources.py`)
- Resource Endpoints → Bengaluru Localities: uses locality data (evidence: `backend/app/api/v1/resources.py`)
- Coverage Grid → PostgreSQL Store: counts resources (evidence: `backend/app/api/v1/coverage.py`)
- Coverage Grid → Bengaluru Localities: uses locality data (evidence: `backend/app/api/v1/coverage.py`)
- OSM Ingestion → PostgreSQL Store: ingests records
- AI Chat → AI Endpoint: sends queries
- AI Endpoint → RAG Guidance: requests answers (evidence: `backend/app/api/v1/ai.py`)
- AI Endpoint → PostgreSQL Store: loads context (evidence: `backend/app/api/v1/ai.py`)
- RAG Guidance → Google Gemini: generates guidance
- Emergency Finder → Finder Endpoints: requests listings
- Healthcare Finder → Finder Endpoints: requests listings
- Finder Endpoints → PostgreSQL Store: queries listings (evidence: `backend/app/api/v1/finders/services.py`)
- Cycle Calendar → Local Cycle Store: reads and writes (evidence: `frontend/src/pages/CalendarPage.tsx`)
- Cycle Calendar → Cycle Estimates: estimates cycles (evidence: `frontend/src/pages/CalendarPage.tsx`)
- Resource Reports → PostgreSQL Store: stores reports (evidence: `backend/app/api/v1/reports.py`)
- Resource Reports → Report Processing: processes reports (evidence: `backend/app/api/v1/reports.py`)
