Ontology-driven clinical reasoning engine for ACRAgent, combining SWRL/SQWRL rule logic, Bayesian enhancement, CDS result schemas, and an interim integration bridge toward MVP.
ACR-reasoner is the dedicated reasoning-engine repository for ACRAgent.
This repository is separate from ACR-platform, which contains the working demo platform and website stack. The purpose of ACR-reasoner is to develop, validate, and version the clinical reasoning layer independently from the public/demo web platform.
The repository currently supports:
- ACR Ontology reasoning assets
- SWRL rule development and maintenance
- SQWRL query development and maintenance
- Bayesian probabilistic enhancement layer
- CDS result schema design
- Bayesian test harness and coverage validation
- Interim JavaScript bridge logic for
acr_pathway.html - Migration path toward the eventual native ontology reasoner
This repository is for reasoning logic and validation, not for production patient-data custody.
ACRAgent follows the principle:
Data Stays. Rules Travel.
This means:
- patient data should remain within the hospital, clinic, doctor, or patient-controlled environment
- ACRAgent reasoning assets travel securely to the data environment
- this repository does not define a central live production patient repository
- any local/demo/test database structures are for MVP, testing, and partner guidance only
ACR-platformcontains the demo platform and web application forwww.acragent.comACR-reasonercontains the reasoning engine workstream
Typical integration flow:
- reasoning assets are developed and validated in
ACR-reasoner - stable outputs are packaged
- selected outputs are integrated into
ACR-platform - demo/MVP release candidates are tested locally before deployment
Current phase focus:
- maintain and extend the ACR Ontology reasoning model
- validate the current 22 SWRL rules and 15 SQWRL queries
- integrate Bayesian posterior reasoning into the interim CDS flow
- maintain a hard-coded JavaScript bridge in
acr_pathway.htmluntil the native ontology reasoner is complete - build a formal Bayesian test harness with before/after comparison and rule coverage tracking
- align CDS output with an explicit machine-readable schema
ACR-reasoner/
├── ontology/
│ ├── swrl/
│ ├── sqwrl/
│ ├── mappings/
│ └── docs/
├── bayes/
│ ├── js/
│ ├── python/
│ ├── config/
│ └── tests/
├── harness/
│ ├── cases/
│ ├── coverage/
│ ├── ui/
│ └── schemas/
├── integration/
│ ├── acr_pathway/
│ └── bridge/
├── docs/
├── examples/
└── README.md
Contains the formal knowledge layer.
Suggested contents:
- native
.swrlfiles - native
.sqwrlfiles - English and Chinese rule/query versions where needed
- ontology-to-JS bridge mappings
- ontology notes and design documentation
Contains the Bayesian enhancement layer.
Suggested contents:
- JavaScript Bayes engine
- Python Bayes engine
- evidence-weight configuration
- prior probability configuration
- unit tests for posterior calculations
- reference examples
Contains the ACRAgent Bayesian validation framework.
Suggested contents:
- named clinical test cases
- 22-rule SWRL coverage table
- 15-query SQWRL coverage table
- deterministic vs Bayes comparison cases
- harness UI page
- revised CDS result schemas
Contains interim integration assets for the current MVP bridge.
Suggested contents:
acr_pathwayintegration logic- Bayes ON/OFF bridge
- schema adapters
- packaging notes for
ACR-platform
Contains technical and product documentation.
Suggested contents:
- architecture notes
- workflow and SOP documents
- release procedures
- validation strategy
- mapping documents
Contains demonstration outputs and sample data.
Suggested contents:
- sample CDS result JSON
- example patient test payloads
- example posterior calculations
- example before/after outputs
ACR-reasoner
├── README.md
├── .gitignore
├── docs
│ ├── architecture
│ │ ├── ACRAgent_reasoner_architecture.md
│ │ ├── bayes_integration_architecture.md
│ │ ├── cds_output_formulation.md
│ │ └── data_stays_rules_travel.md
│ ├── workflow
│ │ ├── local_development_workflow.md
│ │ ├── release_workflow.md
│ │ ├── regression_test_checklist.md
│ │ └── github_desktop_workflow.md
│ ├── mappings
│ │ ├── swrl_to_js_mapping.md
│ │ ├── sqwrl_to_js_mapping.md
│ │ ├── pathway_bayes_mapping.md
│ │ └── ui_to_cds_schema_mapping.md
│ └── validation
│ ├── bayesian_test_harness_specification.md
│ ├── swrl_22_rule_coverage_table.csv
│ ├── sqwrl_15_query_coverage_table.csv
│ └── test_cases_catalogue.md
├── ontology
│ ├── swrl
│ │ ├── acr_rules_native.swrl
│ │ ├── acr_rules_bayesian_bridge.swrl
│ │ ├── acr_swrl_rules_zh.swrl
│ │ └── acr_swrl_rules_en.swrl
│ ├── sqwrl
│ │ ├── acr_queries_native.sqwrl
│ │ ├── acr_queries_bayesian_bridge.sqwrl
│ │ ├── acr_sqwrl_queries_zh.sqwrl
│ │ └── acr_sqwrl_queries_en.sqwrl
│ ├── json
│ │ ├── rules.json
│ │ ├── queries.json
│ │ ├── rules.en.json
│ │ ├── rules.zh.json
│ │ ├── queries.en.json
│ │ └── queries.zh.json
│ ├── mappings
│ │ ├── swrl_rule_map.json
│ │ ├── sqwrl_query_map.json
│ │ ├── rule_evidence_map.json
│ │ └── ontology_bridge_map.json
│ └── notes
│ ├── ontology_design_notes.md
│ ├── swrl_rule_rationale.md
│ └── sqwrl_query_rationale.md
├── bayes
│ ├── js
│ │ ├── bayesEngine.js
│ │ ├── bayesEvidenceMapper.js
│ │ ├── bayesAssessmentRunner.js
│ │ └── bayesDebugView.js
│ ├── python
│ │ ├── bayes_engine.py
│ │ ├── posterior_examples.py
│ │ └── validation_runner.py
│ ├── config
│ │ ├── bayes-config.json
│ │ ├── priors.json
│ │ ├── likelihood_ratios.json
│ │ └── hypothesis_catalogue.json
│ ├── tests
│ │ ├── bayesEngine.test.js
│ │ ├── evidenceMapper.test.js
│ │ ├── posterior_regression_cases.json
│ │ └── bayes_expected_outputs.json
│ └── examples
│ ├── simple_posterior_example.json
│ ├── breast_case_example_1.json
│ └── breast_case_example_2.json
├── harness
│ ├── ui
│ │ ├── acr_bayes_test_harness.html
│ │ ├── harness.css
│ │ └── harness.js
│ ├── cases
│ │ ├── case_library.json
│ │ ├── subtype_cases.json
│ │ ├── treatment_cases.json
│ │ ├── mdt_cases.json
│ │ ├── staging_cases.json
│ │ └── followup_cases.json
│ ├── coverage
│ │ ├── swrl_22_rule_coverage_table.csv
│ │ ├── sqwrl_15_query_coverage_table.csv
│ │ ├── swrl_coverage_status.json
│ │ └── sqwrl_coverage_status.json
│ ├── schemas
│ │ ├── cds-result.schema.json
│ │ ├── cds-result.bayes.schema.json
│ │ ├── case.schema.json
│ │ └── bayes_assessment.schema.json
│ └── reports
│ ├── expected_vs_actual_template.md
│ ├── regression_results_template.md
│ └── test_execution_log_template.md
├── integration
│ ├── acr_pathway
│ │ ├── acr_pathway.html
│ │ ├── acr_pathway_bayes_modified.html
│ │ ├── acr_pathway_bayes_bridge.js
│ │ ├── cds-result.schema.json
│ │ └── acr_pathway_cds_logic_notes.md
│ ├── platform_bridge
│ │ ├── export_for_acr_platform.md
│ │ ├── file_replacement_map.md
│ │ ├── local_test_integration_steps.md
│ │ └── regression_test_matrix.md
│ └── demo_assets
│ ├── sample_outputs
│ ├── screenshots
│ └── before_after_examples
├── examples
│ ├── sample_cds_output_deterministic.json
│ ├── sample_cds_output_bayes.json
│ ├── sample_patient_payload.json
│ └── sample_reasoning_trace.json
└── scripts
├── generate-swrl-json.js
├── generate-swrl-languages.js
├── validate-cds-schema.js
├── run-harness.js
└── export-integration-bundle.js
At present, ACRAgent uses an interim phased approach:
- structured patient facts are prepared
- interim hard-coded JavaScript logic mirrors part of the SWRL/SQWRL reasoning
- Bayesian reasoning performs posterior update on selected hypotheses
- CDS output is assembled into a structured result
- the long-term target is to replace the interim JS reasoning core with the native ontology reasoner
This means the current JS logic is a temporary bridge, not the final ontology implementation.
The CDS result should not be presented as isolated raw rule firings.
The preferred result structure is:
- inferred clinical state
- recommendation package
- Bayesian confidence package
- explanation and provenance package
- operational next steps
Rule-level detail should remain available for traceability, testing, and audit.
This repository should use layered validation:
For:
- Bayes theorem calculations
- prior/odds/posterior conversions
- evidence combination
- edge cases
For:
- patient fact mapping
- JS bridge to Bayes module
- CDS schema output structure
- pathway alignment with intended rule logic
For:
- all 22 SWRL rules
- all 15 SQWRL queries
- explicit status:
- implemented
- partial
- not yet mirrored
- pending ontology-native support
For:
- Bayes OFF deterministic result
- Bayes ON posterior-enhanced result
- expected vs actual comparison
- pass/fail outcome
Local development is expected to use:
- GitHub Desktop
- local development machine
- sync to GitHub repository
- controlled export/integration into
ACR-platform
Recommended cycle:
- create or update reasoning assets in
ACR-reasoner - validate locally with tests and harness
- package selected integration outputs
- update local test copy of
ACR-platform - run platform-level regression tests
- promote approved changes to the hosted demo platform
Recommended branch model:
main— stable validated reasoning assetsdevelop— active integration work- feature branches, for example:
feature/bayes-enginefeature/swrl-coveragefeature/cds-schemafeature/pathway-bridgefeature/harness-ui
Suggested first milestones:
Repository setup and baseline import
SWRL/SQWRL canonical organisation
Bayesian engine and evidence mappings
Bayesian test harness and coverage tables
acr_pathway interim integration bridge
CDS schema revision and validation
This repository must remain aligned with the ACRAgent operating principle:
Data Stays. Rules Travel.
Therefore:
- no assumption of central production access to live patient records
- no design dependency on central patient-data custody
- demo/test/local database structures are for validation and partner guidance only
- deployment models must support local reasoning execution within partner environments
This repository is part of phased development toward MVP.
It supports:
- current ontology and rule work
- Bayesian enhancement
- interim bridge logic
- validation and test harness development
It does not yet represent the final native ontology runtime.
ACRAgent development team
Repository owner: KY-BChain
To be defined according to project and partner requirements.