Skip to content

Commit

Permalink
Merge pull request #511 from abertnamanya/validation-fix-001
Browse files Browse the repository at this point in the history
Validation fixes branch commit
  • Loading branch information
mozzy11 authored Aug 17, 2023
2 parents 4c69bd1 + 44cff7d commit a601703
Show file tree
Hide file tree
Showing 9 changed files with 1,293 additions and 3 deletions.
5 changes: 3 additions & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import AddOrder from "./components/addOrder/Index";
import ModifyOrder from "./components/modifyOrder/Index";
import RoutineReports from "./components/Reports/Routine";
import StudyReports from "./components/Reports/Study";
import StudyValidation from "./components/validation/Study";
// import StudyValidation from "./components/validation/Study";
import StudyValidation from "./components/validation/Index";
import PathologyDashboard from "./components/pathology/PathologyDashboard";
import PathologyCaseView from "./components/pathology/PathologyCaseView";
import ImmunohistochemistryDashboard from "./components/immunohistochemistry/ImmunohistochemistryDashboard"
Expand Down Expand Up @@ -291,7 +292,7 @@ export default function App() {
<SecureRoute path="/AccessionResults" exact component={() => <Admin />} role="Global Administrator" config={appConfig} onAuth={onAuth} logout={logout} isLoggedIn={isLoggedIn} />
<SecureRoute path="/RoutineReports" exact component={() => <RoutineReports />} role="Global Administrator" config={appConfig} onAuth={onAuth} logout={logout} isLoggedIn={isLoggedIn} />
<SecureRoute path="/StudyReports" exact component={() => <StudyReports />} role="Global Administrator" config={appConfig} onAuth={onAuth} logout={logout} isLoggedIn={isLoggedIn} />
<SecureRoute path="/validationStudy" exact component={() => <StudyValidation />} role="Global Administrator" config={appConfig} onAuth={onAuth} logout={logout} isLoggedIn={isLoggedIn} />
<SecureRoute path="/validation" exact component={() => <StudyValidation />} role="Global Administrator" config={appConfig} onAuth={onAuth} logout={logout} isLoggedIn={isLoggedIn} />
</Switch>
</Layout>
</Router>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
export default {
resultList: [
{
accessionNumber: "",
analysisId: "",
analysisMethod: "",
analysisStatusId: "",
childReflex: "",
considerRejectReason: "",
defaultResultValue: "",
dictionaryResults: [],
displayResultAsLog: "",
enumResultType: "",
failedValidation: "",
forceTechApproval: "",
hasQualifiedResult: "",
initialSampleCondition: "",
isGroupSeparator: "",
isModified: "",
lowerAbnormalRange: "",
lowerNormalRange: "",
multiSelectResultValues: "",
nationalId: "",
nextVisitDate: "",
nonconforming: "",
normal: "",
normalRange: "",
notIncludedInWorkplan: "",
note: "",
pastNotes: "",
patientInfo: "",
patientName: "",
qualifiedDictionaryId: "",
qualifiedResultId: "",
qualifiedResultValue: "",
rawResultDisplayType: "",
readOnly: "",
receivedDate: "",
refer: "",
referralCanceled: "",
referralId: "",
referralItem: "",
referralReasonId: "",
referredOut: "",
reflexGroup: "",
reflexJSONResult: "",
reflexParentGroup: "",
rejectReasonId: "",
rejected: "",
remarks: "",
remove: "",
removed: "",
reportable: "",
result: "",
resultDisplayType: "",
resultId: "",
resultLimitId: "",
resultType: "",
resultValue: "",
sampleGroupingNumber: "",
sampleSource: "",
sampleType: "",
sequenceAccessionNumber: "",
sequenceNumber: "",
servingAsTestGroupIdentifier: "",
shadowReferredOut: "",
shadowRejected: "",
shadowResultValue: "",
showSampleDetails: "",
siblingReflexKey: "",
significantDigits: "",
technician: "",
technicianSignatureId: "",
testDate: "",
testId: "",
testKit1InventoryId: "",
testKitId: "",
testKitInactive: "",
testKitInventoryId: "",
testMethod: "",
testName: "",
testSortOrder: "",
thisReflexKey: "",
unitsOfMeasure: "",
upperAbnormalRange: "",
upperNormalRange: "",
userChoiceReflex: "",
valid: "",
}],
accessionNumber: "",
methods: [{
id: "",
value: "",
}],
}
15 changes: 15 additions & 0 deletions frontend/src/components/validation/Index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, {useEffect, useState} from 'react'
import SearchForm from "./SearchForm";
import Validation from "./Validation";

const Index = () => {
const [results, setResults] = useState();
return (
<>
<SearchForm setResults={setResults}/>
<Validation results={results}/>
</>
)
}

export default Index;
112 changes: 112 additions & 0 deletions frontend/src/components/validation/SearchForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import React, {useState, useEffect} from 'react'
import {Button, Column, Form, FormLabel, Heading, Row, Section, Stack, TextInput} from "@carbon/react";
import {FormattedMessage} from "react-intl";
import {Formik, Field} from "formik";
import ValidationSearchFormValues from "../formModel/innitialValues/ValidationSearchFormValues";
import {getFromOpenElisServer} from "../utils/Utils";

const SearchForm = (props) => {
const [searchResults, setSearchResults] = useState();
const validationResults = (data) => {
if (data) {
setSearchResults(data);
if (data.resultList) {
const newResultsList = data.resultList.map((data, idx) => {
let tempData = {...data}
tempData.id = idx
return tempData
});
setSearchResults(prevState => ({
...prevState,
resultList: newResultsList
}));
}
} else {
props.setResults?.({resultList: []});
}
}

useEffect(() => {
props.setResults(searchResults)
}, [searchResults]);

const handleSubmit = (values) => {
let searchEndPoint = "/rest/accessionValidationByRange?" +
"accessionNumber=" + values.accessionNumber
getFromOpenElisServer(searchEndPoint, validationResults);
}

const handleChange = () => {

}


return (
<>
<Formik
initialValues={ValidationSearchFormValues}
//validationSchema={}
onSubmit={handleSubmit}
onChange
>
{({
values,
errors,
touched,
handleChange,
//handleBlur,
handleSubmit
}) => (

<Form
onSubmit={handleSubmit}
onChange={handleChange}
//onBlur={handleBlur}
>
<Stack gap={2}>

<FormLabel>
<Section>
<Section>
<Section>
<Heading>
<FormattedMessage id="label.button.search"/>
</Heading>
</Section>
</Section>
</Section>
</FormLabel>
<Row lg={12}>
<div className="inlineDiv">

<Field name="accessionNumber"
>
{({field}) =>
<TextInput
placeholder={"Enter LabNo"}
className="searchLabNumber inputText"
name={field.name} id={field.name} labelText=""/>
}
</Field>
</div>

</Row>

<Column lg={6}>
<Button type="submit" id="submit" className="searchResultsBtn">
<FormattedMessage id="label.button.search"/>
</Button>
</Column>

</Stack>

</Form>
)}
</Formik>
</>

);

}

export default SearchForm;
Loading

0 comments on commit a601703

Please sign in to comment.