Compile a site disclosure bundle
compile_site_disclosures.RdRuns the existing MineSDG scoring engine once per reporting year and assembles a framework-neutral disclosure bundle. All framework report generators consume this object, which guarantees that the KPI engine remains the single source of truth and that no calculation is duplicated in the reporting layer.
Usage
compile_site_disclosures(site_data, site_id = NULL, years = NULL,
registry = MineSDG::mining_kpi_registry, narratives = list(),
entity_meta = list())Arguments
- site_data
A data.frame with one row per site-year using the
demo_mine_sitescolumn conventions.- site_id
Optional site identifier; required when
site_datacontains multiple sites.- years
Optional integer vector of years to include. Defaults to all years present for the site. The maximum year is the reporting year.
- registry
KPI registry used for scoring; defaults to
mining_kpi_registry. Pass a modified registry to apply corporate targets or alternative calibrations.- narratives
Named list of narrative disclosures keyed by narrative slot id (see the
source_idcolumn of the crosswalk datasets forsource_type == "narrative"rows).- entity_meta
Named list of entity-level metadata (e.g.
company,cin,fx_usd_inr). Used by report headers and currency transforms.
Value
An object of class minesdg_disclosure_bundle: a list with elements
meta, kpis, scores, goal_scores, raw,
deltas, narratives and registry_used.
Examples
bundle <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC",
years = 2022:2024)
bundle
#> == MineSDG Disclosure Bundle ==
#> Site: CU-ATAC - Atacama Copper
#> Years: 2022, 2023, 2024 | Reporting year: 2024
#> Composite (2024): 66.8 / 100 | Grade: C
#> KPIs per year: 14 | Raw fields: 21
#> Narrative slots supplied: 0
bundle_kpi(bundle, "ghg_intensity")
#> [1] 47.43