Skip to content

Commit 16ac94a

Browse files
Revert "Revert "Fix #136""
This reverts commit 749fc98
1 parent b09f545 commit 16ac94a

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
This log documents significant changes for each release. This project follows
44
[Semantic Versioning](http://semver.org/).
55

6+
## [3.14.1] - 2024-05-21
7+
### Fixed
8+
- impossibility to use attribute name that starts with a capital letter.
9+
610
## [3.14.0] - 2024-05-09
711
### Added
812
- supplementary function `weight()` with alternative name `ordinal()`.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fhirpath",
3-
"version": "3.14.0",
3+
"version": "3.14.1",
44
"description": "A FHIRPath engine",
55
"main": "src/fhirpath.js",
66
"dependencies": {

src/fhirpath.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,16 @@ engine.MemberInvocation = function(ctx, parentData, node ) {
378378
const model = ctx.model;
379379

380380
if (parentData) {
381-
if(util.isCapitalized(key)) {
382-
return parentData
383-
.filter((x) => x instanceof ResourceNode && x.path === key);
384-
} else {
385-
return parentData.reduce(function(acc, res) {
386-
res = makeResNode(res, null, res.__path__?.path, null,
387-
res.__path__?.fhirNodeDataType);
381+
return parentData.reduce(function(acc, res) {
382+
res = makeResNode(res, null, res.__path__?.path, null,
383+
res.__path__?.fhirNodeDataType);
384+
if (res.data?.resourceType === key) {
385+
acc.push(res);
386+
} else {
388387
util.pushFn(acc, util.makeChildResNodes(res, key, model));
389-
return acc;
390-
}, []);
391-
}
388+
}
389+
return acc;
390+
}, []);
392391
} else {
393392
return [];
394393
}

test/cases/3.2_paths.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,18 @@ tests:
9999
model: 'stu3'
100100
result: ['Green']
101101

102+
- desc: "Access a custom field starting with a capital letter (1)"
103+
expression: CustomField = 'test'
104+
result: [true]
105+
106+
- desc: "Access a custom field starting with a capital letter (2)"
107+
expression: Observation.CustomField = 'test'
108+
result: [true]
109+
102110

103111
subject:
104112
resourceType: Observation
113+
CustomField: "test"
105114
valueString: "high"
106115
contained:
107116
- resourceType: Observation

0 commit comments

Comments
 (0)