Skip to content

Commit

Permalink
Merge branch 'main' into merethe/7982-mult-providers-db
Browse files Browse the repository at this point in the history
  • Loading branch information
mehansen committed Nov 6, 2024
2 parents 4a95cda + 3cc7495 commit fd73301
Show file tree
Hide file tree
Showing 24 changed files with 253 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:


- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.24.0
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: 'fs'
scan-ref: 'ops/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,21 @@ private ApiUser getCurrentApiUserNoCache() {
return nonOktaUser.orElseGet(() -> getCurrentApiUserFromIdentity(userIdentity));
}

/*
`getCurrentUserInfoForWhoAmI()` can be removed and replaced with `getCurrentUserInfo()` as part of #7602 or whenever we stop migrating users over from Okta
*/
public UserInfo getCurrentUserInfoForWhoAmI() {
ApiUser currentUser = getCurrentApiUser();

Optional<OrganizationRoles> currentOrgRoles = _orgService.getCurrentOrganizationRoles();
boolean isAdmin = _authService.isSiteAdmin();
if (!_featureFlagsConfig.isOktaMigrationEnabled() && !isAdmin) {
setRolesAndFacilities(currentOrgRoles, currentUser);
if (!isAdmin) {
if (currentOrgRoles.isPresent()) {
PartialOktaUser oktaUser = _oktaRepo.findUser(currentUser.getLoginEmail());
return consolidateUser(currentUser, oktaUser);
} else {
log.info("No org roles for User ID: {}", currentUser.getInternalId());
}
}
return new UserInfo(currentUser, currentOrgRoles, isAdmin);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,9 @@ public List<OrganizationRoleClaims> findAllOrganizationRoles() {
List<OrganizationRoleClaims> oktaOrgRoleClaims =
_extractor.convert(currentAuth.getAuthorities());

if (!isSiteAdmin()) {
if (!isSiteAdmin() && _featureFlagsConfig.isOktaMigrationEnabled()) {
String username = currentAuth.getName();
List<OrganizationRoleClaims> dbOrgRoleClaims =
_dbOrgRoleClaimsService.getOrganizationRoleClaims(username);
_dbOrgRoleClaimsService.checkOrgRoleClaimsEquality(
oktaOrgRoleClaims, dbOrgRoleClaims, username);
if (_featureFlagsConfig.isOktaMigrationEnabled()) {
return dbOrgRoleClaims;
}
return _dbOrgRoleClaimsService.getOrganizationRoleClaims(username);
}
return oktaOrgRoleClaims;
}
Expand Down
20 changes: 19 additions & 1 deletion backend/src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5660,6 +5660,24 @@ databaseChangeLog:
rollback:
- sql:
sql: DELETE FROM ${database.defaultSchemaName}.supported_disease WHERE name = 'Hepatitis-C';
- changeSet:
id: update-hepatitis-c-naming-in-supported-disease-table
author: [email protected]
comment: Changes Hepatitis-C to Hepatitis C without a dash
changes:
- tagDatabase:
tag: update-hepatitis-c-naming-in-supported-disease-table
- sql:
sql: |
UPDATE ${database.defaultSchemaName}.supported_disease
SET name = 'Hepatitis C'
WHERE name = 'Hepatitis-C' AND loinc = 'LP14400-3'
rollback:
- sql:
sql: |
UPDATE ${database.defaultSchemaName}.supported_disease
SET name = 'Hepatitis-C'
WHERE name = 'Hepatitis C' AND loinc = 'LP14400-3'
- changeSet:
id: create-facility_providers-table
author: [email protected]
Expand Down Expand Up @@ -5714,4 +5732,4 @@ databaseChangeLog:
tableName: facility
oldColumnName: ordering_provider_id
newColumnName: default_ordering_provider_id
remarks: The default healthcare provider for tests ordered at this facility.
remarks: The default healthcare provider for tests ordered at this facility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { render, screen } from "@testing-library/react";

import "../../../i18n";

import HepatitisCResultGuidance from "./HepatitisCResultGuidance";

describe("HepatitisCResultGuidance", () => {
it("displays guidance for a Hepatitis C result", () => {
const { container } = render(<HepatitisCResultGuidance />);
expect(screen.getByText("For Hepatitis C:")).toBeInTheDocument();
expect(container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { Trans, useTranslation } from "react-i18next";

const HepatitisCResultGuidance = () => {
const { t } = useTranslation();

return (
<>
<p className="text-bold sr-guidance-heading">
{t("testResult.hepatitisCNotes.h1")}
</p>
<p>{t("testResult.hepatitisCNotes.positive.p0")}</p>
<Trans
parent="p"
i18nKey="testResult.hepatitisCNotes.positive.p1"
components={[
<a
href={t("testResult.hepatitisCNotes.positive.treatmentLink")}
target="_blank"
rel="noopener noreferrer"
key="hepatitis-c-treatment-link"
>
hepatitis c treatment link
</a>,
]}
/>
</>
);
};

export default HepatitisCResultGuidance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HepatitisCResultGuidance displays guidance for a Hepatitis C result 1`] = `
<div>
<p
class="text-bold sr-guidance-heading"
>
For Hepatitis C:
</p>
<p>
If you have a positive result, you will need a follow-up test to confirm your results. The organization that provided your test should be able to answer questions and provide referrals for follow-up testing.
</p>
<p>
<a
href="https://www.cdc.gov/hepatitis-c/testing/index.html#cdc_testing_results-testing-results"
rel="noopener noreferrer"
target="_blank"
>
Visit the CDC website to learn more about a positive Hepatitis C result
</a>
(cdc.gov/hepatitis-c/testing/index.html#cdc_testing_results-testing-results).
</p>
</div>
`;
64 changes: 27 additions & 37 deletions frontend/src/app/commonComponents/TestResultsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,41 @@ interface TestResultsListProps {
results: MultiplexResults;
isPatientApp: boolean;
}

const setDiseaseResultTitle = (
diseaseName: MultiplexDisease,
diseaseName: MULTIPLEX_DISEASES,
t: translateFn,
isPxp: boolean
) => {
const translationKey = setDiseaseResultKey(diseaseName, isPxp);
const translationKey = isPxp
? diseaseResultTitlePxpMap[diseaseName]
: diseaseResultReportingAppMap[diseaseName];
if (translationKey) {
return t(translationKey);
}
return "";
};

const setDiseaseResultKey = (diseaseName: MultiplexDisease, isPxp: boolean) => {
switch (diseaseName) {
case MULTIPLEX_DISEASES.COVID_19:
return isPxp
? "constants.diseaseResultTitle.COVID19"
: "constants.disease.COVID19";
case MULTIPLEX_DISEASES.FLU_A:
return isPxp
? "constants.diseaseResultTitle.FLUA"
: "constants.disease.FLUA";
case MULTIPLEX_DISEASES.FLU_B:
return isPxp
? "constants.diseaseResultTitle.FLUB"
: "constants.disease.FLUB";
case MULTIPLEX_DISEASES.FLU_A_AND_B:
return isPxp
? "constants.diseaseResultTitle.FLUAB"
: "constants.disease.FLUAB";
case MULTIPLEX_DISEASES.HIV:
return isPxp
? "constants.diseaseResultTitle.HIV"
: "constants.disease.HIV";
case MULTIPLEX_DISEASES.RSV:
return isPxp
? "constants.diseaseResultTitle.RSV"
: "constants.disease.RSV";
case MULTIPLEX_DISEASES.SYPHILIS:
return isPxp
? "constants.diseaseResultTitle.SYPHILIS"
: "constants.disease.SYPHILIS";
default:
return null;
}
const diseaseResultTitlePxpMap: Record<MULTIPLEX_DISEASES, string> = {
[MULTIPLEX_DISEASES.COVID_19]: "constants.diseaseResultTitle.COVID19",
[MULTIPLEX_DISEASES.FLU_A]: "constants.diseaseResultTitle.FLUA",
[MULTIPLEX_DISEASES.FLU_B]: "constants.diseaseResultTitle.FLUB",
[MULTIPLEX_DISEASES.FLU_A_AND_B]: "constants.diseaseResultTitle.FLUAB",
[MULTIPLEX_DISEASES.HIV]: "constants.diseaseResultTitle.HIV",
[MULTIPLEX_DISEASES.RSV]: "constants.diseaseResultTitle.RSV",
[MULTIPLEX_DISEASES.SYPHILIS]: "constants.diseaseResultTitle.SYPHILIS",
[MULTIPLEX_DISEASES.HEPATITIS_C]: "constants.diseaseResultTitle.HEPATITIS_C",
};

const diseaseResultReportingAppMap: Record<MULTIPLEX_DISEASES, string> = {
[MULTIPLEX_DISEASES.COVID_19]: "constants.disease.COVID19",
[MULTIPLEX_DISEASES.FLU_A]: "constants.disease.FLUA",
[MULTIPLEX_DISEASES.FLU_B]: "constants.disease.FLUB",
[MULTIPLEX_DISEASES.FLU_A_AND_B]: "constants.disease.FLUAB",
[MULTIPLEX_DISEASES.HIV]: "constants.disease.HIV",
[MULTIPLEX_DISEASES.RSV]: "constants.disease.RSV",
[MULTIPLEX_DISEASES.SYPHILIS]: "constants.disease.SYPHILIS",
[MULTIPLEX_DISEASES.HEPATITIS_C]: "constants.disease.HEPATITIS_C",
};

const setResult = (result: string, t: translateFn) => {
Expand All @@ -78,7 +68,7 @@ const setResultSymbol = (result: string, t: translateFn) => {
};

const reportingAppResultListItem = (
diseaseName: MultiplexDisease,
diseaseName: MULTIPLEX_DISEASES,
result: TestResult,
t: translateFn
) => {
Expand All @@ -99,7 +89,7 @@ const reportingAppResultListItem = (
};

const pxpAppResultListItem = (
diseaseName: MultiplexDisease,
diseaseName: MULTIPLEX_DISEASES,
result: TestResult,
t: translateFn
) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const mockSupportedDiseaseTestPerformedHepatitisC = [
supportedDisease: {
internalId: "82748233-1780-4303-b5fe-05c1d3f34ab7",
loinc: "LP14400-3",
name: "Hepatitis-C",
name: "Hepatitis C",
},
testPerformedLoincCode: "80389-6",
equipmentUid: "HepatitisCEquipmentUid123",
Expand Down
Loading

0 comments on commit fd73301

Please sign in to comment.