From f72878c4b004e387a1082258e8317cfa951e6a55 Mon Sep 17 00:00:00 2001 From: Christopher Hubert Date: Sat, 18 Nov 2023 14:15:19 -0500 Subject: [PATCH 1/2] MAT-5706 change api call for qdm imports --- src/api/useTestCaseServiceApi.ts | 19 ++++++++++ .../TestCaseImportFromBonnieDialogQDM.tsx | 19 +++++++--- .../qdm/CreateCodeCoverageNavTabs.tsx | 36 +++++++++---------- .../testCaseLanding/qdm/TestCaseList.tsx | 21 +++++------ src/util/FhirImportHelper.ts | 19 ---------- 5 files changed, 60 insertions(+), 54 deletions(-) diff --git a/src/api/useTestCaseServiceApi.ts b/src/api/useTestCaseServiceApi.ts index b830567f8..8e65313cd 100644 --- a/src/api/useTestCaseServiceApi.ts +++ b/src/api/useTestCaseServiceApi.ts @@ -220,6 +220,25 @@ export class TestCaseServiceApi { } } + async importTestCasesQDM( + measureId: string, + testCasesImportRequest: TestCaseImportRequest[] + ): Promise { + try { + return await axios.put( + `${this.baseUrl}/measures/${measureId}/test-cases/imports/qdm`, + testCasesImportRequest, + { + headers: { + Authorization: `Bearer ${this.getAccessToken()}`, + }, + } + ); + } catch (err) { + throw new Error(`Unable to create new test cases`); + } + } + async scanImportFile(file: any): Promise { try { const formData = new FormData(); diff --git a/src/components/testCaseLanding/common/import/TestCaseImportFromBonnieDialogQDM.tsx b/src/components/testCaseLanding/common/import/TestCaseImportFromBonnieDialogQDM.tsx index 187c5caa1..a6bebbec4 100644 --- a/src/components/testCaseLanding/common/import/TestCaseImportFromBonnieDialogQDM.tsx +++ b/src/components/testCaseLanding/common/import/TestCaseImportFromBonnieDialogQDM.tsx @@ -9,16 +9,14 @@ import { Paper, } from "@mui/material"; import Button from "@mui/material/Button"; -import { - processPatientBundlesForQDM, - readImportFile, -} from "../../../../util/FhirImportHelper"; +import { readImportFile } from "../../../../util/FhirImportHelper"; import { useDropzone } from "react-dropzone"; import { Toast } from "@madie/madie-design-system/dist/react"; import "./TestCaseImportDialog.css"; import * as _ from "lodash"; import useTestCaseServiceApi from "../../../../api/useTestCaseServiceApi"; import { ScanValidationDto } from "../../../../api/models/ScanValidationDto"; +import { TestCaseImportRequest } from "@madie/madie-models"; const TestCaseImportFromBonnieDialogQDM = ({ open, handleClose, onImport }) => { const [file, setFile] = useState(null); @@ -91,6 +89,19 @@ const TestCaseImportFromBonnieDialogQDM = ({ open, handleClose, onImport }) => { }, }); + function processPatientBundlesForQDM( + bonniePatients + ): TestCaseImportRequest[] { + const testCases: TestCaseImportRequest[] = []; + for (const patient of bonniePatients) { + testCases.push({ + patientId: "", + json: JSON.stringify(patient), + } as TestCaseImportRequest); + } + return testCases; + } + const renderFileDrop = () => { return ( diff --git a/src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx b/src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx index 0434c092a..ba28489c2 100644 --- a/src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx +++ b/src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx @@ -157,25 +157,23 @@ export default function CreateCodeCoverageNavTabs(props: NavTabProps) { />
- {featureFlags?.importTestCases && ( -
- -
- )} +
+ +
-
+ {featureFlags?.importTestCases && ( +
+ +
+ )}