r4subcore is the foundational package in the R4SUB ecosystem. It defines the core data contracts, parsers, evidence schema, and scoring primitives needed to quantify clinical submission readiness.
It is intentionally “boring and stable”: other R4SUB packages (e.g.,
r4subtrace, r4subrisk,
r4subscore) build on these structures and interfaces.
Clinical submission readiness is rarely a single tool output. It’s an evidence graph across:
r4subcore provides: 1. A standardized Evidence Table schema 2. Common parsers to ingest heterogeneous sources 3. A consistent indicator / signal abstraction 4. Scoring primitives (normalize, weight, calibrate, aggregate) 5. A reproducible run context (run_id, dataset_id, study_id, tool version)
r4subscore)r4subui)r4subtrace)# install.packages("pak")
pak::pak("R4SUB/r4subcore")arrow, xml2,
dplyr, readr, jsonlite,
cliAll inputs are normalized into a single tabular contract: an evidence dataset. This enables scoring, drilldown, traceability, and reporting.
Minimum columns (v0.1):
| column | type | meaning |
|---|---|---|
run_id |
chr | unique ID for a run |
study_id |
chr | study identifier |
asset_type |
chr | dataset, define, program,
validation, spec, etc. |
asset_id |
chr | unique ID of the asset (e.g., ADSL,
define.xml) |
source_name |
chr | tool/source name (e.g., pinnacle21) |
source_version |
chr | tool version |
indicator_id |
chr | the signal definition identifier |
indicator_name |
chr | human name |
indicator_domain |
chr | quality, trace, risk,
usability |
severity |
chr | info, low, medium,
high, critical |
result |
chr | pass, fail, warn,
na |
metric_value |
dbl | numeric value (if applicable) |
metric_unit |
chr | unit for metric |
message |
chr | short description |
location |
chr | pointer (dataset/variable/rule line) |
evidence_payload |
json | raw structured payload |
created_at |
POSIXct | ingestion timestamp |
Guarantees:
Use:
as_evidence() to coerce raw datavalidate_evidence() to enforce contractbind_evidence() to combine sources safelyAn indicator is a definition of what to measure, not necessarily how to calculate it.
Indicators have:
indicator_id (stable)domain (quality/trace/risk/usability)descriptionexpected_inputs (evidence sources required)default_thresholdstags (e.g., define,
adam, sdtm, spec)r4subcore provides:
Other packages implement the actual calculations and output evidence rows using these IDs.
r4subcore includes small, auditable
functions for:
SCI itself is not in this package.
library(r4subcore)
ctx <- r4sub_run_context(
study_id = "ABC123",
environment = "DEV",
user = Sys.info()[["user"]]
)
ctx$run_idraw <- read.csv("p21_report.csv")
ev <- p21_to_evidence(
raw,
ctx = ctx,
asset_type = "validation",
source_version = "P21-3.0"
)
validate_evidence(ev)evidence_summary(ev)R/evidence_schema.R – schema + validatorsR/run_context.R – run metadataR/parsers_p21.R – Pinnacle21 ingestion (first
parser)R/indicators.R – indicator metadata + registryR/scoring_primitives.R – severity mapping,
normalization, aggregationR/utils_ids.R – ID helpers, hashingR/utils_json.R – JSON payload helpersas_evidence()FDA_ADaM_basic,
EMA_SDTM_basic)devtools::check() before PRMIT – see LICENSE file.