None of the examples in README.md work
timharsch opened this issue · 4 comments
fhirpath version: 2.2.2
% curl http://www.hl7.org/fhir/patient-example-a.json > pt.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2690 100 2690 0 0 9212 0 --:--:-- --:--:-- --:--:-- 9180
% ./fhirpath --expression 'Patient.name.given' --resourceFile pt.json
./fhirpath:569: command not found: .resource
% ./fhirpath --expression 'Observation.value' --resourceJSON '{"resourceType": "Observation", "valueString": "Green"}' --model r4
./fhirpath:560: command not found: .resource
% ./fhirpath --expression 'Patient.name.given'
./fhirpath:564: command not found: .resource
I am having trouble reproducing that problem. It would help if you could answer the following:
- What operating system are you using?
- What is directory in which you are running './fhirpath'?
- What is the result of /usr/bin/env node --version ?
- How did you install fhirpath.js?
- OSX
- myproject/node_modules/fhirpath/bin
- node version
% /usr/bin/env node --version
v13.13.0
yarn add fhirpath
I just tried OSX with node.js 12.18.0 and the examples worked. But, I installed with npm. I don't have experience with yarn. Could you try "npm install fhirpath"?
Also, an odd thing about the errors you are getting is that it is complaining about line numbers like "560", but bin/fhirpath is only 51 lines long. Just so we can be sure we are running the same program, could you paste the first few lines of "./fhirpath"?
I apologize, this was due to me not following the manual. I'm used to unix ability to read from stdin so I tried '-f-'. Not sure why this would happen, but for some reason that caused it to define a bash function, or alias, in the current shell.
% ./fhirpath --expression 'Patient.name.given' --resourceFile pt.json
fhirpath(Patient.name.given) =>
[
"Duck"
]
% cat ~/tmp/t2.json| ./fhirpath -e Bundle.entry.first().resource -f-
% which ./fhirpath
./fhirpath () {
.resource -f-
}
From that point forward all the invocations of ./fhirpath
were giving the error.
I guess it would be helpful if fhirpath supported reading from '-' but that is a minor issue.