| Title: | Mining Industry SDG Impact Calculator |
|---|---|
| Description: | Provides tools to calculate quantitative scores for the United Nations Sustainable Development Goals (SDGs) for the mining, minerals and metals sector. Retrieves official indicator data from the 'United Nations SDG API', runs trend, stability, benchmarking and convergence diagnostics, maps indicators to mining-sector materiality domains via a bundled ontology, computes site-level Key Performance Indicators (KPIs) aligned with Global Reporting Initiative (GRI) 11, International Council on Mining and Metals (ICMM) Mining Principles and Sustainability Accounting Standards Board (SASB) EM-MM conventions, scores sites on a 0-100 SDG scorecard, and ships an interactive 'shiny' dashboard with demonstration datasets. An Environmental, Social and Governance (ESG) reporting layer generates Global Reporting Initiative (GRI), International Council on Mining and Metals (ICMM) and Business Responsibility and Sustainability Reporting (BRSR) reports from a disclosure bundle interface, with framework mappings shipped as data and rendering to 'HTML', 'PDF', 'Word' and 'Excel' via 'Quarto' and 'openxlsx2'. Official Sustainable Development Goals information and indicator methodology are available from the United Nations Sustainable Development Goals website <https://sdgs.un.org/goals>. |
| Authors: | Manoj Kumar [aut, cre] |
| Maintainer: | Manoj Kumar <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.4.0 |
| Built: | 2026-09-14 09:42:28 UTC |
| Source: | https://github.com/imanojkumar/minesdg |
Tests beta-convergence across countries for an SDG indicator.
analyze_sdg_convergence(data, base_year = NULL, final_year = NULL)analyze_sdg_convergence(data, base_year = NULL, final_year = NULL)
data |
A data.table returned by fetch_sdg_country_data(). |
base_year |
Optional base year. If NULL, earliest year is used. |
final_year |
Optional final year. If NULL, latest year is used. |
A data.table with convergence statistics per indicator.
Computes trend metrics for SDG indicator data including absolute change, percentage change, CAGR, and linear trend slope.
analyze_sdg_trend(data, group_by = c("indicator", "country"), min_points = 3)analyze_sdg_trend(data, group_by = c("indicator", "country"), min_points = 3)
data |
A data.table returned by fetch_sdg_country_data(). |
group_by |
Character vector of grouping columns. Default c("indicator", "country"). |
min_points |
Minimum number of time points required to compute trend. Default 3. |
Supports grouping by indicator, country, or combinations.
A data.table containing trend statistics.
dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") analyze_sdg_trend(dt)dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") analyze_sdg_trend(dt)
Generic used by the report generators so that users may pass either a
prepared compile_site_disclosures bundle or a raw site
data.frame.
as_disclosure_bundle(x, ...)as_disclosure_bundle(x, ...)
x |
A |
... |
Passed on to |
A minesdg_disclosure_bundle.
b <- as_disclosure_bundle(demo_mine_sites, site_id = "AU-KALG", years = 2023:2024) class(b)b <- as_disclosure_bundle(demo_mine_sites, site_id = "AU-KALG", years = 2023:2024) class(b)
Compares SDG indicator performance against a benchmark (global mean or user-supplied dataset).
benchmark_sdg_performance( data, benchmark_data = NULL, year = NULL, higher_is_better = TRUE )benchmark_sdg_performance( data, benchmark_data = NULL, year = NULL, higher_is_better = TRUE )
data |
A data.table returned by fetch_sdg_country_data(). |
benchmark_data |
Optional data.table with columns: indicator, year, value. If NULL, benchmark is computed as mean of provided data. |
year |
Optional numeric year. If NULL, most recent year is used. |
higher_is_better |
Logical. TRUE if higher values indicate better performance. Default TRUE. |
A data.table with benchmark comparison statistics.
dt <- fetch_sdg_country_data(goal = 15) benchmark_sdg_performance(dt)dt <- fetch_sdg_country_data(goal = 15) benchmark_sdg_performance(dt)
Mapping of SEBI Business Responsibility and Sustainability Report Sections A, B and C to MineSDG outputs, including INR-lakh currency transforms for monetary lines.
brsr_crosswalkbrsr_crosswalk
See gri_crosswalk for the common schema.
Curated in data-raw/make_crosswalks.R; paraphrases referencing
the SEBI BRSR format.
Stable accessor used by framework mappers and report templates.
bundle_kpi(bundle, kpi_id, year = NULL)bundle_kpi(bundle, kpi_id, year = NULL)
bundle |
A |
kpi_id |
A single KPI id from |
year |
Optional year; defaults to the bundle's reporting year. |
A single numeric value, or NA if the KPI is unavailable.
b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_kpi(b, "trifr")b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_kpi(b, "trifr")
Raw fields are provenance-tagged copies of validated user input; they are never recomputed by the reporting layer.
bundle_raw(bundle, field, year = NULL)bundle_raw(bundle, field, year = NULL)
bundle |
A |
field |
A single raw field name (a numeric column of the input
site data, e.g. |
year |
Optional year; defaults to the bundle's reporting year. |
A single numeric value, or NA if the field is unavailable.
b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_raw(b, "ghg_scope1_t")b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_raw(b, "ghg_scope1_t")
Stable accessor for scorecard aggregates held in a disclosure bundle.
bundle_score(bundle, what = "composite", year = NULL)bundle_score(bundle, what = "composite", year = NULL)
bundle |
A |
what |
|
year |
Optional year; defaults to the bundle's reporting year. |
A numeric score (or character grade), or NA.
b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_score(b) bundle_score(b, what = "goal_8")b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2024) bundle_score(b) bundle_score(b, what = "goal_8")
Computes community/social investment as a percentage of revenue (GRI 203-1; ICMM Principle 9), a widely benchmarked measure of shared-value contribution in the mining sector.
calculate_community_investment(community_investment, revenue)calculate_community_investment(community_investment, revenue)
community_investment |
Numeric. Community investment in a currency unit (e.g. million USD). |
revenue |
Numeric. Revenue in the same currency unit. Must be > 0. |
A named list with metric and community_investment_pct.
calculate_community_investment(24.0, 3349)calculate_community_investment(24.0, 3349)
Computes energy intensity per tonne of ore processed (GRI 302-3) and, optionally, the renewable share of total energy consumption (GRI 302-1 / SASB EM-MM-130a.1).
calculate_energy_intensity(energy_gj, ore_processed_kt, renewable_gj = NULL)calculate_energy_intensity(energy_gj, ore_processed_kt, renewable_gj = NULL)
energy_gj |
Numeric. Total energy consumed in gigajoules. |
ore_processed_kt |
Numeric. Ore processed in kilotonnes. Must be > 0. |
renewable_gj |
Numeric. Optional. Renewable energy consumed in GJ. |
A named list with metric, energy_intensity (GJ/t ore) and,
when renewable_gj is supplied, renewable_share_percent.
calculate_energy_intensity(10449110, 18481, renewable_gj = 550000)calculate_energy_intensity(10449110, 18481, renewable_gj = 550000)
Computes Scope 1 + Scope 2 greenhouse-gas emissions intensity per tonne of ore processed, following the GHG Protocol Corporate Standard and GRI 305-4 / SASB EM-MM-110a.1 disclosure conventions.
calculate_ghg_intensity(scope1_t, scope2_t, ore_processed_kt)calculate_ghg_intensity(scope1_t, scope2_t, ore_processed_kt)
scope1_t |
Numeric. Direct (Scope 1) emissions in tonnes CO2e. |
scope2_t |
Numeric. Energy-indirect (Scope 2) emissions in tonnes CO2e. |
ore_processed_kt |
Numeric. Ore processed in kilotonnes. Must be > 0. |
Intensity is calculated as:
expressed as tCO2e per kilotonne of ore.
A named list with metric, total_emissions_t,
ghg_intensity (tCO2e/kt ore), and scope1_share_percent.
calculate_ghg_intensity(636000, 342000, 18481)calculate_ghg_intensity(636000, 342000, 18481)
Computes the rehabilitation rate of disturbed mining land in alignment with SDG 15.3 (Land Degradation Neutrality). The function evaluates the percentage of disturbed land that has been restored or revegetated and reports the remaining unrestored area.
calculate_land_restoration(disturbed_area_ha, rehabilitated_area_ha)calculate_land_restoration(disturbed_area_ha, rehabilitated_area_ha)
disturbed_area_ha |
Numeric. Total land disturbed by mining activities (in hectares). Must be a non-negative number. |
rehabilitated_area_ha |
Numeric. Total land rehabilitated or revegetated (in hectares). Must be a non-negative number. |
The rehabilitation rate is calculated as:
If disturbed_area_ha is 0, the function safely returns 0 percent restored
to avoid division-by-zero errors.
A named list containing:
Character string. "SDG 15.3 - Land Restoration"
Numeric. Rehabilitation rate rounded to 2 decimal places.
Numeric. Remaining disturbed land not yet restored (in hectares).
calculate_land_restoration(100, 40) calculate_land_restoration( disturbed_area_ha = 250, rehabilitated_area_ha = 180 ) calculate_land_restoration(0, 0)calculate_land_restoration(100, 40) calculate_land_restoration( disturbed_area_ha = 250, rehabilitated_area_ha = 180 ) calculate_land_restoration(0, 0)
Computes standard mining safety frequency rates per one million hours worked, following the ICMM safety data reporting convention and GRI 403-9: Total Recordable Injury Frequency Rate (TRIFR), Lost Time Injury Frequency Rate (LTIFR), and Fatality Frequency Rate.
calculate_safety_performance( hours_worked, recordable_injuries, lost_time_injuries, fatalities = 0 )calculate_safety_performance( hours_worked, recordable_injuries, lost_time_injuries, fatalities = 0 )
hours_worked |
Numeric. Total exposure hours. Must be > 0. |
recordable_injuries |
Numeric. Count of recordable injuries (includes lost-time injuries). |
lost_time_injuries |
Numeric. Count of lost-time injuries. |
fatalities |
Numeric. Count of work-related fatalities. Default 0. |
Each rate is calculated as:
A named list with metric, trifr, ltifr,
fatality_rate, and hours_worked_millions.
calculate_safety_performance( hours_worked = 6400000, recordable_injuries = 32, lost_time_injuries = 10 )calculate_safety_performance( hours_worked = 6400000, recordable_injuries = 32, lost_time_injuries = 10 )
Computes tailings-to-ore and waste-rock (strip) ratios, core circular economy and mineral-waste metrics under GRI 306 / GRI 11.8 and the Global Industry Standard on Tailings Management (GISTM) context.
calculate_waste_intensity(ore_processed_kt, tailings_kt, waste_rock_kt = NULL)calculate_waste_intensity(ore_processed_kt, tailings_kt, waste_rock_kt = NULL)
ore_processed_kt |
Numeric. Ore processed in kilotonnes. Must be > 0. |
tailings_kt |
Numeric. Tailings produced in kilotonnes. |
waste_rock_kt |
Numeric. Optional. Waste rock moved in kilotonnes. |
A named list with metric, tailings_ratio (t tailings / t ore)
and, when supplied, waste_rock_ratio (strip ratio) and
total_mineral_waste_kt.
calculate_waste_intensity(18481, 17750, waste_rock_kt = 45412)calculate_waste_intensity(18481, 17750, waste_rock_kt = 45412)
Computes water use efficiency and recycling rates in alignment with Global Reporting Initiative (GRI 303) standards and SDG Target 6.4.
calculate_water_efficiency(withdrawal_m3, discharge_m3, recycled_m3)calculate_water_efficiency(withdrawal_m3, discharge_m3, recycled_m3)
withdrawal_m3 |
Numeric. Total water withdrawn from all sources (in cubic meters). Must be a non-negative number. |
discharge_m3 |
Numeric. Total water discharged to all destinations (in cubic meters). Must be a non-negative number. |
recycled_m3 |
Numeric. Total water recycled or reused (in cubic meters). Must be a non-negative number. |
The function calculates the "Recycling Rate" as:
And "Net Water Consumption" (GRI 303-5) as:
A named list containing:
Character string. "SDG 6.4 - Water Efficiency"
Numeric. Net water consumed (Withdrawal - Discharge).
Numeric. Percentage of total water use that is recycled, rounded to 2 decimal places.
# Standard mining operation example calculate_water_efficiency( withdrawal_m3 = 50000, discharge_m3 = 10000, recycled_m3 = 20000 ) # Zero discharge example (Closed loop) calculate_water_efficiency(1000, 0, 500) # Edge case: No water used calculate_water_efficiency(0, 0, 0)# Standard mining operation example calculate_water_efficiency( withdrawal_m3 = 50000, discharge_m3 = 10000, recycled_m3 = 20000 ) # Zero discharge example (Closed loop) calculate_water_efficiency(1000, 0, 500) # Edge case: No water used calculate_water_efficiency(0, 0, 0)
Computes female employment share (GRI 405-1) and local employment share (GRI 202-2 / SASB EM-MM-210b) of the site workforce.
calculate_workforce_diversity( workforce, female_employees, local_employees = NULL )calculate_workforce_diversity( workforce, female_employees, local_employees = NULL )
workforce |
Numeric. Total workforce headcount. Must be > 0. |
female_employees |
Numeric. Female employee headcount. |
local_employees |
Numeric. Optional. Employees hired from the local/host community. |
A named list with metric, female_employment_pct and,
when supplied, local_employment_pct.
calculate_workforce_diversity(3200, 420, local_employees = 1900)calculate_workforce_diversity(3200, 420, local_employees = 1900)
Runs 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.
compile_site_disclosures(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())compile_site_disclosures(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())
site_data |
A data.frame with one row per site-year using the
|
site_id |
Optional site identifier; required when |
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
|
narratives |
Named list of narrative disclosures keyed by narrative
slot id (see the |
entity_meta |
Named list of entity-level metadata (e.g.
|
An object of class minesdg_disclosure_bundle: a list with elements
meta, kpis, scores, goal_scores, raw,
deltas, narratives and registry_used.
map_bundle_to_framework, generate_gri_report
bundle <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2022:2024) bundle bundle_kpi(bundle, "ghg_intensity")bundle <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2022:2024) bundle bundle_kpi(bundle, "ghg_intensity")
Calculates variability and stability statistics for SDG indicator data.
compute_sdg_stability(data, group_by = c("indicator", "country"))compute_sdg_stability(data, group_by = c("indicator", "country"))
data |
A data.table returned by fetch_sdg_country_data(). |
group_by |
Character vector of grouping columns. |
A data.table containing stability metrics.
dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") compute_sdg_stability(dt)dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") compute_sdg_stability(dt)
A synthetic but realistic panel dataset of six mine sites (copper, gold, iron ore, coal, zinc, bauxite) across 2019-2024 with production, emissions, energy, water, land, safety, workforce and community fields. Designed for tutorials, tests and the bundled Shiny dashboard. All values are simulated; no real operation is represented.
demo_mine_sitesdemo_mine_sites
A data frame with 36 rows (6 sites x 6 years) and 26 variables
including ore_processed_kt, ghg_scope1_t, ghg_scope2_t,
energy_gj, water_withdrawal_m3, water_recycled_m3,
land_disturbed_ha, land_rehabilitated_ha, hours_worked,
recordable_injuries, fatalities, female_employment_pct,
local_employment_pct, revenue_musd, community_investment_musd,
tailings_kt, and waste_rock_kt.
Simulated via data-raw/make_datasets.R (seed 20260720).
head(demo_mine_sites)head(demo_mine_sites)
A synthetic offline snapshot shaped identically to the output of
fetch_sdg_country_data(): indicators 15.3.1 (land degradation),
6.4.1 (water-use efficiency) and 8.8.1 (occupational injuries) for
India, Australia, Chile and South Africa, 2015-2023. Enables every
analytics and risk function to run without network access.
demo_sdg_countrydemo_sdg_country
A data.table with 108 rows and 5 variables: indicator,
country, year, value, unit.
Simulated via data-raw/make_datasets.R; values follow
plausible national trajectories but are not official UN statistics.
analyze_sdg_trend(demo_sdg_country[demo_sdg_country$indicator == "6.4.1", ])analyze_sdg_trend(demo_sdg_country[demo_sdg_country$indicator == "6.4.1", ])
Queries the bundled sdg_mining_ontology by SDG goal or by mining sustainability domain, returning material topics, materiality ratings and disclosure-framework references.
explore_sdg_ontology(domain = NULL, ...)explore_sdg_ontology(domain = NULL, ...)
domain |
Character or numeric. If character, filters by mining sustainability domain (partial, case-insensitive match), e.g. "water" or "biodiversity". If numeric (1-17), it is interpreted as an SDG goal number for backward compatibility. |
... |
Reserved for backward compatibility. A named argument
|
A data frame of matching ontology rows.
explore_sdg_ontology(domain = 6) explore_sdg_ontology(domain = "biodiversity") explore_sdg_ontology(goal = 6)explore_sdg_ontology(domain = 6) explore_sdg_ontology(domain = "biodiversity") explore_sdg_ontology(goal = 6)
Retrieves Sustainable Development Goal (SDG) indicator data from the official 'United Nations SDG API'.
fetch_sdg_country_data( goal = NULL, indicator = NULL, country = NULL, year_range = NULL, save = FALSE, save_path = "./data/sdg_downloads/", formats = c("csv", "rds") )fetch_sdg_country_data( goal = NULL, indicator = NULL, country = NULL, year_range = NULL, save = FALSE, save_path = "./data/sdg_downloads/", formats = c("csv", "rds") )
goal |
Numeric (1-17). Optional SDG goal number. |
indicator |
Character. SDG indicator code (e.g., "15.3.1"). |
country |
Character. ISO3 country code (e.g., "IND", "AUS"). |
year_range |
Numeric vector of length 2 (start_year, end_year). |
save |
Logical. If TRUE, saves data to disk. Default FALSE. |
save_path |
Character. Directory path for saving data. Default: "./data/sdg_downloads/". |
formats |
Character vector. Any combination of "csv", "rds". Default c("csv", "rds"). |
At least one of goal or indicator must be provided.
If indicator is supplied → fetch that specific indicator.
If only goal is supplied → fetch all indicators under that goal.
If both are supplied → consistency is validated.
country and year_range act as filters.
A data.table containing SDG indicator data.
Returns the disclosure-level mapping rules that connect reporting framework disclosures to MineSDG outputs. Mappings are shipped as package data; adding a disclosure means editing data, not code.
framework_crosswalk(framework = NULL)framework_crosswalk(framework = NULL)
framework |
|
A data.table with the common crosswalk schema (framework,
section, disclosure_id, disclosure_title,
requirement, source_type, source_id,
transform, unit_out, comparative, mandatory,
sdg_goal, notes).
framework_crosswalk("gri")[1:5, c("disclosure_id", "source_type", "source_id")]framework_crosswalk("gri")[1:5, c("disclosure_id", "source_type", "source_id")]
Returns the Section C (principle-wise essential and leadership indicator) view of the BRSR mapping. Values are read from the disclosure bundle; no calculations are duplicated.
generate_brsr_kpis(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())generate_brsr_kpis(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())
site_data |
A site data.frame or a
|
site_id, years, registry, narratives, entity_meta
|
Passed to
|
A data.table of Section C quantitative disclosure rows.
generate_brsr_kpis(demo_mine_sites, site_id = "CO-JHAR", years = 2023:2024)generate_brsr_kpis(demo_mine_sites, site_id = "CO-JHAR", years = 2023:2024)
Builds a SEBI Business Responsibility and Sustainability Report
covering Section A (general disclosures), Section B (management and
process disclosures) and Section C (principle-wise performance KPIs).
Monetary values without a supplied exchange rate are flagged
partial rather than estimated.
generate_brsr_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), output = NULL, format = c("html", "pdf", "docx", "xlsx"))generate_brsr_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), output = NULL, format = c("html", "pdf", "docx", "xlsx"))
site_data |
A site data.frame or a
|
site_id, years, registry, narratives, entity_meta
|
Passed to
|
output |
Optional path; when supplied the report is rendered. |
format |
Output format used when |
A minesdg_report with extras sectionA, sectionB
and sectionC.
generate_brsr_sectionA, generate_brsr_kpis
rep <- generate_brsr_report(demo_mine_sites, site_id = "CO-JHAR", years = 2023:2024, entity_meta = list(company = "Demo Mining Ltd", fx_usd_inr = 83.2)) reprep <- generate_brsr_report(demo_mine_sites, site_id = "CO-JHAR", years = 2023:2024, entity_meta = list(company = "Demo Mining Ltd", fx_usd_inr = 83.2)) rep
Returns the Section A view of the BRSR mapping. All three BRSR section functions are filters over one mapping computation.
generate_brsr_sectionA(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())generate_brsr_sectionA(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())
site_data |
A site data.frame or a
|
site_id, years, registry, narratives, entity_meta
|
Passed to
|
A data.table of Section A disclosure rows with values and statuses.
generate_brsr_sectionA(demo_mine_sites, site_id = "CO-JHAR", years = 2024, entity_meta = list(company = "Demo Mining Ltd"))generate_brsr_sectionA(demo_mine_sites, site_id = "CO-JHAR", years = 2024, entity_meta = list(company = "Demo Mining Ltd"))
Returns the Section B (management and process, per NGRBC principle) view of the BRSR mapping.
generate_brsr_sectionB(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())generate_brsr_sectionB(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list())
site_data |
A site data.frame or a
|
site_id, years, registry, narratives, entity_meta
|
Passed to
|
A data.table of Section B disclosure rows.
generate_brsr_sectionB(demo_mine_sites, site_id = "CO-JHAR", years = 2024)generate_brsr_sectionB(demo_mine_sites, site_id = "CO-JHAR", years = 2024)
Builds a GRI report covering GRI 302 (Energy), 303 (Water and Effluents), 304 (Biodiversity), 305 (Emissions), 306 (Waste), 403 (Occupational Health and Safety) and 413 (Local Communities). All quantitative disclosures are resolved through the disclosure bundle; no calculation is performed in the reporting layer.
generate_gri_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), standards = c(302, 303, 304, 305, 306, 403, 413), output = NULL, format = c("html", "pdf", "docx", "xlsx"))generate_gri_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), standards = c(302, 303, 304, 305, 306, 403, 413), output = NULL, format = c("html", "pdf", "docx", "xlsx"))
site_data |
A site data.frame (see |
site_id, years, registry, narratives, entity_meta
|
Passed to
|
standards |
Integer vector of GRI topic standards to include; default all supported (302, 303, 304, 305, 306, 403, 413). |
output |
Optional path. When supplied the report is rendered to
|
format |
Output format used when |
A minesdg_report object (invisibly when output is
supplied).
render_minesdg_report, write_report_xlsx
rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2022:2024) rep gri_content_index(rep)[1:5, ]rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2022:2024) rep gri_content_index(rep)[1:5, ]
Assesses a site against the ICMM Mining Principles, producing a board
scorecard, a traffic-light assessment and data-driven recommendations.
Traffic lights reclassify existing MineSDG KPI scores against
configurable thresholds; recommendations are evaluated from the
icmm_recommendation_rules dataset.
generate_icmm_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), params = icmm_default_params(), output = NULL, format = c("html", "pdf", "docx", "xlsx"))generate_icmm_report(site_data, site_id = NULL, years = NULL, registry = MineSDG::mining_kpi_registry, narratives = list(), entity_meta = list(), params = icmm_default_params(), output = NULL, format = c("html", "pdf", "docx", "xlsx"))
site_data |
A site data.frame or a
|
site_id, years, registry, narratives, entity_meta
|
Passed to
|
params |
ICMM parameters from |
output |
Optional path; when supplied the report is rendered. |
format |
Output format used when |
A minesdg_report with extra elements $extras$scorecard,
$extras$traffic_lights and $extras$recommendations.
rep <- generate_icmm_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) rep$extras$traffic_lights[1:5, ] rep$extras$recommendationsrep <- generate_icmm_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) rep$extras$traffic_lights[1:5, ] rep$extras$recommendations
Builds a composite Mining ESG Risk Index by aggregating multiple SDG indicators using flexible weighting schemes.
generate_mining_esg_index( data, indicators, weighting_method = "equal", custom_weights = NULL )generate_mining_esg_index( data, indicators, weighting_method = "equal", custom_weights = NULL )
data |
data.table returned by fetch_sdg_country_data(). |
indicators |
Character vector of SDG indicator codes. |
weighting_method |
Character. One of: "equal", "domain_weighted", "custom". |
custom_weights |
Named numeric vector of weights (required if weighting_method = "custom"). |
A data.table containing:
Country ISO3
Aggregated ESG risk score
Overall risk classification
Integrates SDG trend, stability, benchmarking, and mining-sector relevance to produce a structured ESG risk assessment.
generate_mining_risk_profile(data, indicator)generate_mining_risk_profile(data, indicator)
data |
data.table returned from fetch_sdg_country_data() |
indicator |
Character. SDG indicator code. |
A structured list containing:
SDG indicator
Mining domain
Numeric weighted risk score
Risk classification
Narrative explanation
Creates an executive-ready narrative summary based on SDG trend analysis and optional benchmark comparison.
generate_sdg_executive_summary(trend_data, benchmark_data = NULL, digits = 2)generate_sdg_executive_summary(trend_data, benchmark_data = NULL, digits = 2)
trend_data |
Output from analyze_sdg_trend(). |
benchmark_data |
Optional output from benchmark_sdg_performance(). |
digits |
Number of digits for rounding values. Default 2. |
Character vector containing executive summary text.
dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") trend <- analyze_sdg_trend(dt) summary_text <- generate_sdg_executive_summary(trend) cat(summary_text)dt <- fetch_sdg_country_data(indicator = "15.3.1", country = "IND") trend <- analyze_sdg_trend(dt) summary_text <- generate_sdg_executive_summary(trend) cat(summary_text)
Retrieves SDG metadata from the UN API and caches it for the current R
session. Requires network access; downstream helpers such as
list_sdg_indicators use this cache.
get_sdg_metadata()get_sdg_metadata()
A data.table of SDG indicator metadata.
Returns the GRI content index table (disclosure, title, status, source lineage) that assurance and reporting teams attach to published reports.
gri_content_index(report)gri_content_index(report)
report |
A |
A data.frame with columns disclosure_id,
disclosure_title, status, source and
omission_reason.
rep <- generate_gri_report(demo_mine_sites, site_id = "AU-KALG", years = 2024) head(gri_content_index(rep))rep <- generate_gri_report(demo_mine_sites, site_id = "AU-KALG", years = 2024) head(gri_content_index(rep))
Disclosure-level mapping rules connecting GRI 302/303/304/305/306/403/413 disclosures to MineSDG outputs. Framework mappings are data: report generators contain no framework-specific logic.
gri_crosswalkgri_crosswalk
A data.table with one row per disclosure and columns framework,
section, disclosure_id, disclosure_title,
requirement, source_type
(kpi/raw/score/narrative/none),
source_id, transform, unit_out,
comparative, mandatory, sdg_goal, notes.
Carries a crosswalk_version attribute.
Curated in data-raw/make_crosswalks.R; requirement texts are
original paraphrases referencing the GRI Standards 2021 and the GRI 11
Mining Sector Standard 2022.
Mapping of ICMM Mining Principles and selected performance areas (safety, climate, water, tailings, biodiversity, social) to MineSDG outputs.
icmm_crosswalkicmm_crosswalk
See gri_crosswalk for the common schema.
Curated in data-raw/make_crosswalks.R; paraphrases referencing
the ICMM Mining Principles (2020).
Builds the parameter list consumed by
generate_icmm_report.
icmm_default_params(green = 70, amber = 40)icmm_default_params(green = 70, amber = 40)
green |
Minimum 0-100 score for a green traffic light (default 70). |
amber |
Minimum score for amber (default 40); anything below is red. |
A named list of ICMM report parameters.
icmm_default_params() icmm_default_params(green = 75, amber = 50)icmm_default_params() icmm_default_params(green = 75, amber = 50)
Data-driven recommendation rules evaluated by
generate_icmm_report: when a KPI or mining-domain traffic
light matches a trigger, the associated recommendation is emitted.
icmm_recommendation_rulesicmm_recommendation_rules
A data.table with columns principle, trigger_type
(kpi_light or domain_light), trigger_id,
trigger_value, priority, recommendation.
Curated in data-raw/make_crosswalks.R.
Returns the bundled mining_kpi_registry, optionally filtered by SDG goal or improvement direction.
list_mining_kpis(sdg_goal = NULL, direction = NULL)list_mining_kpis(sdg_goal = NULL, direction = NULL)
sdg_goal |
Numeric (1-17). Optional filter by primary SDG goal. |
direction |
Character. Optional: "lower_better" or "higher_better". |
A data frame of matching KPI registry rows.
list_mining_kpis(sdg_goal = 8) list_mining_kpis(direction = "higher_better")list_mining_kpis(sdg_goal = 8) list_mining_kpis(direction = "higher_better")
Retrieves the official list of SDG indicators, including indicator codes, descriptions, goal numbers, and tier classification.
list_sdg_indicators(goal = NULL)list_sdg_indicators(goal = NULL)
goal |
Numeric (1–17). Optional SDG goal number to filter indicators. |
Uses internally cached metadata via get_sdg_metadata().
A data.table containing:
SDG goal number
Indicator code
Indicator description
Tier classification
list_sdg_indicators() list_sdg_indicators(goal = 15)list_sdg_indicators() list_sdg_indicators(goal = 15)
Joins a disclosure bundle against a framework's crosswalk dataset and
resolves every disclosure to a value and a status
(reported, partial, narrative_provided,
narrative_required, not_in_scope). Contains no
framework-specific logic: frameworks differ only in their crosswalk
data.
map_bundle_to_framework(bundle, framework, include_voluntary = TRUE, ...)map_bundle_to_framework(bundle, framework, include_voluntary = TRUE, ...)
bundle |
A |
framework |
One of |
include_voluntary |
Include non-mandatory disclosures (default
|
... |
Passed to |
An object of class minesdg_framework_mapping: a list with
framework, table (one row per disclosure with
value, value_prior, narrative, status),
coverage and meta.
b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) m <- map_bundle_to_framework(b, "gri") m summary(m)b <- compile_site_disclosures(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) m <- map_bundle_to_framework(b, "gri") m summary(m)
Classifies an SDG goal or indicator into a mining-sector sustainability domain. Returns structured interpretation including domain classification, relevance score (1–5), and strategic narrative explanation.
map_sdg_to_mining_domain(indicator = NULL, goal = NULL)map_sdg_to_mining_domain(indicator = NULL, goal = NULL)
indicator |
Character. Optional SDG indicator code (e.g., "15.3.1"). |
goal |
Numeric (1–17). Optional SDG goal number. At least one of |
A structured list containing:
SDG goal number
Mining sustainability domain
Numeric score (1–5)
Mining-sector strategic interpretation
map_sdg_to_mining_domain(indicator = "15.3.1") map_sdg_to_mining_domain(goal = 13)map_sdg_to_mining_domain(indicator = "15.3.1") map_sdg_to_mining_domain(goal = 13)
A reference registry of 18 site-level mining sustainability KPIs with
units, SDG target alignment, improvement direction, and indicative
good/poor threshold values used by score_site_sdg() for 0-100
normalisation. Thresholds are indicative sector reference points;
organisations should calibrate them to their commodity and jurisdiction.
mining_kpi_registrymining_kpi_registry
A data frame with 18 rows and 9 variables:
Machine-readable KPI identifier
Human-readable KPI name
Measurement unit
Primary SDG goal number
Primary SDG target
"lower_better" or "higher_better"
Value that scores 100
Value that scores 0
GRI / ICMM / SASB / GISTM citations
list_mining_kpis(sdg_goal = 8)list_mining_kpis(sdg_goal = 8)
Rolls goal-level scores up to the ontology's mining domains and plots them as a radar chart. The rollup is an unweighted mean of goal scores per domain – a presentation-level aggregation of values already computed by the scoring engine.
plot_domain_radar(x, year = NULL)plot_domain_radar(x, year = NULL)
x |
A |
year |
Year to plot when |
A ggplot object.
sc <- score_site_sdg(demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ]) plot_domain_radar(sc)sc <- score_site_sdg(demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ]) plot_domain_radar(sc)
Creates a ranked horizontal bar chart of composite ESG risk.
plot_mining_esg_index(index_data)plot_mining_esg_index(index_data)
index_data |
data.table returned by generate_mining_esg_index() |
ggplot object
Creates a benchmark comparison bar chart.
plot_sdg_benchmark(benchmark_data)plot_sdg_benchmark(benchmark_data)
benchmark_data |
Output from benchmark_sdg_performance(). |
A ggplot object.
Creates a convergence scatter plot showing initial value vs growth rate.
plot_sdg_convergence(data, base_year = NULL, final_year = NULL)plot_sdg_convergence(data, base_year = NULL, final_year = NULL)
data |
A data.table returned by fetch_sdg_country_data(). |
base_year |
Optional base year. If NULL, earliest year is used. |
final_year |
Optional final year. If NULL, latest year is used. |
A ggplot object.
Plots goal-level SDG scores as a radar (polar) chart.
plot_sdg_radar(x, year = NULL)plot_sdg_radar(x, year = NULL)
x |
A |
year |
Year to plot when |
A ggplot object.
sc <- score_site_sdg(demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ]) plot_sdg_radar(sc)sc <- score_site_sdg(demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ]) plot_sdg_radar(sc)
Creates a publication-ready time-series plot for SDG indicator data.
plot_sdg_trend(data, indicator = NULL, country = NULL)plot_sdg_trend(data, indicator = NULL, country = NULL)
data |
A data.table returned by fetch_sdg_country_data(). |
indicator |
Optional indicator code to filter. |
country |
Optional ISO3 country code to filter. |
A ggplot object.
Visualizes SDG indicator variability across countries.
plot_sdg_volatility(stability_data)plot_sdg_volatility(stability_data)
stability_data |
Output from compute_sdg_stability(). |
A ggplot object.
HTML, PDF and DOCX rendering use the Quarto templates shipped in
inst/quarto/ and require the Quarto CLI plus the quarto R
package. XLSX output is delegated to write_report_xlsx
and requires openxlsx2. Rendering happens in a temporary
directory; the installed package is never written to.
render_minesdg_report(report, output_file, format = c("html", "pdf", "docx", "xlsx"), template = NULL, quiet = TRUE)render_minesdg_report(report, output_file, format = c("html", "pdf", "docx", "xlsx"), template = NULL, quiet = TRUE)
report |
A |
output_file |
Path of the output document. Its directory must exist. |
format |
One of |
template |
Optional path to a user-supplied |
quiet |
Suppress Quarto output (default |
The path to the rendered file, invisibly.
rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) out <- render_minesdg_report(rep, file.path(tempdir(), "gri.html"))rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) out <- render_minesdg_report(rep, file.path(tempdir(), "gri.html"))
Starts the interactive MineSDG dashboard: portfolio SDG scorecards, site KPI deep-dives, ontology exploration, the KPI registry, and CSV upload of your own site data (schema of demo_mine_sites).
run_minesdg_dashboard(...)run_minesdg_dashboard(...)
... |
Passed on to |
Requires the shiny package (and optionally DT for enhanced
tables), listed in Suggests.
Invisibly returns the value of shiny::runApp() (called for
its side effect of launching the app).
## Not run: run_minesdg_dashboard() ## End(Not run)## Not run: run_minesdg_dashboard() ## End(Not run)
Loops the existing score_site_sdg engine over every
site-year in a portfolio and returns a tidy table of composite scores
and grades, ready for portfolio dashboards and benchmarking. No new
scoring logic is introduced.
score_portfolio_sdg(site_data, registry = MineSDG::mining_kpi_registry)score_portfolio_sdg(site_data, registry = MineSDG::mining_kpi_registry)
site_data |
A data.frame with one row per site-year (multiple
sites allowed), using the |
registry |
KPI registry passed through to
|
A data.table with columns site_id, site_name,
commodity, country, year, composite_score,
grade, ordered by year then descending score.
portfolio <- score_portfolio_sdg(demo_mine_sites) portfolio[portfolio$year == 2024, ]portfolio <- score_portfolio_sdg(demo_mine_sites) portfolio[portfolio$year == 2024, ]
Transforms one year of raw site operational data into a normalised
0-100 SDG scorecard. Each KPI is derived from the raw fields, then
linearly rescaled between the poor_value (score 0) and good_value
(score 100) reference thresholds in mining_kpi_registry, respecting
the KPI's improvement direction. Scores are aggregated to SDG-goal
level and into a materiality-weighted composite (weights from
sdg_mining_ontology).
score_site_sdg(site_data, registry = MineSDG::mining_kpi_registry)score_site_sdg(site_data, registry = MineSDG::mining_kpi_registry)
site_data |
A one-row data.frame (e.g. one site-year of demo_mine_sites). |
registry |
KPI registry data frame. Default mining_kpi_registry. Supply a customised copy to calibrate thresholds to your commodity. |
Expected columns in site_data (one row; extra columns are ignored):
ore_processed_kt, ghg_scope1_t, ghg_scope2_t, energy_gj,
renewable_energy_pct, water_withdrawal_m3, water_recycled_m3,
land_disturbed_ha, land_rehabilitated_ha, hours_worked,
recordable_injuries, lost_time_injuries, fatalities,
female_employment_pct, local_employment_pct, revenue_musd,
community_investment_musd, tailings_kt, waste_rock_kt.
Missing fields simply drop the corresponding KPIs from the scorecard.
An object of class minesdg_site_score: a list with
scorecard (data.table: kpi_id, kpi_name, sdg_goal, value, unit,
score), goal_scores (data.table: sdg_goal, mining_domain, weight,
goal_score), composite_score (0-100), and grade (A-E).
site <- demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ] score_site_sdg(site)site <- demo_mine_sites[demo_mine_sites$site_id == "CU-ATAC" & demo_mine_sites$year == 2024, ] score_site_sdg(site)
A structured ontology mapping all 17 Sustainable Development Goals to mining-sector sustainability domains, material topics, sector materiality ratings, and disclosure-framework references (GRI 11 Mining Sector Standard, ICMM Mining Principles, SASB EM-MM, SEBI BRSR).
sdg_mining_ontologysdg_mining_ontology
A data frame with 17 rows and 10 variables:
SDG goal number (1-17)
Official SDG goal name
Mining sustainability domain classification
Sector materiality rating (1 = peripheral, 5 = core)
Mining-specific material topic
GRI Standards / GRI 11 sector standard reference
ICMM Mining Principles reference
SASB Metals & Mining (EM-MM) metric reference
SEBI BRSR principle reference (India)
Semicolon-separated representative site KPIs
Compiled from public framework documentation: GRI 11 (2024), ICMM Mining Principles, SASB Metals & Mining Standard, SEBI BRSR.
head(sdg_mining_ontology[, c("goal", "mining_domain", "materiality")])head(sdg_mining_ontology[, c("goal", "mining_domain", "materiality")])
Generates descriptive statistics and data quality diagnostics
for SDG indicator datasets retrieved via
fetch_sdg_country_data().
summarize_sdg_data(data, group_by = NULL, na.rm = TRUE)summarize_sdg_data(data, group_by = NULL, na.rm = TRUE)
data |
A data.table returned by
|
group_by |
Character vector of column names to group by. Allowed values are "indicator", "country", and "year". Default is NULL (overall summary). |
na.rm |
Logical. Should missing values be removed when computing statistics? Default TRUE. |
Supports optional grouping by indicator, country, year, or combinations thereof.
A data.table containing summary statistics.
dt <- fetch_sdg_country_data( indicator = "15.3.1", country = "IND" ) summarize_sdg_data(dt) summarize_sdg_data(dt, group_by = "year") summarize_sdg_data(dt, group_by = c("indicator", "country"))dt <- fetch_sdg_country_data( indicator = "15.3.1", country = "IND" ) summarize_sdg_data(dt) summarize_sdg_data(dt, group_by = "year") summarize_sdg_data(dt, group_by = c("indicator", "country"))
Checks whether a provided SDG indicator code exists in the official United Nations SDG indicator database.
validate_sdg_indicator(indicator, goal = NULL)validate_sdg_indicator(indicator, goal = NULL)
indicator |
Character. SDG indicator code (e.g., "15.3.1"). |
goal |
Numeric (1–17). Optional SDG goal number for consistency check. |
Optionally verifies consistency between indicator and goal.
Uses internally cached metadata via get_sdg_metadata().
Logical TRUE if valid. Stops with error if invalid.
validate_sdg_indicator("15.3.1") validate_sdg_indicator("15.3.1", goal = 15)validate_sdg_indicator("15.3.1") validate_sdg_indicator("15.3.1", goal = 15)
Writes a workbook with a Cover sheet (metadata and coverage), the disclosure tables, and a Data Annex containing the bundle's KPI and raw-input tables. Requires the openxlsx2 package.
write_report_xlsx(report, output_file)write_report_xlsx(report, output_file)
report |
A |
output_file |
Path of the |
The path to the written file, invisibly.
rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) out <- write_report_xlsx(rep, file.path(tempdir(), "gri.xlsx"))rep <- generate_gri_report(demo_mine_sites, site_id = "CU-ATAC", years = 2023:2024) out <- write_report_xlsx(rep, file.path(tempdir(), "gri.xlsx"))