Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into sainak/cleanup-npmrc
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed May 14, 2024
2 parents 8d56ee4 + 353ebcf commit 02b6449
Show file tree
Hide file tree
Showing 32 changed files with 2,355 additions and 665 deletions.
2 changes: 2 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe("Facility Manage Functions", () => {
facilityManage.clickButtonWithText(facilityHfridUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHfridToastNotificationText,
true,
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
Expand All @@ -98,6 +99,7 @@ describe("Facility Manage Functions", () => {
facilityManage.clickButtonWithText(facilityHfridUpdateButton);
facilityManage.verifySuccessMessageVisibilityAndContent(
facilityHfridToastNotificationText,
true,
);
// verify its reflection
facilityPage.clickManageFacilityDropdown();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Patient", () => {
// });
// commented out the shifting request, as logic need to be re-visited

it("Post doctor notes for an already created patient", () => {
it("Post discussion notes for an already created patient", () => {
patientPage.visitPatient("Dummy Patient 3");
patientConsultationPage.visitDoctorNotesPage();
patientConsultationPage.addDoctorsNotes("Test Doctor Notes");
Expand Down
8 changes: 6 additions & 2 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ class FacilityManage {
cy.get("#hf_id").click().clear().click().type(address);
}

verifySuccessMessageVisibilityAndContent(text) {
cy.get(".pnotify-text").should("be.visible").contains(text);
verifySuccessMessageVisibilityAndContent(text, isRegex = false) {
if (isRegex) {
cy.get(".pnotify-text").should("be.visible").contains(text);
} else {
cy.get(".pnotify-text").should("be.visible").and("contain.text", text);
}
}

verifyMiddlewareAddressValue(expectedValue) {
Expand Down
1,533 changes: 1,093 additions & 440 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@
"echarts-for-react": "^3.0.2",
"eslint-mdx": "^3.1.5",
"events": "^3.3.0",
"glob": "^10.3.14",
"i18next": "^23.11.3",
"hi-profiles": "^1.0.6",
"glob": "^10.3.15",
"i18next": "^23.11.4",
"i18next-browser-languagedetector": "^7.2.1",
"lodash-es": "^4.17.21",
"postcss-loader": "^7.3.3",
Expand Down Expand Up @@ -103,20 +104,20 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-interactions": "^8.0.10",
"@storybook/addon-links": "^8.0.10",
"@storybook/blocks": "^8.0.10",
"@storybook/builder-vite": "^8.0.10",
"@storybook/react-vite": "^8.0.10",
"@storybook/addon-essentials": "^8.1.0",
"@storybook/addon-interactions": "^8.1.0",
"@storybook/addon-links": "^8.1.0",
"@storybook/blocks": "^8.1.0",
"@storybook/builder-vite": "^8.1.0",
"@storybook/react-vite": "^8.1.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13",
"@types/echarts": "^4.9.22",
"@types/google.maps": "^3.55.8",
"@types/lodash-es": "^4.17.12",
"@types/qrcode.react": "^1.0.5",
"@types/react": "18.3.1",
"@types/react": "18.3.2",
"@types/react-copy-to-clipboard": "^5.0.7",
"@types/react-csv": "^1.1.10",
"@types/react-dom": "^18.3.0",
Expand Down Expand Up @@ -155,7 +156,7 @@
"redux-devtools-extension": "^2.13.9",
"rescript": "^10.1.4",
"snyk": "^1.1291.0",
"storybook": "^8.0.10",
"storybook": "^8.1.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"vite": "^5.2.11",
Expand Down
30 changes: 30 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { dateQueryString } from "../Utils/utils";
import { IconName } from "../CAREUI/icons/CareIcon";
import { PhoneNumberValidator } from "../Components/Form/FieldValidators";
import { SchemaType } from "./schemaParser";
import {
ConsentHIType,
ConsentPurpose,
} from "../Components/ABDM/types/consent";

export const RESULTS_PER_PAGE_LIMIT = 14;
export const PAGINATION_LIMIT = 36;
Expand Down Expand Up @@ -697,6 +701,7 @@ export const CONSULTATION_TABS = [
{ text: "PRESSURE_SORE", desc: "Pressure Sore" },
{ text: "NURSING", desc: "Nursing" },
{ text: "DIALYSIS", desc: "Dialysis" },
{ text: "ABDM", desc: "ABDM Records" },
];

export const RHYTHM_CHOICES: Array<OptionsType> = [
Expand Down Expand Up @@ -1097,6 +1102,26 @@ export const ExternalResultImportSchema: SchemaType = {
Result: { prop: "result", type: "string" },
};

// ABDM
export const ABDM_CONSENT_PURPOSE = [
{ value: "CAREMGT", label: "Care Management" },
{ value: "BTG", label: "Break The Glass" },
{ value: "PUBHLTH", label: "Public Health" },
{ value: "HPAYMT", label: "Healthcare Payment" },
{ value: "DSRCH", label: "Disease Specific Healthcare Research" },
{ value: "PATRQT", label: "Self Requested" },
] as { value: ConsentPurpose; label: string }[];

export const ABDM_HI_TYPE = [
{ value: "Prescription", label: "Prescription" },
{ value: "DiagnosticReport", label: "Diagnostic Report" },
{ value: "OPConsultation", label: "Op Consultation" },
{ value: "DischargeSummary", label: "Discharge Summary" },
{ value: "ImmunizationRecord", label: "Immunization Record" },
{ value: "HealthDocumentRecord", label: "Record Artifact" },
{ value: "WellnessRecord", label: "Wellness Record" },
] as { value: ConsentHIType; label: string }[];

export const USER_TYPES_MAP = {
Pharmacist: "Pharmacist",
Volunteer: "Volunteer",
Expand Down Expand Up @@ -1342,3 +1367,8 @@ export const OCCUPATION_TYPES = [
{ id: 6, text: "Others", value: "OTHERS" },
{ id: 32, text: "Not Applicable", value: "NOT_APPLICABLE" },
];

export const PATIENT_NOTES_THREADS = {
Doctors: 10,
Nurses: 20,
} as const;
166 changes: 166 additions & 0 deletions src/Components/ABDM/ABDMFacilityRecords.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import { Link } from "raviger";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
import { formatDateTime } from "../../Utils/utils";
import Loading from "../Common/Loading";
import Page from "../Common/components/Page";

interface IProps {
facilityId: string;
}

const TableHeads = [
"Patient",
"Status",
"Created On",
"Consent Granted On",
// "Requested By",
"Health Information Range",
"Expires On",
"HI Profiles",
];

export default function ABDMFacilityRecords({ facilityId }: IProps) {
const { data: consentsResult, loading } = useQuery(routes.abha.listConsents, {
query: { facility: facilityId, ordering: "-created_date" },
});

if (loading) {
return <Loading />;
}

return (
<Page title="Patient Consent List">
<div className="px-4 sm:px-6 lg:px-8">
<div className="sm:flex sm:items-center"></div>
<div className="mt-8 flow-root">
<div className="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
{/* eslint-disable-next-line tailwindcss/migration-from-tailwind-2 */}
<div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
<table className="min-w-full table-fixed divide-y divide-gray-300">
<thead className="bg-gray-50">
<tr>
{TableHeads.map((head) => (
<th
scope="col"
className="px-3 py-3.5 text-center text-sm font-semibold text-gray-900"
>
{head}
</th>
))}
<th
scope="col"
className="sticky right-0 top-0 py-3.5 pl-3 pr-4 sm:pr-6"
>
<span className="sr-only">View</span>
</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-200 bg-white">
{consentsResult?.results.map((consent) => (
<tr key={consent.id}>
<td className="px-3 py-4 text-center text-sm">
{consent.patient_abha_object?.name}
<p className="text-gray-600">
({consent.patient_abha})
</p>
</td>

<td className="px-3 py-4 text-center text-sm capitalize">
{new Date(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) < new Date()
? "EXPIRED"
: consent.consent_artefacts?.[0]?.status ??
consent.status}
</td>

<td className="px-3 py-4 text-center text-sm">
{formatDateTime(consent.created_date)}
</td>

<td className="px-3 py-4 text-center text-sm">
{consent.consent_artefacts.length
? formatDateTime(
consent.consent_artefacts[0].created_date,
)
: "-"}
</td>

{/* <td className="px-3 py-4 text-center text-sm">
{`${consent.requester?.first_name} ${consent.requester?.last_name}`.trim()}
<p className="text-gray-600">
({consent.requester.username})
</p>
</td> */}

<td className="px-3 py-4 text-center text-sm">
{formatDateTime(
consent.consent_artefacts?.[0]?.from_time ??
consent.from_time,
)}{" "}
<br />
{formatDateTime(
consent.consent_artefacts?.[0]?.to_time ??
consent.to_time,
)}
</td>

<td className="px-3 py-4 text-center text-sm">
{formatDateTime(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
)}
</td>

<td className="px-3 py-4 text-center text-sm">
<div className="flex flex-wrap items-center justify-center">
{(
consent.consent_artefacts?.[0]?.hi_types ??
consent.hi_types
)?.map((hiType) => (
<span className="mb-2 mr-2 rounded-full bg-gray-100 px-2 py-1 text-xs font-medium text-gray-600">
{hiType}
</span>
))}
</div>
</td>

<td className="sticky right-0 whitespace-nowrap bg-white py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
<div className="flex flex-col items-center justify-center gap-2">
{(consent.consent_artefacts?.[0]?.status ??
consent.status) === "GRANTED" &&
new Date(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) > new Date() ? (
<Link
key={consent.id}
href={`/abdm/health-information/${consent.id}`}
className={
"cursor-pointer text-primary-600 hover:text-primary-900"
}
>
View
</Link>
) : (
<p className="cursor-not-allowed text-gray-600 opacity-70 ">
View
</p>
)}
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</Page>
);
}
Loading

0 comments on commit 02b6449

Please sign in to comment.