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
- Enter reference. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| reference | Supplied reference token under the supported grammar. | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| pathSegments | Path Segments | Required. Safe integer. |
| fragmentPresent | Fragment Present | Required. Boolean. |
| historyVersionPresent | History Version Present | Required. Boolean. |
{
"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
Similar or alternative tools
- FHIR Reference Version History Token
Parse a supported relative ResourceType/id with optional /_history/version, using 1-64 ASCII identifier characters.
- FHIR Canonical Fragment Separator Flag
Locate the first pipe and hash, flag a version only when pipe precedes any hash, flag fragment presence, and return text before either separator as canonicalBase.