| Type: | Package |
| Title: | Reproducible Occupational Biological Risk Assessment with the ERBio Method |
| Version: | 0.9.0 |
| Description: | A source-traceable computational implementation of the ERBio method for occupational biological risk assessment. It provides deterministic risk calculation, versioned questionnaires, a scientifically audited regulatory biological-agent registry, workplace-level assessment, preventive planning outputs, bilingual Spanish-English functionality and reproducible reports. The software preserves a single language-neutral calculation core and keeps method-faithful components distinct from explicit computational extensions. The underlying ERBio method was developed by Aguilar-Elena and is described in Aguilar-Elena (2015) <doi:10.5281/zenodo.22107465>. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | utils |
| Suggests: | testthat (≥ 3.0.0), shiny, DT, readxl, openxlsx |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-08-27 15:21:38 UTC; okashi |
| Author: | Raúl Aguilar-Elena
|
| Maintainer: | Raúl Aguilar-Elena <raguilar@universidadviu.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-09 14:50:26 UTC |
ERBioR: Reproducible Occupational Biological Risk Assessment
Description
A source-traceable computational implementation of the ERBio method for occupational biological-risk assessment.
Details
ERBioR separates four layers: the original ERBio deterministic method, versioned questionnaire instruments, regulatory biological-agent data, and technical enrichment. Explicit computational extensions are labelled as such and are not silently treated as source rules.
The underlying ERBio method is described by Aguilar-Elena (2015), doi:10.5281/zenodo.22107465.
References
Aguilar-Elena, R. (2015). Riesgos biológicos laborales: ERBio, un nuevo método de evaluación teórica. Doctoral thesis, Universidad Pública de Navarra. doi:10.5281/zenodo.22107465.
Orden TES/1287/2021, de 22 de noviembre, BOE-A-2021-19371, por la que se sustituye el anexo II del Real Decreto 664/1997.
Directive 2000/54/EC of the European Parliament and of the Council, as updated for Annex III by Commission Directive (EU) 2019/1833 and Commission Directive (EU) 2020/739 for SARS-CoV-2.
See Also
erbio_assess, erbio_assess_questionnaire,
erbio_reference_level_from_agent,
erbio_assess_workplace
ERBioR Bilingual, Preventive-Action and Shiny Utilities
Description
Utilities supporting the Spanish-English presentation layer introduced in ERBioR 0.9, including language selection, approved scientific translations, preventive-action text, questionnaire internationalisation and the bundled Shiny application. Scientific calculations remain language-neutral.
Usage
erbio_set_language(language = c("es", "en"))
erbio_get_language()
erbio_load_translation_registry(path = NULL)
erbio_validate_translation_registry(path = NULL)
erbio_load_preventive_action_registry(path = NULL)
erbio_validate_preventive_action_registry(path = NULL)
erbio_load_ui_dictionary(path = NULL)
erbio_translate_ui(key, language = erbio_get_language(), path = NULL)
erbio_get_questionnaire_i18n(
questionnaire_id,
language = erbio_get_language(),
version = NULL,
path = NULL
)
erbio_bilingual_invariance_check(
questionnaire_id,
responses,
version = NULL,
scoring = "default",
path = NULL
)
erbio_preventive_action(
item_id,
language = erbio_get_language(),
path = NULL
)
erbio_run_app(launch.browser = TRUE, ...)
erbio_shiny_build_id()
Arguments
language |
Presentation language. Supported values are |
path |
Optional directory or file override. If omitted, installed ERBioR package data are used. |
key |
Stable key identifying an entry in the ERBioR user-interface dictionary. |
questionnaire_id |
Stable ERBio questionnaire identifier. |
version |
Optional questionnaire source-version identifier. |
responses |
Questionnaire response vector used to compare scientific results across presentation languages. |
scoring |
Questionnaire scoring semantics. The default preserves the scoring defined for the corresponding ERBioR instrument. |
item_id |
Stable ERBioR questionnaire item identifier. |
launch.browser |
Logical value passed to the Shiny application launcher indicating whether a browser should be opened. |
... |
Additional arguments passed to the Shiny application launcher. |
Details
The bilingual layer changes presentation text only. Questionnaire identifiers, item identifiers, scoring rules, probability and risk calculations remain language-neutral.
The translation and preventive-action registries are versioned package data. Their validation functions report structural and approval-state checks without changing the underlying ERBio scientific logic.
erbio_bilingual_invariance_check() is intended to verify that equivalent
Spanish and English presentations yield the same scientific result.
erbio_run_app() launches the Shiny application bundled with ERBioR.
Value
erbio_set_language() sets the active presentation language.
erbio_get_language() returns the active language.
Registry loading functions return data frames. Registry validation functions return structured validation results.
erbio_translate_ui() returns translated interface text.
erbio_get_questionnaire_i18n() returns a questionnaire with the selected
presentation language.
erbio_bilingual_invariance_check() returns the result of the
cross-language scientific invariance check.
erbio_preventive_action() returns the approved preventive-action
information associated with an ERBioR item.
erbio_run_app() launches the bundled Shiny application.
erbio_shiny_build_id() returns the identifier of the bundled Shiny build.
References
Aguilar-Elena, R. (2015). Riesgos biológicos laborales: ERBio, un nuevo método de evaluación teórica. doi:10.5281/zenodo.22107465.
Examples
old_lang <- erbio_get_language()
erbio_set_language("en")
erbio_get_language()
erbio_set_language(old_lang)
dict <- erbio_load_ui_dictionary()
head(dict)
tr <- erbio_load_translation_registry()
head(tr)
Biological-Agent Registry and ERBio Reference Levels
Description
Query the regulatory biological-agent registry, inspect source rules and derive ERBio reference levels without silently treating unlisted agents as group 1.
Usage
erbio_load_agent_registry(path = NULL)
erbio_load_basebio_index(path = NULL)
erbio_agent_rules(rule_id = NULL, path = NULL)
erbio_validate_agent_registry(path = NULL)
erbio_agent_lookup(query, type = NULL, exact = TRUE, path = NULL)
erbio_reference_level_from_agent(agent, path = NULL, allow_partial = FALSE)
erbio_unclassified_human_virus(agent_name)
erbio_reference_level_from_agents(agents,
policy = c("report_all", "explicit_max_group"), path = NULL)
erbio_assess_agent_questionnaire(agent, questionnaire_id, responses, exposure,
version = NULL, scoring = NULL, path = NULL,
compliance_boundary_policy = c("prose_2015", "table45_intervals", "strict"),
full_compliance_rule = c("flag_only", "thesis_override"))
Arguments
path |
Optional data-directory override. |
rule_id |
Optional machine-readable source-rule identifier. |
query |
Agent name, alias or stable identifier to search. |
type |
Optional agent type filter. |
exact |
Whether the lookup must be exact. |
agent |
Single biological-agent name or identifier. |
allow_partial |
Allow non-exact matching when resolving one agent. |
agent_name |
Name of an unclassified human virus. |
agents |
Character vector of biological agents. |
policy |
Multi-agent policy. |
questionnaire_id |
Questionnaire identifier used for the integrated assessment. |
responses |
Questionnaire responses. |
exposure |
ERBio exposure category. |
version |
Optional questionnaire version. |
scoring |
Optional scoring override. |
compliance_boundary_policy |
Compliance-boundary policy. |
full_compliance_rule |
Complete-compliance policy. |
Details
The legal group is taken from the Spanish regulatory layer. In the v0.7 audited data layer, the primary row source is Order TES/1287/2021 (BOE-A-2021-19371), which replaced Annex II of Real Decreto 664/1997. The consolidated real decree is retained as a secondary convenience reference. BASEBiO is retained as a technical enrichment layer and does not override the legal group. Agents not present in the classified list are not implicitly assigned to group 1. Independent row-by-row EUR-Lex concordance is not claimed until the dedicated EU audit is completed.
Value
Registry functions return data frames or QA lists. Reference-level functions
return structured agent-reference objects or multi-agent result lists.
erbio_assess_agent_questionnaire() returns an integrated agent and
questionnaire assessment.
References
Orden TES/1287/2021, de 22 de noviembre, BOE-A-2021-19371, Annex II replacement.
Real Decreto 664/1997, de 12 de mayo, consolidated reference.
Commission Directive (EU) 2019/1833, Annex III update, and Commission Directive (EU) 2020/739 for SARS-CoV-2.
INSST BASEBiO biological-agent database.
Examples
erbio_agent_lookup("Bacillus anthracis")
erbio_reference_level_from_agent("Mycobacterium tuberculosis")
erbio_reference_level_from_agents(
c("Bacillus anthracis", "Coxiella burnetii")
)
Core ERBio Calculation Functions
Description
Functions implementing the deterministic ERBio calculation layer: exposure, control compliance, probability, risk score (GRB), risk class and source-aware assessment aggregation.
Usage
erbio_probability_matrix()
erbio_risk_matrix()
erbio_risk_actions()
erbio_exposure_from_cadence(cadence)
erbio_exposure_level(exposure = NULL, time_percent = NULL,
boundary_policy = c("strict", "upper_category", "lower_category"))
erbio_compliance_binary(responses)
erbio_compliance_audit_0_4(scores)
erbio_compliance_class(percent,
boundary_policy = c("prose_2015", "table45_intervals", "strict"))
erbio_probability(compliance_class, exposure)
erbio_risk_score(probability, reference_level)
erbio_risk_class(score)
erbio_action(risk_class)
erbio_failed_controls(responses, item_text = NULL,
scoring = c("binary", "audit_0_4"))
erbio_assess(reference_level, exposure, compliance_percent = NULL,
responses = NULL, scoring = c("binary", "audit_0_4"), item_text = NULL,
compliance_boundary_policy = c("prose_2015", "table45_intervals", "strict"),
full_compliance_rule = c("flag_only", "thesis_override"))
erbio_assess_set(assessments,
aggregation_rule = c("unresolved", "max_risk_extension"))
Arguments
cadence |
Exposure cadence expressed using an ERBio cadence label. |
exposure |
Exposure category. |
time_percent |
Optional percentage of working time used to derive an exposure category. |
boundary_policy |
Explicit policy for source-boundary ambiguities. |
responses |
Questionnaire/control responses. Binary scoring accepts affirmative, negative and not-applicable responses. |
scores |
Audit scores on the source-preserved 0–4 scale. |
percent |
Compliance percentage. |
compliance_class |
ERBio compliance class. |
probability |
Probability level from 1 to 4. |
reference_level |
ERBio reference level from 1 to 4. |
score |
GRB risk score. |
risk_class |
ERBio risk class. |
item_text |
Optional item labels associated with responses. |
scoring |
Scoring semantics. |
compliance_percent |
Optional precomputed compliance percentage. |
compliance_boundary_policy |
Policy used to classify compliance at ambiguous boundaries. |
full_compliance_rule |
How the source statement concerning complete compliance is handled. The default flags rather than silently overrides the matrix. |
assessments |
A list of ERBio assessment objects. |
aggregation_rule |
Aggregation policy. The default preserves unresolved discordance; |
Details
ERBioR preserves documented ambiguities rather than silently resolving them. In particular, the default aggregation policy does not invent a global risk class when questionnaire-level classes disagree.
Value
Matrix/reference functions return data frames or lookup values. Scoring functions
return numeric or structured results. erbio_assess() returns an
erbio_assessment object. erbio_assess_set() returns a structured
list that preserves source-defined and unresolved aggregation status.
References
Aguilar-Elena, R. (2015). Riesgos biológicos laborales: ERBio, un nuevo método de evaluación teórica. doi:10.5281/zenodo.22107465.
Examples
erbio_probability("Aceptable", "Frecuente")
erbio_risk_score(probability = 2, reference_level = 3)
erbio_risk_class(6)
a <- erbio_assess(
reference_level = 3,
exposure = "Muy frecuente",
compliance_percent = 82.5
)
a
Integral Workplace-Level ERBio Assessment
Description
Validate the required questionnaire set, evaluate one or more biological agents, preserve questionnaire and agent-level results, and build preventive planning candidates.
Usage
erbio_sector_questionnaires(path = NULL)
erbio_validate_workplace_questionnaires(questionnaire_responses, path = NULL,
require_core = TRUE, require_sector = TRUE)
erbio_build_preventive_plan(questionnaire_scores, risk_results,
priority_policy = c("context_only", "max_observed_extension"))
erbio_workplace_rules(rule_id = NULL, path = NULL)
erbio_assess_workplace(activity, agents, questionnaire_responses, exposure,
versions = NULL, scoring = NULL, path = NULL, require_core = TRUE,
require_sector = TRUE,
questionnaire_aggregation_rule = c("unresolved", "max_risk_extension"),
workplace_aggregation_rule = c("unresolved", "max_risk_extension"),
preventive_priority_policy = c("context_only", "max_observed_extension"),
compliance_boundary_policy = c("prose_2015", "table45_intervals", "strict"),
full_compliance_rule = c("flag_only", "thesis_override"))
Arguments
path |
Optional data-directory override. |
questionnaire_responses |
Named list of questionnaire response vectors. |
require_core |
Require audit, general and workers questionnaires. |
require_sector |
Require at least one sector-specific questionnaire. |
questionnaire_scores |
Questionnaire score objects used to derive failed controls. |
risk_results |
Risk-result data used as planning context. |
priority_policy |
Preventive-priority policy. The max-observed option is an explicit extension. |
rule_id |
Optional workplace source-rule identifier. |
activity |
Activity or workplace description. |
agents |
One or more biological agents. |
exposure |
One exposure category or a named vector aligned to agents. |
versions |
Optional named questionnaire-version overrides. |
scoring |
Optional named scoring overrides. |
questionnaire_aggregation_rule |
Questionnaire-level aggregation policy. |
workplace_aggregation_rule |
Workplace-level aggregation policy. |
preventive_priority_policy |
Policy used to contextualize planning candidates. |
compliance_boundary_policy |
Compliance-boundary policy. |
full_compliance_rule |
Complete-compliance policy. |
Details
The default workplace policy preserves discordant questionnaire classes and multi-agent results rather than manufacturing a single global class. The highest observed risk class is reported separately as a descriptive field. Responsible person, target date and resources in the preventive plan are not inferred automatically.
Value
erbio_assess_workplace() returns an erbio_workplace_assessment
containing agent summaries, questionnaire summaries, risk results, unresolved
items, warnings, provenance and a deduplicated preventive plan.
References
Aguilar-Elena, R. (2015). Riesgos biológicos laborales: ERBio, un nuevo método de evaluación teórica. doi:10.5281/zenodo.22107465.
Examples
responses <- list(
audit = rep("Si", 32),
general = rep("Si", 48),
workers = rep("Si", 34),
sec_wastewater = rep("Si", 12)
)
x <- erbio_assess_workplace(
activity = "Tratamiento de aguas residuales",
agents = "Mycobacterium tuberculosis",
questionnaire_responses = responses,
exposure = "Frecuente"
)
x
Render and Export Reproducible ERBio Workplace Reports
Description
Render a workplace assessment to Markdown or export the full reproducibility bundle to files.
Usage
erbio_render_workplace_report(x, max_plan_rows = 100L)
erbio_write_workplace_report(x, file = "ERBioR_workplace_report.md",
max_plan_rows = 100L)
erbio_export_workplace_bundle(x, dir, overwrite = FALSE,
max_plan_rows = 100L)
Arguments
x |
An |
max_plan_rows |
Maximum number of preventive-plan rows printed in the Markdown report. Exported CSV data retain all rows. |
file |
Output Markdown file. |
dir |
Directory for the reproducibility bundle. |
overwrite |
Whether existing bundle files may be replaced. |
Value
erbio_render_workplace_report() returns a character string;
erbio_write_workplace_report() returns the normalized report path;
erbio_export_workplace_bundle() returns a named character vector of
written artifact paths.
Examples
responses <- list(
audit = rep("Si", 32),
general = rep("Si", 48),
workers = rep("Si", 34),
sec_wastewater = rep("Si", 12)
)
x <- erbio_assess_workplace(
"Tratamiento de aguas residuales",
"Mycobacterium tuberculosis",
responses,
"Frecuente"
)
substr(erbio_render_workplace_report(x), 1, 120)
ERBio Questionnaire Data and Assessment
Description
Access, validate, score and assess versioned ERBio questionnaires while preserving item identifiers, source provenance and validation status.
Usage
erbio_load_question_bank(path = NULL)
erbio_load_questionnaire_registry(path = NULL)
erbio_questionnaire_catalog(path = NULL)
erbio_get_questionnaire(questionnaire_id, version = NULL, path = NULL)
erbio_validate_question_bank(path = NULL)
erbio_score_questionnaire(questionnaire_id, responses, version = NULL,
scoring = c("default", "binary", "audit_0_4"), path = NULL,
language = erbio_get_language())
erbio_assess_questionnaire(questionnaire_id, responses, reference_level,
exposure, version = NULL,
scoring = c("default", "binary", "audit_0_4"), path = NULL,
compliance_boundary_policy = c("prose_2015", "table45_intervals", "strict"),
full_compliance_rule = c("flag_only", "thesis_override"))
erbio_questionnaire_rules(questionnaire_id = NULL)
Arguments
path |
Optional directory or file override. If omitted, installed package data are used. |
questionnaire_id |
Stable ERBio questionnaire identifier such as |
version |
Optional source-version identifier. |
responses |
Response vector. Named responses may use stable item IDs or final item numbers. |
scoring |
Requested scoring semantics. |
language |
Presentation language, |
reference_level |
ERBio reference level. |
exposure |
ERBio exposure category. |
compliance_boundary_policy |
Policy used to classify compliance at source-boundary ambiguities. |
full_compliance_rule |
Policy for the complete-compliance source statement. |
Details
Not-applicable items are excluded from the compliance denominator. Core and sector-specific questionnaires retain their documented validation status rather than being labelled uniformly.
Value
Load/catalog functions return data frames. Validation returns a structured QA
list. erbio_score_questionnaire() returns an
erbio_questionnaire_score; erbio_assess_questionnaire() returns
an erbio_questionnaire_assessment including failed controls and source
warnings.
References
Aguilar-Elena, R. (2015). Riesgos biológicos laborales: ERBio, un nuevo método de evaluación teórica. doi:10.5281/zenodo.22107465.
Examples
cat <- erbio_questionnaire_catalog()
head(cat)
general <- erbio_get_questionnaire("general")
nrow(general)
score <- erbio_score_questionnaire("general", rep("Si", 48))
score
assessment <- erbio_assess_questionnaire(
"general", rep("Si", 48), reference_level = 3, exposure = "Frecuente"
)
assessment
ERBioR Version Information
Description
Return the ERBioR development version and frozen report-layer identifier.
Usage
erbio_version()
erbio_report_patch_version()
Value
A length-one character string.
Examples
erbio_version()
erbio_report_patch_version()