Skip to content

Commit 5a701a6

Browse files
committed
docs: Add library documentation and correct FHIRPath references
Adds comprehensive documentation for search_to_column and fhirpath_to_column library functions with examples across all supported languages. Removes incorrect documentation of server-specific _query=fhirPath feature from library API documentation. Updates resolve() function documentation with accurate behavior and limitations.
1 parent eec0079 commit 5a701a6

File tree

5 files changed

+18575
-10
lines changed

5 files changed

+18575
-10
lines changed

site/docs/fhirpath/fhir-functions.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,41 @@ Patient.extension('http://hl7.org/fhir/StructureDefinition/patient-birthPlace')
3636
collection<Reference> -> resolve() : collection<Resource>
3737
```
3838

39-
For each Reference in the input collection, returns the resource that the
40-
reference points to.
39+
For each Reference in the input collection, returns type information about the
40+
resource that the reference points to.
4141

42-
:::note
43-
Pathling has a limited implementation of `resolve()`. It supports type checking
44-
with the `is` operator but does not perform actual resource resolution or allow
45-
traversal of resolved references.
46-
:::
42+
### How it works
43+
44+
The `resolve()` function extracts resource type information from Reference
45+
elements using the following priority:
46+
47+
1. Uses the `Reference.type` field if present (highest priority)
48+
2. Parses the type from the `Reference.reference` string (e.g., `Patient/123`
49+
Patient type)
50+
3. Returns an empty collection when the type cannot be determined
51+
52+
This supports relative references (`Patient/123`), absolute references
53+
(`http://example.org/fhir/Patient/123`), and canonical URLs.
54+
55+
### Usage with type operators
56+
57+
The primary use case for `resolve()` is type checking and filtering with the
58+
`is` and `ofType()` operators:
59+
60+
```
61+
Encounter.subject.resolve() is Patient
62+
Patient.generalPractitioner.resolve().ofType(Practitioner)
63+
Patient.generalPractitioner.where(resolve() is Organization)
64+
```
65+
66+
### Limitations
67+
68+
The `resolve()` function in Pathling extracts type information only and does
69+
**not** support field traversal. Attempting to access fields on a resolved
70+
reference (e.g., `resolve().name`) will result in an error.
71+
72+
For accessing data from referenced resources, use the `reverseResolve()`
73+
function instead. See [Extension functions](extension-functions.md) for details.
4774

4875
## memberOf
4976

site/docs/fhirpath/index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ for detailed semantics.
123123
| ------------------- | ---------------------------------------------------------------------------------- |
124124
| `exists(criteria?)` | Returns `true` if the collection has any elements, optionally filtered by criteria |
125125
| `empty()` | Returns `true` if the collection is empty |
126+
| `count()` | Returns the integer count of items in the collection (0 if empty) |
126127

127128
#### Filtering and projection functions
128129

@@ -186,15 +187,17 @@ The following FHIRPath features are **not currently supported**:
186187

187188
- **Equivalence operators**: `~` and `!~`
188189
- **Lambda expressions**
189-
- **Aggregate functions**: `count()`, `sum()`, `avg()`, `min()`, `max()`
190+
- **Aggregate functions**: `sum()`, `avg()`, `min()`, `max()`
190191
- **Special variables**: `$index`, `$total`
191192
- **Quantity arithmetic**: Math operations on Quantity types
192193
- **DateTime arithmetic**: DateTime math operations
193-
- **Full `resolve()`**: Traversal of resolved references
194+
- **Full resource resolution**: The `resolve()` function extracts type
195+
information only and does not support field traversal
194196

195197
## Additional functions
196198

197-
Pathling also supports additional functions beyond the standard FHIRPath specification:
199+
Pathling also supports additional functions beyond the standard FHIRPath
200+
specification:
198201

199202
- [FHIR-specific functions](fhir-functions.md) - Functions defined in the FHIR
200203
specification for use with FHIR data, including `extension`, `resolve`,

0 commit comments

Comments
 (0)