Skip to content

Main content

FHIR Reference Depth Count Tool

Inspect literal FHIR reference path depth and final history-version syntax, without resolving or validating resources.

Loading tool…

Description

Separate the first fragment, remove a scheme-and-authority prefix and query, then count nonempty slash path segments.

Clinical identifiers and references have a namespace, target, and sometimes a version or contained-resource scope. Parsing their spelling does not resolve the target or establish semantic identity.

Separate the first fragment, remove a scheme-and-authority prefix and query, then count nonempty slash path segments.

When to use this tool

Use FHIR Reference Depth Count when you need one supported clinical-reference or scoped-identifier component.

How to use the tool and how it works

  1. Enter reference. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read pathSegments, fragmentPresent, historyVersionPresent. Inspect fragmentPresent, historyVersionPresent before interpreting the associated values.

Separate the first fragment, remove a scheme-and-authority prefix and query, then count nonempty slash path segments. Flag a history version when the penultimate remaining segment is exactly _history.1

Input fieldMeaning and unitsAccepted input
referenceSupplied reference token under the supported grammar.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
pathSegmentsPath SegmentsRequired. Safe integer.
fragmentPresentFragment PresentRequired. Boolean.
historyVersionPresentHistory Version PresentRequired. Boolean.
json
{
  "input": {
    "reference": "Patient/123/_history/2"
  },
  "output": {
    "pathSegments": 4,
    "fragmentPresent": false,
    "historyVersionPresent": true
  }
}

Limitations and assumptions

  • This is lexical structure counting rather than URI or FHIR-reference validation; repeated slashes disappear from the count and fragment presence does not establish a valid contained reference.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a complete standard-aware resolver and verify terminology, resource identity, and applicable profiles separately.

References

  1. Calculation and input contract: health-informatics/fhir-reference-depth-count — tool.io

Similar or alternative tools