Skip to content

Commit

Permalink
Fix/test type (#87)
Browse files Browse the repository at this point in the history
* set cert expiration from service or recovery

* add value set 4 test type

Co-authored-by: Gordon Grund <[email protected]>
  • Loading branch information
ggrund-tsi and ggrund-tsi authored Jun 2, 2021
1 parent a2af5f2 commit 9cd82c1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
18 changes: 18 additions & 0 deletions src/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import VaccineManufacturers from './assets/json-res/vaccine-mah-manf.json';
import Vaccines from './assets/json-res/vaccine-prophylaxis.json';
import TestManufacturers from './assets/json-res/test-manf.json';
import TestResult from './assets/json-res/test-result.json';
import TestType from './assets/json-res/test-type.json';

interface IValue {
active: boolean,
Expand Down Expand Up @@ -116,6 +117,23 @@ export const useGetVaccines = () => {
return vaccines;
}

// TestType
export const useGetTestType = () => {

const [testType, setTestType] = React.useState<IValueSet>();

React.useEffect(() => {
// get object via api
// const testManufacturers = getApiData('/testManufacturers');

// get object via public
const testType = TestType.valueSetValues;
setTestType(testType);
}, [])

return testType;
}

// TestManufacturers
export const useGetTestManufacturers = () => {

Expand Down
20 changes: 20 additions & 0 deletions src/assets/json-res/test-type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"valueSetId": "covid-19-lab-test-type",
"valueSetDate": "2021-04-27",
"valueSetValues": {
"LP6464-4": {
"display": "Nucleic acid amplification with probe detection",
"lang": "en",
"active": true,
"version": "2.69",
"system": "http://loinc.org"
},
"LP217198-3": {
"display": "Rapid immunoassay",
"lang": "en",
"active": true,
"version": "2.69",
"system": "http://loinc.org"
}
}
}
7 changes: 4 additions & 3 deletions src/components/pdf-generater.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import folding_instruction from '../assets/images/folding-instruction.png';
import { EUDGC, RecoveryEntry, TestEntry, VaccinationEntry } from '../generated-files/dgc-combined-schema';
import {
useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines,
useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult
useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult, useGetTestType
} from '../api';
import { getValueSetDisplay, convertDateToOutputFormat } from '../misc/ShowCertificateData';
// import pdfParams from '../pdf-settings.json';
Expand Down Expand Up @@ -97,6 +97,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
const vaccines = useGetVaccines();
const testManufacturersValueSet = useGetTestManufacturers();
const testResultValueSet = useGetTestResult();
const testTypeValueSet = useGetTestType();

//A4 210 x 297 mm or 2480 x 3508 pixels or 595 × 842 points
//A6 105 x 74 mm or 1240 x 1748 pixels or 298 × 420 points
Expand Down Expand Up @@ -727,7 +728,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
y = printVerticalBlock(x, y,
t('translation:pdfTypeOfTest'),
french.translation.pdfTypeOfTest,
testSet.tt,
getValueSetDisplay(testSet.tt, testTypeValueSet),
lineHeight, true);

y = printVerticalBlock(x, y,
Expand Down Expand Up @@ -804,7 +805,7 @@ const usePdfGenerator = (qrCodeCanvasElementProp: any, eudgcProp: EUDGC | undefi
y = printVerticalBlockRotated(x, y,
t('translation:pdfTypeOfTest'),
french.translation.pdfTypeOfTest,
testSet.tt,
getValueSetDisplay(testSet.tt, testTypeValueSet),
lineHeight, true);

y = printVerticalBlockRotated(x, y,
Expand Down
6 changes: 3 additions & 3 deletions src/components/record-test-cert-data.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

import { EUDGC, TestEntry } from '../generated-files/dgc-combined-schema';
import { useGetDiseaseAgents, useGetTestManufacturers, useGetTestResult } from '../api';
import { useGetDiseaseAgents, useGetTestManufacturers, useGetTestResult, useGetTestType } from '../api';

import schema from '../generated-files/DGC.combined-schema.json';
import { Validator } from 'jsonschema';
Expand Down Expand Up @@ -214,11 +214,11 @@ const RecordTestCertData = (props: any) => {
/>

{/* testType input */}
<FormGroupInput controlId='formTestTypeInput' title={t('translation:testType')}
<FormGroupValueSetSelect controlId='formTestTypeInput' title={t('translation:testType')}
value={testType}
onChange={(evt: any) => setTestType(evt.target.value)}
required
maxLength={50}
valueSet={useGetTestType}
/>

{/* testName input */}
Expand Down
5 changes: 3 additions & 2 deletions src/misc/ShowCertificateData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import i18n from 'i18next'
import { IValueSet } from '../api';
import moment from 'moment';
import utils from './utils';
import { useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines, useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult } from '../api';
import { useGetDiseaseAgents, useGetVaccineManufacturers, useGetVaccines, useGetVaccinMedicalData, useGetTestManufacturers, useGetTestResult, useGetTestType } from '../api';
import React from 'react';
import { Card } from 'react-bootstrap';

Expand All @@ -28,6 +28,7 @@ export const ShowCertificateData = (props: any) => {
const vaccines = useGetVaccines();
const testManufacturersValueSet = useGetTestManufacturers();
const testResultValueSet = useGetTestResult();
const testTypeValueSet = useGetTestType();

const [eudgc, setEudgc] = React.useState<EUDGC>();
const [vaccinationSet, setVaccinationSet] = React.useState<VaccinationEntry>();
Expand Down Expand Up @@ -124,7 +125,7 @@ export const ShowCertificateData = (props: any) => {
title: i18n.t('translation:test-data'),
entries: [
{ label: i18n.t('translation:disease-agent'), data: getValueSetDisplay(testSet?.tg, diseaseAgentsData) || defaultString },
{ label: i18n.t('translation:testType'), data: testSet?.tt || defaultString },
{ label: i18n.t('translation:testType'), data: getValueSetDisplay(testSet?.tt, testTypeValueSet) || defaultString },
{ label: i18n.t('translation:testName'), data: testSet?.nm || defaultString },
{ label: i18n.t('translation:testManufacturers'), data: getValueSetDisplay(testSet?.ma, testManufacturersValueSet) || defaultString }
]
Expand Down

0 comments on commit 9cd82c1

Please sign in to comment.