# sebasquirarte/biostats architecture

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

- Interactive diagram: https://gitdiagram.com/sebasquirarte/biostats
- Repository: https://github.com/sebasquirarte/biostats

## Overview

##### Project type and purpose
- This is an R package (“biostats”)—an analytical toolbox for biostatistics
and clinical data analysis. It exposes a collection of functions for
simulation (clinical_data), exploratory data analysis (summary_table,
normality, missing_values, outliers), sample‐size/power calculations
(sample_size, sample_size_range), statistical inference (omnibus,
effect_measures), and data visualization (plot_bar, plot_line, plot_hist,
plot_box, plot_corr). It is intended as both a professional toolkit and
educational resource, distributed via CRAN/GitHub.

##### File structure
- Top‐level packaging artifacts: DESCRIPTION, NAMESPACE, LICENSE, NEWS.md,
README.Rmd/README.md, .Rbuildignore, .gitignore.
- R/: contains .R scripts—each function or helper in its own file.
- man/: automatically generated Rd documentation for each exported function,
plus figures.
- tests/: testthat framework—tests/testthat.R plus individual
test-*.R files.
- .github/workflows/: CI pipelines for R‐CMD‐check, rhub, test‐coverage.
- cran-comments.md: guidance for CRAN submission.
- Namespace implicitly defines exported functions vs. internal utils.

##### README for additional insights
- The README.Rmd describes function categories (EDA, sample size, inference,
visualization), usage examples, and badges indicating CI, coverage,
downloads.
module relationships, data flows, and integration points.

##### Elements
- Clear labels for each component (modules, utilities, tests, CI).
- From User to biostats package modules (function invocation).
- Between modules and shared utils.
- From tests to modules.
- From CI workflows to repository → build/test → CRAN.
- Rectangles for modules.
- Development layer (R scripts, docs, tests).
- Deployment layer (build, CI, CRAN/GitHub).
- Runtime layer (user, R console).

##### Detailed capturing of essential elements
utilities.
- Data flows: raw data → EDA → inference → visualization.
- Test coverage: tests exercising each module → coverage reports.
badge updates.
- Package metadata dependency resolution (DESCRIPTION →
install.packages).

how biostats is structured internally, how a user and CI interact with it,
and how it is distributed—providing an accurate, technology‐aware view
tailored to this R‐based analytical toolbox.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Layer
    User["User / Analyst\n(R Console, RStudio)"]:::user

    %% Runtime Layer: Package Modules
    subgraph "biostats Package" 
        direction TB
        %% Data Simulation Module
        subgraph "Data Simulation Module" 
            ClinicalData["clinical_data()"]:::module
        end

        %% EDA & Summaries Module
        subgraph "EDA & Summaries Module"
            SummaryTable["summary_table()"]:::module
            Normality["normality()"]:::module
            MissingValues["missing_values()"]:::module
            Outliers["outliers()"]:::module
        end

        %% Sample Size Module
        subgraph "Sample Size Module"
            SampleSize["sample_size()"]:::module
            SampleSizeRange["sample_size_range()"]:::module
        end

        %% Inference Module
        subgraph "Inference Module"
            Omnibus["omnibus()"]:::module
            EffectMeasures["effect_measures()"]:::module
        end

        %% Visualization Module
        subgraph "Visualization Module"
            PlotBar["plot_bar()"]:::module
            PlotLine["plot_line()"]:::module
            PlotHist["plot_hist()"]:::module
            PlotBox["plot_box()"]:::module
            PlotCorr["plot_corr()"]:::module
        end

        %% Utility Functions
        subgraph "Utility Functions"
            UtilOmnibus["util-omnibus.R"]:::util
            UtilSummary["util-summary_table.R"]:::util
        end
    end

    %% Data Flows
    User -->|"provides data.frame input"| ClinicalData
    User -->|calls| SummaryTable
    User -->|calls| Omnibus
    User -->|calls| PlotBar

    %% Modules to Utils
    Omnibus -->|uses| UtilOmnibus
    SummaryTable -->|uses| UtilSummary
    Normality -->|uses| UtilSummary
    MissingValues -->|uses| UtilSummary
    Outliers -->|uses| UtilSummary

    %% Output Flows
    ClinicalData -->|outputs data.frame| SummaryTable
    SummaryTable -->|outputs summary table| PlotBar
    Omnibus -->|outputs inference| PlotHist
    EffectMeasures -->|outputs effect sizes| PlotBox

    %% Documentation and Metadata
    subgraph "Documentation System" 
        direction TB
        RdDocs["man/"]:::doc
        Readme["README.Rmd / README.md"]:::doc
    end
    RdDocs -->|generated from| ClinicalData
    RdDocs -->|generated from| SummaryTable
    Readme -->|describes modules| ClinicalData

    %% Testing Suite
    subgraph "Testing Suite"
        direction TB
        TestsIndex["tests/testthat.R"]:::test
        TestFiles["tests/testthat/"]:::test
    end
    TestsIndex -->|runs| ClinicalData
    TestFiles -->|test cases for| SummaryTable

    %% CI Pipelines
    subgraph "Continuous Integration" 
        direction TB
        CI1["R-CMD-check.yml"]:::ci
        CI2["rhub.yaml"]:::ci
        CI3["test-coverage.yml"]:::ci
    end
    CI1 -->|triggers| TestsIndex
    CI2 -->|runs| TestFiles
    CI3 -->|generates| CoverageReport["Coverage Report"]:::ci

    %% Distribution Targets
    subgraph "Distribution"
        CRAN["CRAN"]:::dist
        GitHub["GitHub"]:::dist
    end
    CI1 -->|on success| CRAN
    CI1 -->|on success| GitHub

    %% Package Metadata
    PackageMeta["DESCRIPTION, NAMESPACE,\nLICENSE, NEWS.md,\ncran-comments.md"]:::meta
    User -->|install.packages| PackageMeta
    PackageMeta -->|installs dependencies| ClinicalData

    %% Click Events
    click ClinicalData "https://github.com/sebasquirarte/biostats/blob/main/R/clinical_data.R"
    click SummaryTable "https://github.com/sebasquirarte/biostats/blob/main/R/summary_table.R"
    click Normality "https://github.com/sebasquirarte/biostats/blob/main/R/normality.R"
    click MissingValues "https://github.com/sebasquirarte/biostats/blob/main/R/missing_values.R"
    click Outliers "https://github.com/sebasquirarte/biostats/blob/main/R/outliers.R"
    click SampleSize "https://github.com/sebasquirarte/biostats/blob/main/R/sample_size.R"
    click SampleSizeRange "https://github.com/sebasquirarte/biostats/blob/main/R/sample_size_range.R"
    click Omnibus "https://github.com/sebasquirarte/biostats/blob/main/R/omnibus.R"
    click EffectMeasures "https://github.com/sebasquirarte/biostats/blob/main/R/effect_measures.R"
    click PlotBar "https://github.com/sebasquirarte/biostats/blob/main/R/plot_bar.R"
    click PlotLine "https://github.com/sebasquirarte/biostats/blob/main/R/plot_line.R"
    click PlotHist "https://github.com/sebasquirarte/biostats/blob/main/R/plot_hist.R"
    click PlotBox "https://github.com/sebasquirarte/biostats/blob/main/R/plot_box.R"
    click PlotCorr "https://github.com/sebasquirarte/biostats/blob/main/R/plot_corr.R"
    click UtilOmnibus "https://github.com/sebasquirarte/biostats/blob/main/R/util-omnibus.R"
    click UtilSummary "https://github.com/sebasquirarte/biostats/blob/main/R/util-summary_table.R"
    click RdDocs "https://github.com/sebasquirarte/biostats/tree/main/man/"
    click TestsIndex "https://github.com/sebasquirarte/biostats/blob/main/tests/testthat.R"
    click TestFiles "https://github.com/sebasquirarte/biostats/tree/main/tests/testthat/"
    click CI1 "https://github.com/sebasquirarte/biostats/blob/main/.github/workflows/R-CMD-check.yml"
    click CI2 "https://github.com/sebasquirarte/biostats/blob/main/.github/workflows/rhub.yaml"
    click CI3 "https://github.com/sebasquirarte/biostats/blob/main/.github/workflows/test-coverage.yml"

    %% Styles
    classDef user fill:#f9f,stroke:#333,stroke-width:1px
    classDef module fill:#bbf,stroke:#333,stroke-width:1px
    classDef util fill:#bfb,stroke:#333,stroke-width:1px
    classDef doc fill:#ffd,stroke:#333,stroke-width:1px
    classDef test fill:#fdd,stroke:#333,stroke-width:1px
    classDef ci fill:#dfd,stroke:#333,stroke-width:1px
    classDef dist fill:#ddf,stroke:#333,stroke-width:1px
    classDef meta fill:#eee,stroke:#333,stroke-width:1px
    classDef CoverageReport fill:#dfd,stroke:#333,stroke-width:1px
```
