Skip to content

Validate ADL 2.4 at-coded archetypes#799

Open
MattijsK wants to merge 3 commits into
adl_2.4_supportfrom
791_validate_2.4_at_coded_adl
Open

Validate ADL 2.4 at-coded archetypes#799
MattijsK wants to merge 3 commits into
adl_2.4_supportfrom
791_validate_2.4_at_coded_adl

Conversation

@MattijsK

@MattijsK MattijsK commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes #791

Validate ADL 2.4 at-coded archetypes

Summary

Teaches the archetype validator to validate ADL 2.4 at-coded archetypes —
those whose structural node identifiers use the at prefix (e.g. at0000,
at0000.1) instead of id (id1, id1.1). Builds on the existing ADL 2.4
grammar (#659) and ADL 1.4 → ADL 2.4 at-coded converter (#658); this PR makes the
converter's output (and hand-written at-coded archetypes) pass validation,
including flattening and specialization.

Behaviour / configuration

A new ArchetypeValidationSettings.nodeIdCodeSystemValidation option controls which
node-id code system is accepted:

Value Meaning
ID_CODED (default) Only id-coded archetypes — fully backwards compatible
AT_CODED Only at-coded archetypes
AUTO_DETECT Detect the code system from the root node id and validate the rest against it

New rule: an archetype must use a single, consistent node-id code system, and
it must match the configured/detected one. Violations (mixed systems, or wrong
system for the configuration) are reported via a new error type
INVALID_NODE_ID_CODE_SYSTEM.

Changes

  • NodeIdCodeSystemValidation enum + setting (default ID_CODED).
  • ArchetypeValidationBase: expectsAtCodedNodeIds() resolver (auto-detect from
    root prefix) and a code-system-aware code-format check.
  • CodeSystemValidation (new, phase 0): enforces the single/consistent code-system rule.
  • BasicChecks: root-node pattern is code-system-aware (at0000(.1)* vs id1(.1)*).
  • CodeValidation / BasicTerminologyValidation: terminology lookups and
    code-format/term-binding checks no longer assume the id prefix.
  • AOMUtils (codesConformant, pathAtSpecializationLevel): accept the
    zero-padded codes at-coded ADL 2.4 retains from ADL 1.4 (uses isValidADL14Code,
    a strict superset of isValidCode, so id-coded behaviour is unchanged). This is
    what makes at-coded flattening and specialization validation work.
  • ErrorType.INVALID_NODE_ID_CODE_SYSTEM added.
  • i18n: English/Dutch messages for the new strings.

Tests

  • AtCodedArchetypeValidationTest (13 tests): at-coded passes under AT_CODED /
    AUTO_DETECT and is rejected under the default ID_CODED (incl. via the no-settings
    default validator); id-coded vice-versa; mixed systems rejected (both AUTO_DETECT
    and explicit modes); malformed at-coded root; and a specialized at-coded archetype
    that validates and flattens
    end-to-end (OBSERVATION + CLUSTER fixtures).
  • AOMUtilsTest.codesConformant: direct unit test of the core conformance change
    (id-coded, zero-padded at-coded, and prefix-collision non-conformance).

Compatibility & scope notes

  • Default is ID_CODED, so existing behaviour is unchanged; full :aom/:tools
    suites pass.
  • VARCN is retained for the root-node-form check (with an at-coded message variant);
    the new code-system-consistency rule uses the dedicated INVALID_NODE_ID_CODE_SYSTEM.
  • A few seldom-used helpers (ArchetypeTerminology.idCodes(),
    hasIdCodeInAllLanguages()) still assume id-coded forms but aren't on the validation
    path; can be revisited if at-coded OPT generation needs them later.

MattijsK added 2 commits June 18, 2026 16:57
Add support for validating at-coded ADL 2.4 archetypes, where structural
node identifiers use the 'at' prefix (e.g. at0000) instead of 'id'.

- Add NodeIdCodeSystemValidation setting {ID_CODED, AT_CODED, AUTO_DETECT},
  defaulting to ID_CODED for backwards compatibility. AUTO_DETECT picks the
  code system from the root node id.
- Add CodeSystemValidation enforcing a single, consistent node-id code system
  that matches the configured/detected one, reported via the new
  INVALID_NODE_ID_CODE_SYSTEM error type.
- Make BasicChecks root-node pattern and CodeValidation terminology lookup
  code-system aware.
- Accept zero-padded at-coded codes (retained from ADL 1.4) in the structural
  conformance/path helpers codesConformant and pathAtSpecializationLevel, so
  flattening and specialization validation work for at-coded archetypes.
- Add Dutch translations for the new messages.
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.71930% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.33%. Comparing base (73cb5e5) to head (79d3b30).

Files with missing lines Patch % Lines
...ypevalidator/validations/CodeSystemValidation.java 88.00% 1 Missing and 2 partials ⚠️
...ie/archetypevalidator/ArchetypeValidationBase.java 75.00% 0 Missing and 2 partials ⚠️
...main/java/com/nedap/archie/aom/utils/AOMUtils.java 50.00% 0 Missing and 1 partial ⚠️
...archetypevalidator/validations/CodeValidation.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             adl_2.4_support     #799      +/-   ##
=====================================================
+ Coverage              72.28%   72.33%   +0.04%     
- Complexity              7233     7260      +27     
=====================================================
  Files                    680      682       +2     
  Lines                  23419    23467      +48     
  Branches                3795     3804       +9     
=====================================================
+ Hits                   16928    16974      +46     
  Misses                  4753     4753              
- Partials                1738     1740       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MattijsK MattijsK marked this pull request as ready for review June 23, 2026 08:54
@VeraPrinsen VeraPrinsen self-requested a review June 25, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant