Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 8f01f5a

Browse files
authored
Merge pull request #25 from HL7-DaVinci/master
Fork Auto Sync
2 parents 4428950 + bc14f68 commit 8f01f5a

4 files changed

Lines changed: 49 additions & 17 deletions

File tree

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"isomorphic-fetch": "^2.2.1",
5050
"lodash": "^4.17.21",
5151
"lowdb": "^1.0.0",
52-
"node-fetch": "^2.6.1",
52+
"node-fetch": "^2.6.7",
5353
"pdfmake": "^0.1.56",
5454
"pem": "^1.14.4",
5555
"react": "^16.8.4",

src/App.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export default class App extends Component {
103103
}
104104

105105
ehrLaunch(isContainedQuestionnaire, questionnaire) {
106+
// Temporary indication before full supports for relaunch is implemented
107+
if(!this.appContext.request) {
108+
alert("Supports for relaunch will be added in the near future!");
109+
this.consoleLog("Supports for relaunch will be added in the near future!", "errorClass");
110+
return;
111+
}
106112
const deviceRequest = JSON.parse(this.appContext.request.replace(/\\/g,""));
107113
this.consoleLog("fetching artifacts", "infoClass");
108114
this.setState({

src/components/QuestionnaireForm/QuestionnaireForm.jsx

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,33 @@ export default class QuestionnaireForm extends Component {
914914
};
915915
this.addAuthorToResponse(qr, this.getPractitioner());
916916

917-
qr.questionnaire = this.props.qform.id;
917+
qr.questionnaire = `${this.FHIR_PREFIX}${this.fhirVersion}/Questionnaire/${this.props.qform.id}`;
918918
console.log("GetQuestionnaireResponse final QuestionnaireResponse: ", qr);
919919

920+
const request = this.props.deviceRequest;
921+
// add context extension
922+
qr.extension = [];
923+
if(request !== undefined) {
924+
const contextExtensionUrl = "http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/context";
925+
qr.extension.push({
926+
url: contextExtensionUrl,
927+
valueReference: {
928+
reference: `${request.resourceType}/${request.id}`,
929+
type: `${request.resourceType}`
930+
}
931+
})
932+
933+
if(request.insurance !== null && request.insurance.length > 0) {
934+
const coverage = request.insurance[0];
935+
qr.extension.push({
936+
url: contextExtensionUrl,
937+
valueReference: {
938+
reference: `${coverage.reference}`,
939+
type: "Coverage"
940+
}
941+
})
942+
}
943+
}
920944
console.log(this.props.attested);
921945
const aa = searchQuestionnaire(qr, this.props.attested);
922946
console.log(aa);
@@ -1413,14 +1437,16 @@ export default class QuestionnaireForm extends Component {
14131437
if (newItem.item == undefined) {
14141438
//find the corresponding linkId in savedItem and replace it
14151439
const findSavedParentItem = (parentLinkId, savedItem) => {
1416-
if (savedItem.linkId == parentLinkId) {
1440+
if (savedItem.linkId === parentLinkId) {
14171441
return savedItem;
14181442
} else {
1419-
const parentIndex = savedItem.item.findIndex(item => item.linkId == parentLinkId);
1420-
if (parentIndex != -1) {
1421-
return savedItem.item[parentIndex];
1422-
} else {
1423-
findSavedParentItem(parentLinkId, savedItem.item);
1443+
if (savedItem.item) {
1444+
const parentIndex = savedItem.item.findIndex(item => item.linkId == parentLinkId);
1445+
if (parentIndex != -1) {
1446+
return savedItem.item[parentIndex];
1447+
} else {
1448+
findSavedParentItem(parentLinkId, savedItem.item);
1449+
}
14241450
}
14251451
}
14261452
};

0 commit comments

Comments
 (0)