Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: view for obs and gyn view #180

Merged
merged 25 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
121847b
feat: added elements for the ob and gyn view
lemoonchild Aug 17, 2024
0682bd5
Merge branch 'develop' into feat-GUI-obgyn-view
lemoonchild Aug 17, 2024
1602ca7
Merge branch 'develop' into feat-GUI-obgyn-view
lemoonchild Aug 19, 2024
10f661d
feat: added name to other diagnosis
lemoonchild Aug 19, 2024
3258741
fix: fixed an error in css
lemoonchild Aug 19, 2024
134ad98
feat: added elements to the view
lemoonchild Aug 19, 2024
51dc3e8
feat: finished the view
lemoonchild Aug 19, 2024
ce7199d
Merge branch 'develop' into feat-GUI-obgyn-view
XavierLopez25 Aug 24, 2024
d3ccafa
feat: added GET and PUT integration to view, pending linting warnings…
XavierLopez25 Aug 26, 2024
982ec79
fix: added linting and formatting
XavierLopez25 Aug 26, 2024
d069c09
feat: added stories for ObGyn view, pending error state to be impleme…
XavierLopez25 Aug 30, 2024
6b6b240
Merge branch 'feat-GUI-obgyn-view' of github.com:SanitasUVG/Sanitas i…
XavierLopez25 Aug 30, 2024
223505d
fix: added empty state handling in view and story
XavierLopez25 Aug 30, 2024
abb2d27
fix: linting and format
XavierLopez25 Aug 30, 2024
f262ee2
feat: added tests for obgyn view
XavierLopez25 Aug 30, 2024
234e4a9
fix: formatting
XavierLopez25 Aug 30, 2024
1ad45d6
Merge branch 'develop' into feat-GUI-obgyn-view
XavierLopez25 Aug 30, 2024
1395bbd
Merge branch 'develop' into feat-GUI-obgyn-view
XavierLopez25 Aug 30, 2024
841279f
feat: adding edit icon and some changes
lemoonchild Aug 30, 2024
d10b457
Merge branch 'feat-GUI-obgyn-view' of github.com:SanitasUVG/Sanitas i…
lemoonchild Aug 30, 2024
b1116fc
fix: fixed error on add other diagnosis button and formatting
XavierLopez25 Aug 31, 2024
7263b24
fix: fixed operations sections dropdown bug
XavierLopez25 Aug 31, 2024
cf8b2da
fix: formatting
XavierLopez25 Aug 31, 2024
5244108
fix: fixed tests to match frontend updates
XavierLopez25 Aug 31, 2024
0f2f8f6
fix: fixing pr
lemoonchild Aug 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async function createPatientWithGynecologicalHistory() {
otherCondition: [
{
medication: {
illness: "illness A",
medication: "Med D",
dosage: "500mg",
frequency: "Once a day",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function generateValidUpdate(patientId) {
otherCondition: [
{
medication: {
illness: "illness A",
medication: "Med D",
dosage: "500mg",
frequency: "Once a day",
Expand Down Expand Up @@ -150,6 +151,7 @@ describe("Update Gynecological Medical History integration tests", () => {
otherCondition: [
{
medication: {
illness: "illness A",
medication: "Med D",
dosage: "500mg",
frequency: "Once a day",
Expand Down
2 changes: 1 addition & 1 deletion sanitas_frontend/src/components/DashboardSidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default function DashboardSidebar({
fontWeight: "normal",
paddingBottom: "1rem",
paddingTop: "1rem",
borderBottom: `0.1rem solid ${colors.darkerGrey}`,
borderBottom: `0.04rem solid ${colors.darkerGrey}`,
}}
>
Antecedentes
Expand Down
2 changes: 1 addition & 1 deletion sanitas_frontend/src/components/DropdownMenu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function DropdownMenu({
indicator: {
position: "absolute",
top: "50%",
right: "5%",
right: "6%",
transform: `translateY(-50%) rotate(${isOpen ? "180deg" : "0deg"})`,
transition: "transform 0.3s",
pointerEvents: "none",
Expand Down
69 changes: 69 additions & 0 deletions sanitas_frontend/src/dataLayer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,75 @@ export const updatePsichiatricHistory = async (
}
};

export const getGynecologicalHistory = async (patientId) => {
const sessionResponse = IS_PRODUCTION
? await getSession()
: await mockGetSession(true);
if (sessionResponse.error) {
return { error: sessionResponse.error };
}

if (!sessionResponse.result.isValid()) {
return { error: "Invalid session!" };
}

const token = sessionResponse?.result?.idToken?.jwtToken ?? "no-token";
const url = `${PROTECTED_URL}/patient/gyneco-history/${patientId}`;

try {
const response = await axios.get(url, {
headers: { Authorization: token },
});
if (response.status === 200) {
return { result: response.data };
}
} catch (error) {
if (error.response) {
return { error: error.response.data };
}
return { error: error.message };
}
};

export const updateGynecologicalHistory = async (
patientId,
gynecologicalHistoryDetails,
) => {
const sessionResponse = IS_PRODUCTION
? await getSession()
: await mockGetSession(true);
if (sessionResponse.error) {
return { error: sessionResponse.error };
}

if (!sessionResponse.result.isValid()) {
return { error: "Invalid session!" };
}

const token = sessionResponse?.result?.idToken?.jwtToken ?? "no-token";
const url = `${PROTECTED_URL}/patient/gyneco-history`;

const payload = {
patientId: patientId,
medicalHistory: gynecologicalHistoryDetails,
};

try {
const response = await axios.put(url, payload, {
headers: { Authorization: token },
});
if (response.status === 200) {
return { result: response.data };
}
return { error: `Unexpected status code: ${response.status}` };
} catch (error) {
if (error.response) {
return { error: error.response.data };
}
return { error: error.message };
}
};

/**
* @callback LinkAccountToPatientCallback
* @param {string} cui
Expand Down
30 changes: 29 additions & 1 deletion sanitas_frontend/src/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
getStudentPatientInformation,
getSurgicalHistory,
getTraumatologicalHistory,
getAllergicHistory,
getGynecologicalHistory,
searchPatient,
submitPatientData,
updateCollaboratorInformation,
Expand All @@ -32,8 +34,8 @@ import {
updateSurgicalHistory,
updateStudentSurgicalHistory,
updateTraumatologicalHistory,
getAllergicHistory,
updateAllergicHistory,
updateGynecologicalHistory,
getPsichiatricHistory,
updatePsichiatricHistory,
getRole,
Expand All @@ -53,6 +55,7 @@ import SearchPatientView from "./views/SearchPatientView";
import UpdateInfoView from "./views/UpdateGeneralInformationView";
import { TraumatologicHistory } from "./views/History/Traumatological";
import { AllergicHistory } from "./views/History/Allergic";
import { ObGynHistory } from "./views/History/ObGyn";
import { PsichiatricHistory } from "./views/History/Psichiatric";
import StudentWelcomeView from "./views/StudentWelcomeView";
import { LinkPatientView } from "./views/LinkPatientView";
Expand Down Expand Up @@ -80,6 +83,7 @@ export const UPDATE_PATIENT_NAV_PATHS = {
PERSONAL_HISTORY: "personal",
NONPATHOLOGICAL_HISTORY: "non-pathological",
ALLERGIC_HISTORY: "allergic",
OBGYN_HISTORY: "obgyn",
PSICHIATRIC_HISTORY: "psichiatric",
// TODO: Add other Navigation routes...
};
Expand Down Expand Up @@ -132,6 +136,11 @@ export const DEFAULT_DASHBOARD_SIDEBAR_PROPS = {
`${NAV_PATHS.UPDATE_PATIENT}/${UPDATE_PATIENT_NAV_PATHS.ALLERGIC_HISTORY}`,
);
},
navigateToObstetrics: (navigate) => {
navigate(
`${NAV_PATHS.UPDATE_PATIENT}/${UPDATE_PATIENT_NAV_PATHS.OBGYN_HISTORY}`,
);
},
navigateToPsiquiatric: (navigate) => {
navigate(
`${NAV_PATHS.UPDATE_PATIENT}/${UPDATE_PATIENT_NAV_PATHS.PSICHIATRIC_HISTORY}`,
Expand Down Expand Up @@ -275,6 +284,21 @@ const psichiatricHistoryView = (
</RequireAuth>
);

const obgynHistoryView = (
<RequireAuth
getSession={IS_PRODUCTION ? getSession : mockGetSession}
path={NAV_PATHS.LOGIN_USER}
>
<ObGynHistory
getBirthdayPatientInfo={getGeneralPatientInformation}
getObGynHistory={getGynecologicalHistory}
updateObGynHistory={updateGynecologicalHistory}
sidebarConfig={DEFAULT_DASHBOARD_SIDEBAR_PROPS}
useStore={useStore}
/>
</RequireAuth>
);

export const ROUTES = [
{
path: NAV_PATHS.SEARCH_PATIENT,
Expand Down Expand Up @@ -374,6 +398,10 @@ export const ROUTES = [
path: UPDATE_PATIENT_NAV_PATHS.ALLERGIC_HISTORY,
element: allergicHistoryView,
},
{
path: UPDATE_PATIENT_NAV_PATHS.OBGYN_HISTORY,
element: obgynHistoryView,
},
{
path: UPDATE_PATIENT_NAV_PATHS.PSICHIATRIC_HISTORY,
element: psichiatricHistoryView,
Expand Down
Loading