diff --git a/package-lock.json b/package-lock.json index a5ce5552..0540cf8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6606,9 +6606,9 @@ } }, "follow-redirects": { - "version": "1.14.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", - "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" }, "fontkit": { "version": "1.8.1", @@ -10328,9 +10328,9 @@ } }, "node-fetch": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", - "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "requires": { "whatwg-url": "^5.0.0" } @@ -16147,9 +16147,9 @@ } }, "url-parse": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz", - "integrity": "sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==", + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" diff --git a/package.json b/package.json index 3ac36c7b..a10c1b32 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.21", "lowdb": "^1.0.0", - "node-fetch": "^2.6.1", + "node-fetch": "^2.6.7", "pdfmake": "^0.1.56", "pem": "^1.14.4", "react": "^16.8.4", diff --git a/src/App.jsx b/src/App.jsx index 001eb83c..4e7e8503 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -101,6 +101,12 @@ export default class App extends Component { } ehrLaunch(isContainedQuestionnaire, questionnaire) { + // Temporary indication before full supports for relaunch is implemented + if(!this.appContext.request) { + alert("Supports for relaunch will be added in the near future!"); + this.consoleLog("Supports for relaunch will be added in the near future!", "errorClass"); + return; + } const deviceRequest = JSON.parse(this.appContext.request.replace(/\\/g,"")); this.consoleLog("fetching artifacts", "infoClass"); this.setState({ diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index de291f5b..3c0afdb7 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -914,9 +914,33 @@ export default class QuestionnaireForm extends Component { }; this.addAuthorToResponse(qr, this.getPractitioner()); - qr.questionnaire = this.props.qform.id; + qr.questionnaire = `${this.FHIR_PREFIX}${this.fhirVersion}/Questionnaire/${this.props.qform.id}`; console.log("GetQuestionnaireResponse final QuestionnaireResponse: ", qr); + const request = this.props.deviceRequest; + // add context extension + qr.extension = []; + if(request !== undefined) { + const contextExtensionUrl = "http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/context"; + qr.extension.push({ + url: contextExtensionUrl, + valueReference: { + reference: `${request.resourceType}/${request.id}`, + type: `${request.resourceType}` + } + }) + + if(request.insurance !== null && request.insurance.length > 0) { + const coverage = request.insurance[0]; + qr.extension.push({ + url: contextExtensionUrl, + valueReference: { + reference: `${coverage.reference}`, + type: "Coverage" + } + }) + } + } console.log(this.props.attested); const aa = searchQuestionnaire(qr, this.props.attested); console.log(aa); @@ -1291,14 +1315,16 @@ export default class QuestionnaireForm extends Component { if (newItem.item == undefined) { //find the corresponding linkId in savedItem and replace it const findSavedParentItem = (parentLinkId, savedItem) => { - if (savedItem.linkId == parentLinkId) { + if (savedItem.linkId === parentLinkId) { return savedItem; } else { - const parentIndex = savedItem.item.findIndex(item => item.linkId == parentLinkId); - if (parentIndex != -1) { - return savedItem.item[parentIndex]; - } else { - findSavedParentItem(parentLinkId, savedItem.item); + if (savedItem.item) { + const parentIndex = savedItem.item.findIndex(item => item.linkId == parentLinkId); + if (parentIndex != -1) { + return savedItem.item[parentIndex]; + } else { + findSavedParentItem(parentLinkId, savedItem.item); + } } } };