From 1ca954242684add2cee8ea3fe5b4971e05f6d929 Mon Sep 17 00:00:00 2001 From: Stas Buldakov Date: Mon, 2 Dec 2024 18:41:35 +0400 Subject: [PATCH] Fix creating QuestionnaireResponses in smart apps demo --- .../app/(authorized)/questionnaires/page.tsx | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/aidbox-forms-smart-launch-2/src/app/(authorized)/questionnaires/page.tsx b/aidbox-forms-smart-launch-2/src/app/(authorized)/questionnaires/page.tsx index 1eb2369..b7d77ee 100644 --- a/aidbox-forms-smart-launch-2/src/app/(authorized)/questionnaires/page.tsx +++ b/aidbox-forms-smart-launch-2/src/app/(authorized)/questionnaires/page.tsx @@ -75,7 +75,9 @@ export default async function QuestionnairesPage({ searchParams }: PageProps) { const aidbox = await getCurrentAidbox(); const subject = await getCurrentPatient().catch(() => null); - const encounter = await getCurrentEncounter().catch(() => null); + // const encounter = await getCurrentEncounter().catch(() => null); + // TODO: fix data sync with EHR + // Encounters are created due to errors in references const author = await getCurrentUser().catch(() => null); const result = await aidbox @@ -94,18 +96,6 @@ export default async function QuestionnairesPage({ searchParams }: PageProps) { { name: "context", part: [ - ...(encounter - ? [ - { - name: "name", - valueString: "encounter", - }, - { - name: "content", - resource: encounter, - }, - ] - : []), ...(author ? [ { @@ -128,7 +118,9 @@ export default async function QuestionnairesPage({ searchParams }: PageProps) { const populated = result.parameter?.find(({ name }) => name === "response") ?.resource as QuestionnaireResponse; - populated.questionnaire = `${questionnaire.url}${questionnaire.version ? `|${questionnaire.version}` : ""}`; + populated.questionnaire = `${questionnaire.url}${ + questionnaire.version ? `|${questionnaire.version}` : "" + }`; const saved = await aidbox .post("fhir/QuestionnaireResponse", { @@ -211,7 +203,7 @@ export default async function QuestionnairesPage({ searchParams }: PageProps) { (page - 1) * pageSize + 1 }-${Math.min( page * pageSize, - total, + total )} of ${total} practitioners`} ) : null}