# rizwanhamka/kelompok2_satusehat architecture

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

- Interactive diagram: https://gitdiagram.com/rizwanhamka/kelompok2_satusehat
- Repository: https://github.com/rizwanhamka/kelompok2_satusehat

## Overview

SATU SEHAT API is a Flask backend that exposes FHIR R4 operations against the SATU SEHAT Sandbox. Users can search patients and practitioners by NIK, create locations, or create encounters; encounter creation itself retrieves the patient and practitioner, creates a location, then creates the encounter. Results are also recorded in SQLite. The graph reflects the sampled app.py code and README capabilities; Swagger is documented, but its setup details and some endpoint implementation excerpts were not shown.

Main entry points: [`app.py`](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py) (Encounter creation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API operations"]
  node_patient["Patient search<br/>[app.py]"]
  node_practitioner["Practitioner search<br/>[app.py]"]
  node_location["Location creation<br/>[app.py]"]
  node_encounter["Encounter creation<br/>[app.py]"]
  node_encounters["Encounter listing<br/>[app.py]"]
end

subgraph group_integration["SATU SEHAT integration"]
  node_token["OAuth token<br/>[app.py]"]
  node_satusehat{{"SATU SEHAT FHIR API"}}
end

subgraph group_storage["Local persistence"]
  node_database[("SQLite database<br/>[app.py]")]
end

subgraph group_docs["API documentation"]
  node_swagger["Swagger UI<br/>[app.py]"]
end

node_user(("API user"))

node_user -->|"searches"| node_patient
node_user -->|"searches"| node_practitioner
node_user -->|"creates"| node_location
node_user -->|"creates"| node_encounter
node_user -->|"lists"| node_encounters
node_patient -->|"gets token"| node_token
node_practitioner -->|"gets token"| node_token
node_location -->|"gets token"| node_token
node_encounter -->|"gets token"| node_token
node_token -->|"requests token"| node_satusehat
node_patient -->|"searches FHIR"| node_satusehat
node_practitioner -->|"searches FHIR"| node_satusehat
node_location -->|"posts Location"| node_satusehat
node_encounter -->|"reads Patient"| node_satusehat
node_encounter -->|"reads Practitioner"| node_satusehat
node_encounter -->|"posts Location"| node_satusehat
node_encounter -->|"posts Encounter"| node_satusehat
node_patient -->|"stores result"| node_database
node_practitioner -->|"stores result"| node_database
node_location -->|"stores result"| node_database
node_encounter -->|"stores result"| node_database
node_encounters -->|"reads records"| node_database
node_user -->|"tests API"| node_swagger

click node_patient "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_practitioner "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_location "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_encounter "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_encounters "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_token "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_database "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py"
click node_swagger "https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.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_patient,node_practitioner,node_location,node_encounter,node_encounters,node_user toneBlue
class node_token,node_satusehat toneAmber
class node_database toneMint
class node_swagger toneRose
```

## Components

### API operations

- [Patient search](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`
- [Practitioner search](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`
- [Location creation](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`
- [Encounter creation](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`
- [Encounter listing](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`

### SATU SEHAT integration

- [OAuth token](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`
- **SATU SEHAT FHIR API**

### Local persistence

- [SQLite database](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`

### API documentation

- [Swagger UI](https://github.com/rizwanhamka/kelompok2_satusehat/blob/main/app.py): `app.py`

### Other components

- **API user**

## Connections

- API user → Patient search: searches (evidence: `README.md`)
- API user → Practitioner search: searches (evidence: `README.md`)
- API user → Location creation: creates (evidence: `README.md`)
- API user → Encounter creation: creates (evidence: `README.md`)
- API user → Encounter listing: lists (evidence: `app.py`)
- Patient search → OAuth token: gets token (evidence: `app.py`)
- Practitioner search → OAuth token: gets token (evidence: `app.py`)
- Location creation → OAuth token: gets token (evidence: `app.py`)
- Encounter creation → OAuth token: gets token (evidence: `app.py`)
- OAuth token → SATU SEHAT FHIR API: requests token (evidence: `app.py`)
- Patient search → SATU SEHAT FHIR API: searches FHIR (evidence: `app.py`)
- Practitioner search → SATU SEHAT FHIR API: searches FHIR (evidence: `app.py`)
- Location creation → SATU SEHAT FHIR API: posts Location (evidence: `app.py`)
- Encounter creation → SATU SEHAT FHIR API: reads Patient (evidence: `app.py`)
- Encounter creation → SATU SEHAT FHIR API: reads Practitioner (evidence: `app.py`)
- Encounter creation → SATU SEHAT FHIR API: posts Location (evidence: `app.py`)
- Encounter creation → SATU SEHAT FHIR API: posts Encounter (evidence: `app.py`)
- Patient search → SQLite database: stores result (evidence: `app.py`)
- Practitioner search → SQLite database: stores result (evidence: `app.py`)
- Location creation → SQLite database: stores result (evidence: `app.py`)
- Encounter creation → SQLite database: stores result (evidence: `app.py`)
- Encounter listing → SQLite database: reads records (evidence: `app.py`)
- API user → Swagger UI: tests API (evidence: `README.md`)
