Stream: javascript
Topic: mkFHIR from bash CLI
Akeem Leighton Foster Spencer (Feb 08 2018 at 16:00):
For interactive and convenience purposes, I'm creating an alias for grabbing the fhir.js module from the command line as this:
alias sandbox="cd Documents/location;node -i -p \"var smart=require('fhir.js')({baseUrl: 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/open'});\""
∴
...
var smart.fetchAll({type: "Patient", query:{name: "Batz"}}).then(e=>console.log(e)).catch(e=>console.error(e))
//will output->
TypeError: Cannot read property 'statusCode' of undefined
at Request._callback (C:\Users\Akeem Spencer\Documents\afas-stu3\afas-stu3\node_modules\fhir.js\src\adapters\node.js:18:57)
at self.callback (C:\Users\Akeem Spencer\Documents\afas-stu3\afas-stu3\node_modules\fhir.js\node_modules\request\request.js:236:22
)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at ClientRequest.self.clientErrorHandler (C:\Users\Akeem Spencer\Documents\afas-stu3\afas-stu3\node_modules\fhir.js\node_modules\r
equest\request.js:341:10)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
What does this trace mean and how can I call it from the cli?
EDIT:
I found a workaround, but I can't quite explain the reasoning behind it:
alias sandbox="cd Documents/location;node -i -p \"var smart=require('fhir.js')({baseUrl:decodeURIComponent( 'https:%2F%2Fsb-fhir-stu3.smarthealthit.org%2Fsmartstu3%2Fopen'});\""
Last updated: Apr 12 2022 at 19:14 UTC