Skip to content

Commit

Permalink
Merge branch 'I-TECH-UW:develop' into Add-intergattion-test-for-Sampl…
Browse files Browse the repository at this point in the history
…eHumanService
  • Loading branch information
josephbate authored Dec 20, 2024
2 parents ea6d00e + 96dbceb commit 89b84bc
Show file tree
Hide file tree
Showing 15 changed files with 635 additions and 60 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
- name: check formatting
run: mvn spotless:check

- name: Initialize and build submodules
run: |
cd dataexport
mvn clean install
cd ..
# - name: Initialize and build submodules
# run: |
# cd dataexport
# mvn clean install
# cd ..

- name: Build OpenELIS-Global2
run: mvn clean install -Dspotless.check.skip=true
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "plugins"]
path = plugins
url = https://github.com/openelisglobal/openelisglobal-plugins.git
url = https://github.com/I-TECH-UW/openelisglobal-plugins.git
[submodule "tools/Liquibase-Outdated"]
path = tools/Liquibase-Outdated
url = https://github.com/I-TECH-UW/Liquibase-Outdated.git
Expand Down
25 changes: 14 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ RUN ./install/createDefaultPassword.sh -c -p ${DEFAULT_PW}
##
# Build DataExport
#
COPY ./dataexport /build/dataexport
WORKDIR /build/dataexport/dataexport-core
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn dependency:go-offline
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn clean install -DskipTests
WORKDIR /build/dataexport/
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn dependency:go-offline
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn clean install -DskipTests
# COPY ./dataexport /build/dataexport
# WORKDIR /build/dataexport/dataexport-core
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn dependency:go-offline
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn clean install -DskipTests
# WORKDIR /build/dataexport/
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn dependency:go-offline
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn clean install -DskipTests

##
# Build the Project
#
WORKDIR /build

COPY ./pom.xml /build/pom.xml
Expand Down
25 changes: 14 additions & 11 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
ADD ./pom.xml /build/pom.xml
ADD ./tools /build/tools
ADD ./src /build/src
ADD ./dataexport /build/dataexport
# ADD ./dataexport /build/dataexport

WORKDIR /build

Expand All @@ -28,17 +28,20 @@ RUN ./install/createDefaultPassword.sh -c -p ${DEFAULT_PW}
##
# Build DataExport
#
WORKDIR /build/dataexport/dataexport-core
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn dependency:go-offline
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn clean install -DskipTests
WORKDIR /build/dataexport/
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn dependency:go-offline
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn clean install -DskipTests
# WORKDIR /build/dataexport/dataexport-core
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn dependency:go-offline
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn clean install -DskipTests
# WORKDIR /build/dataexport/
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn dependency:go-offline
# RUN --mount=type=cache,target=/root/.m2,sharing=locked \
# mvn clean install -DskipTests

##
# Build the Project
#
WORKDIR /build

RUN --mount=type=cache,target=/root/.m2,sharing=locked \
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/admin/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
User,
BatchJob,
Popup,
Search,
} from "@carbon/icons-react";
import PathRoute from "../utils/PathRoute";
import CalculatedValue from "./calculatedValue/CalculatedValueForm";
Expand Down Expand Up @@ -57,6 +58,7 @@ import ManageMethod from "./testManagement/ManageMethod.js";
import BatchTestReassignmentAndCancelation from "./BatchTestReassignmentAndCancellation/BatchTestReassignmentAndCancelation.js";
import TestNotificationConfigMenu from "./testNotificationConfigMenu/TestNotificationConfigMenu.js";
import TestNotificationConfigEdit from "./testNotificationConfigMenu/TestNotificationConfigEdit.js";
import SearchIndexManagement from "./searchIndexManagement/SearchIndexManagement";

function Admin() {
const intl = useIntl();
Expand Down Expand Up @@ -200,6 +202,9 @@ function Admin() {
<SideNavLink href="#NotifyUser" renderIcon={Bullhorn}>
<FormattedMessage id="Notify User" />
</SideNavLink>
<SideNavLink href="#SearchIndexManagement" renderIcon={Search}>
<FormattedMessage id="searchindexmanagement.label" />
</SideNavLink>
<SideNavLink
renderIcon={Catalog}
target="_blank"
Expand Down Expand Up @@ -343,6 +348,9 @@ function Admin() {
<PathRoute path="#PluginFile">
<PluginList />
</PathRoute>
<PathRoute path="#SearchIndexManagement">
<SearchIndexManagement />
</PathRoute>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React, { useState, useContext } from "react";
import { Button, Loading, Grid, Column, Section, Heading } from "@carbon/react";
import { FormattedMessage, useIntl, injectIntl } from "react-intl";
import { getFromOpenElisServer } from "../../utils/Utils";
import PageBreadCrumb from "../../common/PageBreadCrumb";
import { NotificationContext } from "../../layout/Layout";
import {
AlertDialog,
NotificationKinds,
} from "../../common/CustomNotification";

function SearchIndexManagement() {
const [loading, setLoading] = useState(false);
const { notificationVisible, setNotificationVisible, addNotification } =
useContext(NotificationContext);
const intl = useIntl();
const rebuildIndex = async (res) => {
setNotificationVisible(true);
if (res) {
addNotification({
kind: NotificationKinds.success,
title: intl.formatMessage({ id: "notification.title" }),
message: intl.formatMessage({
id: "searchindexmanagement.reindex.success",
}),
});
} else {
addNotification({
kind: NotificationKinds.error,
title: intl.formatMessage({ id: "notification.title" }),
message: intl.formatMessage({
id: "searchindexmanagement.reindex.error",
}),
});
}
setLoading(false);
};
const handleReindexClick = async () => {
setLoading(true);
getFromOpenElisServer("/rest/reindex", rebuildIndex);
};

const breadcrumbs = [
{ label: "home.label", link: "/" },
{
label: "breadcrums.admin.managment",
link: "/MasterListsPage",
},
{
label: "searchindexmanagement.label",
link: "/MasterListsPage#SearchIndexManagement",
},
];

return (
<>
{notificationVisible === true ? <AlertDialog /> : ""}
{loading && <Loading />}
<div className="adminPageContent">
<PageBreadCrumb breadcrumbs={breadcrumbs} />
<Grid fullWidth={true}>
<Column lg={16} md={8} sm={4}>
<Section>
<Heading>
<FormattedMessage id="searchindexmanagement.label" />
</Heading>
</Section>
</Column>
</Grid>
<div className="orderLegendBody">
<Grid>
<Column lg={16} md={8} sm={4}>
<Section>
<Section>
<Heading>
<FormattedMessage id="searchindexmanagement.reindex" />
</Heading>
</Section>
</Section>
<br />
<Section>
<FormattedMessage id="searchindexmanagement.description" />
</Section>
<br />
<Button onClick={handleReindexClick} disabled={loading}>
<FormattedMessage id="searchindexmanagement.reindex" />
</Button>
</Column>
</Grid>
</div>
</div>
</>
);
}

export default injectIntl(SearchIndexManagement);
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function TestNotificationConfigMenu() {

const componentMounted = useRef(false);
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(20);
const [pageSize, setPageSize] = useState(25);
const [loading, setLoading] = useState(true);
const [saveButton, setSaveButton] = useState(true);
const [testNamesList, setTestNamesList] = useState([]);
Expand Down Expand Up @@ -170,7 +170,7 @@ function TestNotificationConfigMenu() {

setTestNotificationConfigMenuDataPost((prevData) => {
const updatedMenuList = prevData.menuList.map((item) => {
if (item.id === rowId) {
if (item.testId === rowId) {
switch (header) {
case "patientEmail":
return {
Expand Down Expand Up @@ -225,9 +225,13 @@ function TestNotificationConfigMenu() {
return (
<TableCell key={cell.id}>
<Checkbox
id={cell.id}
id={`checkbox-${row.id}-${cell.info.header}`}
labelText=""
checked={cell.value === "true"}
checked={
testNotificationConfigMenuDataPost?.menuList.find(
(item) => item.testId === row.id,
)?.[cell.info.header]?.active || false
}
onChange={(e) => {
setSaveButton(false);
handleCheckboxChange(e, row.id, cell.info.header);
Expand Down Expand Up @@ -304,7 +308,7 @@ function TestNotificationConfigMenu() {
testNotificationConfigMenuDataPost?.menuList
?.slice((page - 1) * pageSize, page * pageSize)
?.map((item) => ({
id: item.id,
id: item.testId,
testId: item.testId,
patientEmail: item.patientEmail.active ? "true" : "false",
patientSMS: item.patientSMS.active ? "true" : "false",
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1271,5 +1271,10 @@
"testnotification.testdefault.template": "Default Message for Test",
"testnotification.testdefault.editIcon": "Edit Test Notification",
"testnotification.bcc": "BCC",
"column.name.testId": "Test Id"
"column.name.testId": "Test Id",
"searchindexmanagement.label": "Search Index Management",
"searchindexmanagement.reindex.success": "Reindexing completed successfully",
"searchindexmanagement.reindex.error": "Reindexing failed",
"searchindexmanagement.description": "The search index updates automatically when data is added or modified. If you need to manually update the search index, click the Start Reindexing button. This may take some time.",
"searchindexmanagement.reindex": "Start Reindexing"
}
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ public class MassIndexerRestController {
MassIndexerService massIndexerService;

@GetMapping("/reindex")
public ResponseEntity<String> reindex() {
public ResponseEntity<Boolean> reindex() {
try {
massIndexerService.reindex();
return ResponseEntity.ok("Reindexing completed successfully.");
return ResponseEntity.ok(true);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error occurred during reindexing: " + e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ public List<Analysis> addNewTestsToDBForCalculatedTests(List<ResultSet> resultSe
ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("JavaScript");
String value = null;
try {
Log.debug("Caliculation Rule: " + calculation.getName() + " Function : "
+ function.toString());
value = scriptEngine.eval(function.toString()).toString();
Log.debug("Caliculation Rule: " + calculation.getName() + " Value : " + value);
} catch (ScriptException e) {
Log.error("Invalid Calication Rule: " + calculation.getName(), e);
Log.error("Invalid Caliculation Rule: " + calculation.getName(), e);
}
Analysis analysis = createCalculatedResult(resultCalculation, resultSet, calculation, value,
sysUserId);
Expand Down Expand Up @@ -257,6 +260,9 @@ private Analysis createCalculatedResult(ResultCalculation resultCalculation, Res
result.setMaxNormal(resultLimit.getHighNormal());
result.setMinNormal(resultLimit.getLowNormal());
}
if (testResult.getSignificantDigits() != null) {
result.setSignificantDigits(Integer.valueOf(testResult.getSignificantDigits()));
}
result.setResultType(testService.getResultType(test));
result.setSysUserId(systemUserId);
Boolean resultCalculated = false;
Expand All @@ -276,6 +282,10 @@ private Analysis createCalculatedResult(ResultCalculation resultCalculation, Res
result.setValue("");
}
} else if ("N".equals(resultType)) {
if (testResult.getSignificantDigits() != null) {
double factor = Math.pow(10, Double.valueOf(testResult.getSignificantDigits()));
value = String.valueOf(Math.round(Double.valueOf(value) * factor) / factor);
}
result.setValue(value);
resultCalculated = true;
}
Expand Down Expand Up @@ -360,7 +370,8 @@ private TestResult getTestResultForCalculation(Calculation calculation) {
// we are assuming there is only one testResult for a numeric
// type result
if (!testResultList.isEmpty()) {
return testResultList.get(0);
// get the latest modified test result
return testResultList.get(testResultList.size() - 1);
}
}

Expand Down
Loading

0 comments on commit 89b84bc

Please sign in to comment.