# tantikristanti/cohort_demo_project architecture

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

- Interactive diagram: https://gitdiagram.com/tantikristanti/cohort_demo_project
- Repository: https://github.com/tantikristanti/cohort_demo_project

## Overview

This repository demonstrates synthetic maternal-child cohort analysis through parallel R and Python workflows. The main user journey is to generate cohort data, clean and validate it, then produce descriptive summaries and statistical model results. The README identifies R as the primary implementation and Python as a complementary one; Python source excerpts confirm file-level data transfers and analysis outputs. R implementation details are not sampled, so its links reflect only the README’s documented execution order and capabilities.

Main entry points: [`scripts/R/02_clean_and_validate.R`](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/02_clean_and_validate.R) (Clean and validate), [`scripts/R/01_generate_data.R`](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/01_generate_data.R) (Generate cohort), [`data/processed`](https://github.com/tantikristanti/cohort_demo_project/tree/main/data/processed) (Cleaned cohort data), [`scripts/R/03_descriptive_analysis.R`](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/03_descriptive_analysis.R) (Descriptive analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_r["R analysis"]
  node_r_generate["Generate cohort<br/>[01_generate_data.R]"]
  node_r_clean["Clean and validate"]
  node_r_describe["Descriptive analysis"]
  node_r_model["Statistical modeling"]
end

subgraph group_py["Python analysis"]
  node_py_generate["Generate cohort"]
  node_py_clean["Clean and validate"]
  node_py_describe["Descriptive analysis"]
  node_py_model["Statistical modeling"]
end

subgraph group_artifacts["Cohort artifacts"]
  node_raw["Raw cohort data"]
  node_cleaned["Cleaned cohort data"]
end

subgraph group_results["Analysis results"]
  node_descriptive["Tables and plots"]
  node_model_results["Model outputs"]
end

node_analyst(("Analyst"))

node_analyst -->|"runs workflow"| node_r_generate
node_r_generate -->|"then runs"| node_r_clean
node_r_clean -->|"then runs"| node_r_describe
node_r_describe -->|"then runs"| node_r_model
node_analyst -->|"runs workflow"| node_py_generate
node_py_generate -->|"writes CSV"| node_raw
node_py_clean -->|"reads CSV"| node_raw
node_py_clean -->|"writes cleaned data"| node_cleaned
node_cleaned -->|"provides input"| node_py_describe
node_py_describe -->|"writes tables and plots"| node_descriptive
node_cleaned -->|"provides input"| node_py_model
node_py_model -->|"writes odds ratios and ROC"| node_model_results
node_r_generate -->|"generates then cleans"| node_r_clean
node_r_clean -->|"produces profiling input"| node_r_describe
node_r_model -.->|"produces model results"| node_model_results

click node_r_generate "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/01_generate_data.R"
click node_r_clean "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/02_clean_and_validate.R"
click node_r_describe "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/03_descriptive_analysis.R"
click node_r_model "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/04_statistical_modeling.R"
click node_py_generate "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/01_generate_data.py"
click node_py_clean "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/02_clean_and_validate.py"
click node_py_describe "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/03_descriptive_analysis.py"
click node_py_model "https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/04_statistical_modeling.py"
click node_raw "https://github.com/tantikristanti/cohort_demo_project/tree/main/data/raw"
click node_cleaned "https://github.com/tantikristanti/cohort_demo_project/tree/main/data/processed"
click node_descriptive "https://github.com/tantikristanti/cohort_demo_project/tree/main/outputs"
click node_model_results "https://github.com/tantikristanti/cohort_demo_project/tree/main/outputs"

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_r_generate,node_r_clean,node_r_describe,node_r_model toneBlue
class node_py_generate,node_py_clean,node_py_describe,node_py_model toneAmber
class node_raw,node_cleaned toneMint
class node_descriptive,node_model_results toneRose
class node_analyst toneIndigo
```

## Components

### R analysis

- [Generate cohort](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/01_generate_data.R): `scripts/R/01_generate_data.R`
- [Clean and validate](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/02_clean_and_validate.R): `scripts/R/02_clean_and_validate.R`
- [Descriptive analysis](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/03_descriptive_analysis.R): `scripts/R/03_descriptive_analysis.R`
- [Statistical modeling](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/R/04_statistical_modeling.R): `scripts/R/04_statistical_modeling.R`

### Python analysis

- [Generate cohort](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/01_generate_data.py): `scripts/python/01_generate_data.py`
- [Clean and validate](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/02_clean_and_validate.py): `scripts/python/02_clean_and_validate.py`
- [Descriptive analysis](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/03_descriptive_analysis.py): `scripts/python/03_descriptive_analysis.py`
- [Statistical modeling](https://github.com/tantikristanti/cohort_demo_project/blob/main/scripts/python/04_statistical_modeling.py): `scripts/python/04_statistical_modeling.py`

### Cohort artifacts

- [Raw cohort data](https://github.com/tantikristanti/cohort_demo_project/tree/main/data/raw): `data/raw`
- [Cleaned cohort data](https://github.com/tantikristanti/cohort_demo_project/tree/main/data/processed): `data/processed`

### Analysis results

- [Tables and plots](https://github.com/tantikristanti/cohort_demo_project/tree/main/outputs): `outputs`
- [Model outputs](https://github.com/tantikristanti/cohort_demo_project/tree/main/outputs): `outputs`

### Other components

- **Analyst**

## Connections

- Analyst → Generate cohort: runs workflow (evidence: `README.md`)
- Generate cohort → Clean and validate: then runs (evidence: `README.md`)
- Clean and validate → Descriptive analysis: then runs (evidence: `README.md`)
- Descriptive analysis → Statistical modeling: then runs (evidence: `README.md`)
- Analyst → Generate cohort: runs workflow (evidence: `README.md`)
- Generate cohort → Raw cohort data: writes CSV (evidence: `scripts/python/01_generate_data.py`)
- Clean and validate → Raw cohort data: reads CSV (evidence: `scripts/python/02_clean_and_validate.py`)
- Clean and validate → Cleaned cohort data: writes cleaned data (evidence: `scripts/python/02_clean_and_validate.py`)
- Cleaned cohort data → Descriptive analysis: provides input (evidence: `scripts/python/03_descriptive_analysis.py`)
- Descriptive analysis → Tables and plots: writes tables and plots (evidence: `scripts/python/03_descriptive_analysis.py`)
- Cleaned cohort data → Statistical modeling: provides input (evidence: `scripts/python/04_statistical_modeling.py`)
- Statistical modeling → Model outputs: writes odds ratios and ROC (evidence: `scripts/python/04_statistical_modeling.py`)
- Generate cohort → Clean and validate: generates then cleans (evidence: `README.md`)
- Clean and validate → Descriptive analysis: produces profiling input (evidence: `README.md`)
- Statistical modeling → Model outputs: produces model results (evidence: `README.md`)
