# jlgonrod/ibd_predict architecture

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

- Interactive diagram: https://gitdiagram.com/jlgonrod/ibd_predict
- Repository: https://github.com/jlgonrod/ibd_predict

## Overview

##### Project type and purpose
- This is a data-science / machine-learning pipeline (no web or mobile frontend) whose goal is to build and validate predictive models (XGBoost) for medium- and long-term clinical remission and response in IBD patients treated with vedolizumab or ustekinumab.
- It is driven by Jupyter notebooks, one R Markdown script, and produces model artifacts and Excel tables for reporting.

##### File structure
- Top-level artifacts:
- Several notebooks (“1A_generate_synthetic.ipynb”, “1_read_and_cleaning.ipynb”, “2_EII_Analytica.ipynb”, “3_EII_analityca_histogram_antitnf_age.ipynb”) that implement each stage (data generation, cleaning, exploratory analysis, histogram plotting).
- “N_ajusted.Rmd” – supplementary analysis or reporting in R.
- “output/” subtree containing subfolders:
– “models/” holds trained XGBoost model JSON/text files and fairness analysis results.
– Excel files with tables (cohort summaries, subcohort tables).
- “requirements.txt” – Python libraries.
- “README.md” – project description, clinical context, variable definitions.

##### README for additional insights
- Describes clinical problem, cohorts, inclusion/exclusion, independent & dependent variables.
- Targets: respuesta_clinica_26s, respuesta_clinica_52s, remision_clinica_52s.

##### Detailed capture of essential elements
- Four notebooks and the Rmd script as individual components.
- “output/models” and “output/*.xlsx” directories explicitly.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Sources
    subgraph "Data Sources"
        CLIN["Clinical Data (EHR)"]:::data
        SYN["Synthetic Data Generation"]:::data
    end

    %% Processing Stages
    subgraph "Data Ingestion & Cleaning"
        CLEAN["1_read_and_cleaning.ipynb"]:::processing
    end

    subgraph "Exploratory Analysis"
        EDA1["2_EII_Analytica.ipynb"]:::processing
        EDA2["3_EII_analityca_histogram_antitnf_age.ipynb"]:::processing
    end

    subgraph "Model Training & Validation"
        TRAIN["XGBoost Pipelines"]:::processing
        FAIR["Fairness Evaluation"]:::processing
    end

    %% Output Artifacts
    subgraph "Output Artifacts"
        MODELS["Model Artifacts\n(output/models/)"]:::artifacts
        TABLES["Excel Tables\n(output/*.xlsx)"]:::artifacts
    end

    %% Reporting
    REPORT["N_ajusted.Rmd"]:::reporting

    %% Documentation & Environment
    subgraph "Project Files"
        REQ["requirements.txt"]:::docs
        READ["README.md"]:::docs
    end

    %% Connections
    CLIN --> CLEAN
    SYN --> CLEAN
    CLEAN --> EDA1
    CLEAN --> EDA2
    EDA1 --> TRAIN
    EDA2 --> TRAIN
    TRAIN --> FAIR
    FAIR --> MODELS
    TRAIN --> MODELS
    MODELS --> REPORT
    MODELS --> TABLES
    TABLES --> REPORT
    REQ -.-> CLEAN
    REQ -.-> EDA1
    REQ -.-> EDA2
    REQ -.-> TRAIN
    READ -.-> CLIN
    READ -.-> REPORT

    %% Click Events
    click SYN "https://github.com/jlgonrod/ibd_predict/blob/main/1A_generate_synthetic.ipynb"
    click CLEAN "https://github.com/jlgonrod/ibd_predict/blob/main/1_read_and_cleaning.ipynb"
    click EDA1 "https://github.com/jlgonrod/ibd_predict/blob/main/2_EII_Analytica.ipynb"
    click EDA2 "https://github.com/jlgonrod/ibd_predict/blob/main/3_EII_analityca_histogram_antitnf_age.ipynb"
    click MODELS "https://github.com/jlgonrod/ibd_predict/tree/main/output/models/"
    click REPORT "https://github.com/jlgonrod/ibd_predict/blob/main/N_ajusted.Rmd"
    click REQ "https://github.com/jlgonrod/ibd_predict/blob/main/requirements.txt"
    click READ "https://github.com/jlgonrod/ibd_predict/blob/main/README.md"

    %% Styles
    classDef data fill:#ccf,stroke:#3399ff,color:#03396c,stroke-width:1px;
    classDef processing fill:#cfc,stroke:#2d862d,color:#054005,stroke-width:1px;
    classDef artifacts fill:#fcf8cc,stroke:#d9b300,color:#806000,stroke-width:1px;
    classDef reporting fill:#e5ccff,stroke:#8a2be2,color:#4b0082,stroke-width:1px;
    classDef docs fill:#dddddd,stroke:#888888,color:#333333,stroke-width:1px,stroke-dasharray: 2 2;
```
