# 30aniket/neural-language-models-for-biomedical-causal-inference architecture

> Architecture diagram of the GitHub repository 30aniket/neural-language-models-for-biomedical-causal-inference, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/30aniket/neural-language-models-for-biomedical-causal-inference
- Repository: https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference

## Overview

This repository is a biomedical causal-inference model-comparison study over two FAERS benchmarks. Its main workflow prepares benchmark records, trains a broad set of classifiers under five-fold evaluation, evaluates predictions and calibration, then tests term-level causal outputs and audits methodological claims. The graph keeps the two benchmark-specific training suites distinct while showing shared evaluation and audit layers. Some training and evaluation internals were not excerpted; their links are included only where the README or shown source supports them.

Main entry points: [`feedback_work/feedback_checks/common.py`](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/common.py) (Check data helpers), [`src/run_evaluation.py`](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py) (Fold predictions), [`src/Analgesics-induced_acute_liver_failure`](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/tree/main/src/Analgesics-induced_acute_liver_failure) (AILF model suite), [`data/prepare_data.py`](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py) (Data preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Benchmark data"]
  node_prepare["Data preparation<br/>[prepare_data.py]"]
  node_ailf_data[("AILF benchmark<br/>[prepare_data.py]")]
  node_tram_data[("TRAM benchmark<br/>[prepare_data.py]")]
end

subgraph group_training["Model training"]
  node_ailf_models["AILF model suite"]
  node_tram_models["TRAM model suite"]
  node_xgb["XGBoost features<br/>[xgb_train_src.py]"]
  node_text_models["Text classifiers"]
end

subgraph group_evaluation["Evaluation"]
  node_predictions["Fold predictions<br/>[run_evaluation.py]"]
  node_calibration["Isotonic calibration<br/>[run_evaluation.py]"]
  node_metrics["Prediction metrics<br/>[run_evaluation.py]"]
  node_term_tests["Causal term tests<br/>[run_evaluation.py]"]
  node_significant_terms["Significant term sets<br/>[run_evaluation.py]"]
end

subgraph group_audit["Audits"]
  node_shared_helpers["Check data helpers<br/>[common.py]"]
  node_audit_checks["Protocol and claim audits"]
  node_reference_audit["Reference method audit"]
  node_term_audit["Term score reimplementation<br/>[zcore.py]"]
  node_leakage_audit["Endpoint leakage audit<br/>[check01_leakage.py]"]
  node_duplicate_audit["Repeated case audit"]
end

node_researcher(("Researcher"))

node_researcher -.->|"prepares benchmarks"| node_prepare
node_prepare -.->|"prepares records"| node_ailf_data
node_prepare -.->|"prepares records"| node_tram_data
node_ailf_data -.->|"trains on"| node_ailf_models
node_tram_data -.->|"trains on"| node_tram_models
node_ailf_models -.->|"includes text models"| node_text_models
node_ailf_models -.->|"includes baseline"| node_xgb
node_ailf_models -.->|"writes fold scores"| node_predictions
node_tram_models -.->|"writes fold scores"| node_predictions
node_text_models -->|"writes predictions"| node_predictions
node_predictions -.->|"calibrates scores"| node_calibration
node_predictions -->|"computes metrics"| node_metrics
node_metrics -.->|"tests term scores"| node_term_tests
node_term_tests -->|"selects terms"| node_significant_terms
node_researcher -.->|"runs audits"| node_audit_checks
node_shared_helpers -->|"loads audit inputs"| node_audit_checks
node_shared_helpers -->|"loads audit inputs"| node_reference_audit
node_shared_helpers -->|"loads reports"| node_leakage_audit
node_shared_helpers -->|"loads reports"| node_duplicate_audit
node_shared_helpers -->|"loads predictions"| node_term_audit
node_term_audit -->|"recomputes term scores"| node_reference_audit

click node_prepare "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py"
click node_ailf_data "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py"
click node_tram_data "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py"
click node_ailf_models "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/tree/main/src/Analgesics-induced_acute_liver_failure"
click node_tram_models "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/tree/main/src/Tramadol-related_mortalities"
click node_xgb "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/Tramadol-related_mortalities/xgb_train_src.py"
click node_text_models "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/Analgesics-induced_acute_liver_failure/gemma_peft_train.py"
click node_predictions "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py"
click node_calibration "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py"
click node_metrics "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py"
click node_term_tests "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py"
click node_significant_terms "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py"
click node_shared_helpers "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/common.py"
click node_audit_checks "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check05_pipeline_and_claims.py"
click node_reference_audit "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check03_reference_methods.py"
click node_term_audit "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/zcore.py"
click node_leakage_audit "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check01_leakage.py"
click node_duplicate_audit "https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check02_duplicates.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_prepare,node_ailf_data,node_tram_data toneBlue
class node_ailf_models,node_tram_models,node_xgb,node_text_models toneAmber
class node_predictions,node_calibration,node_metrics,node_term_tests,node_significant_terms toneMint
class node_shared_helpers,node_audit_checks,node_reference_audit,node_term_audit,node_leakage_audit,node_duplicate_audit toneRose
class node_researcher toneIndigo
```

## Components

### Benchmark data

- [Data preparation](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py): `data/prepare_data.py`
- [AILF benchmark](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py): `data/prepare_data.py`
- [TRAM benchmark](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/data/prepare_data.py): `data/prepare_data.py`

### Model training

- [AILF model suite](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/tree/main/src/Analgesics-induced_acute_liver_failure): `src/Analgesics-induced_acute_liver_failure`
- [TRAM model suite](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/tree/main/src/Tramadol-related_mortalities): `src/Tramadol-related_mortalities`
- [XGBoost features](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/Tramadol-related_mortalities/xgb_train_src.py): `src/Tramadol-related_mortalities/xgb_train_src.py`
- [Text classifiers](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/Analgesics-induced_acute_liver_failure/gemma_peft_train.py): `src/Analgesics-induced_acute_liver_failure/gemma_peft_train.py`

### Evaluation

- [Fold predictions](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py): `src/run_evaluation.py`
- [Isotonic calibration](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py): `src/run_evaluation.py`
- [Prediction metrics](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py): `src/run_evaluation.py`
- [Causal term tests](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py): `src/run_evaluation.py`
- [Significant term sets](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/src/run_evaluation.py): `src/run_evaluation.py`

### Audits

- [Check data helpers](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/common.py): `feedback_work/feedback_checks/common.py`
- [Protocol and claim audits](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check05_pipeline_and_claims.py): `feedback_work/feedback_checks/check05_pipeline_and_claims.py`
- [Reference method audit](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check03_reference_methods.py): `feedback_work/feedback_checks/check03_reference_methods.py`
- [Term score reimplementation](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/zcore.py): `feedback_work/feedback_checks/zcore.py`
- [Endpoint leakage audit](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check01_leakage.py): `feedback_work/feedback_checks/check01_leakage.py`
- [Repeated case audit](https://github.com/30aniket/neural-language-models-for-biomedical-causal-inference/blob/main/feedback_work/feedback_checks/check02_duplicates.py): `feedback_work/feedback_checks/check02_duplicates.py`

### Other components

- **Researcher**

## Connections

- Researcher → Data preparation: prepares benchmarks (evidence: `README.md`)
- Data preparation → AILF benchmark: prepares records (evidence: `README.md`)
- Data preparation → TRAM benchmark: prepares records (evidence: `README.md`)
- AILF benchmark → AILF model suite: trains on (evidence: `README.md`)
- TRAM benchmark → TRAM model suite: trains on (evidence: `README.md`)
- AILF model suite → Text classifiers: includes text models (evidence: `README.md`)
- AILF model suite → XGBoost features: includes baseline (evidence: `README.md`)
- AILF model suite → Fold predictions: writes fold scores (evidence: `README.md`)
- TRAM model suite → Fold predictions: writes fold scores (evidence: `README.md`)
- Text classifiers → Fold predictions: writes predictions (evidence: `src/Analgesics-induced_acute_liver_failure/gemma_peft_train.py`)
- Fold predictions → Isotonic calibration: calibrates scores (evidence: `README.md`)
- Fold predictions → Prediction metrics: computes metrics (evidence: `src/run_evaluation.py`)
- Prediction metrics → Causal term tests: tests term scores (evidence: `README.md`)
- Causal term tests → Significant term sets: selects terms (evidence: `src/run_evaluation.py`)
- Researcher → Protocol and claim audits: runs audits (evidence: `README.md`)
- Check data helpers → Protocol and claim audits: loads audit inputs (evidence: `feedback_work/feedback_checks/check05_pipeline_and_claims.py`)
- Check data helpers → Reference method audit: loads audit inputs (evidence: `feedback_work/feedback_checks/check03_reference_methods.py`)
- Check data helpers → Endpoint leakage audit: loads reports (evidence: `feedback_work/feedback_checks/check01_leakage.py`)
- Check data helpers → Repeated case audit: loads reports (evidence: `feedback_work/feedback_checks/check02_duplicates.py`)
- Check data helpers → Term score reimplementation: loads predictions (evidence: `feedback_work/feedback_checks/zcore.py`)
- Term score reimplementation → Reference method audit: recomputes term scores (evidence: `feedback_work/feedback_checks/check03_reference_methods.py`)
