# yash8mehra/chesttube-synthetic-data architecture

> Architecture diagram of the GitHub repository yash8mehra/chesttube-synthetic-data, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash8mehra/chesttube-synthetic-data
- Repository: https://github.com/yash8mehra/chesttube-synthetic-data

## Overview

#### Purpose
This repository appears to analyze chest-tube removal timing from tabular clinical-event data. It produces patient statistics, feature summaries, removal decisions, and predicted removal outcomes. There is no README or visible package structure, so behavior must be inferred from the scripts and generated artifacts.

#### Entry Points
- `tableFlow.py` is likely the primary data-processing entry point: its name and nearby `.tab` inputs suggest it converts or joins event tables into analysis-ready records.
- `SyntheticGraphs.py` is a secondary entry point for producing synthetic/derived graphs or visualizations from the processed data.
- The root directory has no application server, CLI wrapper, or dependency manifest; execution is likely direct Python-script invocation.

#### Source Event Data
The pipeline is centered on three tab-delimited event sources:
- `cxr_events.tab` — likely chest X-ray events.
- `flow_pump_events.tab` — likely drainage/flow-pump observations.
- `ct_removal_time.tab` — chest-tube removal timestamps or labels.

These files form the primary boundary between raw clinical/event data and the repository’s derived decision outputs.

#### Feature and Decision Pipeline
The `removal/` directory represents the main model/decision stage:
- `removal/hourly_feature_summary.csv` likely contains time-bucketed features derived from the event tables.
- `removal/hourly_removal_decisions.csv` likely records an hourly eligibility or removal decision.
- `removal/removal_predictions.csv` likely contains prediction outputs, potentially at patient/tube/time granularity.
- `removal/force_no_removal_report.csv` captures cases excluded or overridden to “do not remove.”

The likely control flow is: ingest event tables → align observations by time → aggregate hourly features → apply decision/prediction logic → emit reports.

#### Outcome and Quality Analysis
Root-level reports provide aggregate evaluation or cohort characterization:
- `patient_statistics.txt`
- `patient_statistics_differences.txt`

These likely compare patient groups, prediction behavior, or differences between observed removal timing and generated decisions. They are downstream analysis artifacts rather than input sources.

#### Runtime and External Boundaries
The visible runtime is Python, based on `tableFlow.py` and `SyntheticGraphs.py`. No dependency files, database connectors, cloud configuration, service definitions, or web runtime are present in the tree. The repository appears file-oriented: tab-delimited inputs and CSV/text outputs are the principal persistence and integration mechanisms.

#### Architectural Constraints
The central coupling is temporal: chest X-ray events, pump-flow events, and removal times must be reconciled into hourly records before decisions can be made. The `removal/` outputs should therefore be treated as a coherent generated dataset; changes to feature construction or time alignment in `tableFlow.py` may affect every downstream CSV and patient-statistics report.

Main entry points: [`tableFlow.py`](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/tableFlow.py) (Table flow processor), [`removal/removal_predictions.csv`](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/removal_predictions.csv) (Removal predictions), [`ct_removal_time.tab`](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/ct_removal_time.tab) (Removal timestamps), [`removal/hourly_feature_summary.csv`](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/hourly_feature_summary.csv) (Hourly feature summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Clinical event inputs"]
  node_cxr["Chest X-ray events<br/>tabular input<br/>[cxr_events.tab]"]
  node_flow["Pump-flow events<br/>tabular input"]
  node_removal_times["Removal timestamps<br/>tabular input"]
end

subgraph group_pipeline["Python processing"]
  node_table_flow["Table flow processor<br/>Python entry point<br/>[tableFlow.py]"]
  node_time_alignment["Temporal alignment<br/>processing stage"]
  node_decision_logic["Removal decision logic<br/>decision stage"]
  node_synthetic_graphs["Synthetic graph generator<br/>Python entry point<br/>[SyntheticGraphs.py]"]
end

subgraph group_outputs["Generated analysis"]
  node_hourly_features["Hourly feature summary<br/>feature dataset"]
  node_hourly_decisions["Hourly removal decisions<br/>decision dataset"]
  node_predictions["Removal predictions<br/>prediction dataset"]
  node_no_removal["No-removal overrides<br/>exception report"]
  node_patient_stats["Patient statistics<br/>analysis report"]
  node_patient_diffs["Patient-statistics differences<br/>comparison report"]
end

node_cxr -->|"ingest"| node_table_flow
node_flow -->|"ingest"| node_table_flow
node_removal_times -->|"ingest labels"| node_table_flow
node_table_flow -->|"process events"| node_time_alignment
node_time_alignment -->|"aggregate hourly"| node_hourly_features
node_hourly_features -->|"feature input"| node_decision_logic
node_removal_times -.->|"removal reference"| node_decision_logic
node_decision_logic -->|"emit decisions"| node_hourly_decisions
node_decision_logic -->|"emit predictions"| node_predictions
node_decision_logic -->|"report overrides"| node_no_removal
node_predictions -->|"summarize"| node_patient_stats
node_hourly_decisions -->|"compare"| node_patient_diffs
node_predictions -.->|"derived visualization input"| node_synthetic_graphs

click node_cxr "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/cxr_events.tab"
click node_flow "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/flow_pump_events.tab"
click node_removal_times "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/ct_removal_time.tab"
click node_table_flow "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/tableFlow.py"
click node_hourly_features "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/hourly_feature_summary.csv"
click node_hourly_decisions "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/hourly_removal_decisions.csv"
click node_predictions "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/removal_predictions.csv"
click node_no_removal "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/force_no_removal_report.csv"
click node_synthetic_graphs "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/SyntheticGraphs.py"
click node_patient_stats "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/patient_statistics.txt"
click node_patient_diffs "https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/patient_statistics_differences.txt"

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_cxr,node_flow,node_removal_times toneBlue
class node_table_flow,node_time_alignment,node_decision_logic,node_synthetic_graphs toneAmber
class node_hourly_features,node_hourly_decisions,node_predictions,node_no_removal,node_patient_stats,node_patient_diffs toneMint
```

## Components

### Clinical event inputs

Tab-delimited source events.

- [Chest X-ray events](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/cxr_events.tab): tabular input · `cxr_events.tab`
- [Pump-flow events](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/flow_pump_events.tab): tabular input · `flow_pump_events.tab`
- [Removal timestamps](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/ct_removal_time.tab): tabular input · `ct_removal_time.tab`

### Python processing

Temporal feature and decision pipeline.

- [Table flow processor](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/tableFlow.py): Python entry point · Primary event-table processing script. · `tableFlow.py`
- **Temporal alignment**: processing stage · Reconciles clinical observations into hourly records.
- **Removal decision logic**: decision stage · Determines hourly removal eligibility.
- [Synthetic graph generator](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/SyntheticGraphs.py): Python entry point · Produces derived graphs or visualizations. · `SyntheticGraphs.py`

### Generated analysis

Derived removal datasets and reports.

- [Hourly feature summary](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/hourly_feature_summary.csv): feature dataset · `removal/hourly_feature_summary.csv`
- [Hourly removal decisions](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/hourly_removal_decisions.csv): decision dataset · `removal/hourly_removal_decisions.csv`
- [Removal predictions](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/removal_predictions.csv): prediction dataset · `removal/removal_predictions.csv`
- [No-removal overrides](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/removal/force_no_removal_report.csv): exception report · `removal/force_no_removal_report.csv`
- [Patient statistics](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/patient_statistics.txt): analysis report · `patient_statistics.txt`
- [Patient-statistics differences](https://github.com/yash8mehra/chesttube-synthetic-data/blob/main/patient_statistics_differences.txt): comparison report · `patient_statistics_differences.txt`

## Connections

- Chest X-ray events → Table flow processor: ingest
- Pump-flow events → Table flow processor: ingest
- Removal timestamps → Table flow processor: ingest labels
- Table flow processor → Temporal alignment: process events
- Temporal alignment → Hourly feature summary: aggregate hourly
- Hourly feature summary → Removal decision logic: feature input
- Removal timestamps → Removal decision logic: removal reference
- Removal decision logic → Hourly removal decisions: emit decisions
- Removal decision logic → Removal predictions: emit predictions
- Removal decision logic → No-removal overrides: report overrides
- Removal predictions → Patient statistics: summarize
- Hourly removal decisions → Patient-statistics differences: compare
- Removal predictions → Synthetic graph generator: derived visualization input
