Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions vim-canvas-demo-app-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vim-canvas-demo-app-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"css-filter-converter": "^1.0.110",
"date-fns": "^3.6.0",
"jwt-decode": "^4.0.0",
"lodash-es": "^4.17.21",
"lucide-react": "^0.436.0",
"react": "^18.3.1",
"react-color": "^2.19.3",
Expand All @@ -47,6 +48,7 @@
"@eslint/js": "^9.9.0",
"@radix-ui/react-icons": "^1.3.0",
"@tailwindcss/typography": "^0.5.15",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.13.8",
"@types/react": "^18.3.3",
"@types/react-color": "^3.0.13",
Expand Down
18 changes: 9 additions & 9 deletions vim-canvas-demo-app-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ function App() {
)}
{orders && <OrdersWrapper orders={orders} themeColor={themeColor} />}
{claim && (
<CollapsibleEntity
entityTitle="Claim"
entityIconUrl={claimSvg}
themeColor={themeColor}
>
<CollapsibleEntityContent>
<ClaimContent claim={claim} />
</CollapsibleEntityContent>
</CollapsibleEntity>
<CollapsibleEntity
entityTitle="Claim"
entityIconUrl={claimSvg}
themeColor={themeColor}
>
<CollapsibleEntityContent>
<ClaimContent claim={claim} />
</CollapsibleEntityContent>
</CollapsibleEntity>
)}
<Dialog open={redirectModalOpen} onOpenChange={onRedirectModalChange}>
<DialogContent className="max-w-[calc(100%-100px)] sm:max-w-[425px]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "./ui/entityContent";
import { ProviderSection } from "./Provider";
import { capitalize } from "@/lib/utils";
import { formatContentDate } from "@/utils/formatContentDate";

export const PatientContent = () => {
const { jsonMode } = useAppConfig();
Expand Down Expand Up @@ -75,7 +76,7 @@ export const PatientContent = () => {
<EntityFieldContent>
<EntityFieldTitle title="Date of birth" />
<EntityFieldReadonlyText
text={patient?.demographics?.dateOfBirth}
text={formatContentDate(patient?.demographics?.dateOfBirth)}
/>
</EntityFieldContent>
<EntityFieldContent>
Expand Down
141 changes: 78 additions & 63 deletions vim-canvas-demo-app-react/src/components/claim/ClaimContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useAppConfig } from "@/hooks/useAppConfig";
import { EHR } from "vim-os-js-browser/types";
import {
EntityFieldContent, EntityFieldReadonlyList,
EntityFieldContent,
EntityFieldReadonlyList,
EntityFieldReadonlyText,
EntityFieldTitle,
EntitySectionContent,
Expand All @@ -10,14 +11,15 @@ import {
import { JSONView } from "../ui/jsonView";
import { Separator } from "../ui/separator";
import { Fragment } from "react";
import {ProviderSection} from "@/components/Provider.tsx";
import { ProviderSection } from "@/components/Provider.tsx";
import { formatContentDate } from "@/utils/formatContentDate";

interface ClaimContentProps {
claim: EHR.Claim;
}

function capitalizeFirstLetter(str: string | undefined): string {
if (!str) return '';
if (!str) return "";
str = str.toLowerCase();
return str.charAt(0).toUpperCase() + str.slice(1);
}
Expand Down Expand Up @@ -48,12 +50,22 @@ export const ClaimContent: React.FC<ClaimContentProps> = ({ claim }) => {
<EntityFieldContent>
<EntityFieldTitle title="Claim date" />
<EntityFieldReadonlyText
text={claim?.basicInformation?.claimDate?.toString() ?? "--"}
text={
formatContentDate(
claim?.basicInformation?.claimDate?.toString()
) ?? "--"
}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Service date" />
<EntityFieldReadonlyText text={claim?.basicInformation?.serviceDate} />
<EntityFieldReadonlyText
text={
formatContentDate(
claim?.basicInformation?.serviceDate?.toString()
) ?? "--"
}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Insurance name" />
Expand All @@ -64,79 +76,82 @@ export const ClaimContent: React.FC<ClaimContentProps> = ({ claim }) => {
<EntityFieldContent>
<EntityFieldTitle title="Place of service code" />
<EntityFieldReadonlyText
text={claim?.basicInformation?.placeOfService?.code}
text={claim?.basicInformation?.placeOfService?.code}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Place of service description" />
<EntityFieldReadonlyText
text={capitalizeFirstLetter(claim?.basicInformation?.placeOfService?.description)}
text={capitalizeFirstLetter(
claim?.basicInformation?.placeOfService?.description
)}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Claim status" />
<EntityFieldReadonlyText
text={claim?.basicInformation?.claimStatus ?? "--"}
text={claim?.basicInformation?.claimStatus ?? "--"}
/>
</EntityFieldContent>
</EntitySectionContent>
<Separator className="mb-1" />
<ProviderSection provider={claim?.renderingProvider} title="Rendering provider" />
<>
<EntitySectionTitle title="Service lines" />
{!claim?.serviceLines || !claim.serviceLines.length ? (
<EntityFieldReadonlyList list={[]} />
) : (
claim.serviceLines.map((serviceLine) => (
<Fragment key={serviceLine?.procedureCode}>
<EntitySectionTitle title="Service line" />
<EntitySectionContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure code" />
<EntityFieldReadonlyText
text={serviceLine?.procedureCode || '--'}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure description" />
<EntityFieldReadonlyText
text={serviceLine?.procedureDescription ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure system" />
<EntityFieldReadonlyText
text={serviceLine?.procedureSystem ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Units" />
<EntityFieldReadonlyText
text={serviceLine?.units ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedures modifiers" />
<EntityFieldReadonlyText
text={serviceLine?.proceduresModifiers?.toString() ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Diagnoses" />
<EntityFieldReadonlyList
list={serviceLine?.diagnoses}
/>
</EntityFieldContent>
</EntitySectionContent>
<Separator className="mb-1" />
</Fragment>
))
)}
</>
<EntityFieldTitle title="Additional diagnoses" />
<EntityFieldReadonlyList
list={claim?.additionalDiagnoses}
<ProviderSection
provider={claim?.renderingProvider}
title="Rendering provider"
/>
<>
<EntitySectionTitle title="Service lines" />
{!claim?.serviceLines || !claim.serviceLines.length ? (
<EntityFieldReadonlyList list={[]} />
) : (
claim.serviceLines.map((serviceLine) => (
<Fragment key={serviceLine?.procedureCode}>
<EntitySectionTitle title="Service line" />
<EntitySectionContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure code" />
<EntityFieldReadonlyText
text={serviceLine?.procedureCode || "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure description" />
<EntityFieldReadonlyText
text={serviceLine?.procedureDescription ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedure system" />
<EntityFieldReadonlyText
text={serviceLine?.procedureSystem ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Units" />
<EntityFieldReadonlyText
text={serviceLine?.units ?? "--"}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Procedures modifiers" />
<EntityFieldReadonlyText
text={
serviceLine?.proceduresModifiers?.toString() ?? "--"
}
/>
</EntityFieldContent>
<EntityFieldContent>
<EntityFieldTitle title="Diagnoses" />
<EntityFieldReadonlyList list={serviceLine?.diagnoses} />
</EntityFieldContent>
</EntitySectionContent>
<Separator className="mb-1" />
</Fragment>
))
)}
</>
<EntityFieldTitle title="Additional diagnoses" />
<EntityFieldReadonlyList list={claim?.additionalDiagnoses} />
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,43 @@ import {
import { MultiSelectField } from "../update-fields/multiSelectField";
import { TextareaField } from "../update-fields/textAreaField";
import { EncounterUpdateField } from "../update-fields/updateFieldWrapper";
import { FormInputs, useNoteFormContext } from "./form";
import { FormInputs, useEncounterFormContext } from "./encounter.form";
import { useController } from "react-hook-form";

export const EncounterAssessment = () => {
const { control } = useNoteFormContext();
interface EncounterAssessmentProps {
selectedDiagnoses: { id: string; label: string }[];
setSelectedDiagnoses: (diagnoses: { id: string; label: string }[]) => void;
}

export const EncounterAssessment = ({
selectedDiagnoses,
setSelectedDiagnoses,
}: EncounterAssessmentProps) => {
const { control } = useEncounterFormContext();
const { encounter } = useVimOSEncounter();
const { assessment } = encounter || {};

const { field: diagnosisField } = useController({
name: "diagnosisCodes",
control,
defaultValue: [],
});

return (
<>
<EntitySectionTitle title="Assessment" />
<EntitySectionContent>
<EntityFieldContent>
<EntityFieldReadonlyList list={assessment?.diagnosisCodes} />
<EncounterUpdateField<{ id: string; label: string }[]>
value={assessment?.diagnosisCodes?.length ? assessment.diagnosisCodes.map((code) => ({
id: code.code,
label: code.description || "",
})) : undefined}
value={
assessment?.diagnosisCodes?.length
? assessment.diagnosisCodes.map((code) => ({
id: code.code,
label: code.description || "",
}))
: undefined
}
canUpdateParam={{
assessment: {
diagnosisCodes: true,
Expand All @@ -37,14 +56,22 @@ export const EncounterAssessment = () => {
diagnosisCodes: values?.map((value) => ({
code: value.id,
description: value.label,
})) as [{ code: string; description: string }, ...Array<{ code: string; description: string }>],
})) as [
{ code: string; description: string },
...Array<{ code: string; description: string }>
],
},
})}
render={({ field }) => (
<MultiSelectField<{ id: string; label: string }[]>
placeholder="Add ICD-10"
includeOptionsFields
formatOption={(option) => `${option.id} - ${option.label}`}
selectedOptions={selectedDiagnoses}
onSelectedChange={(options) => {
setSelectedDiagnoses(options);
diagnosisField.onChange(options);
}}
options={[
{ id: "E11.21", label: "DM with nephropathy" },
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
EntitySectionTitle,
} from "../ui/entityContent";
import { capitalize } from "@/lib/utils";

import { formatContentDate } from "@/utils/formatContentDate";
export const EncounterBasicInformation = () => {
const { encounter } = useVimOSEncounter();

Expand All @@ -18,7 +18,9 @@ export const EncounterBasicInformation = () => {
<EntityFieldContent>
<EntityFieldTitle title="Encounter date" />
<EntityFieldReadonlyText
text={encounter?.basicInformation?.encounterDateOfService}
text={formatContentDate(
encounter?.basicInformation?.encounterDateOfService
)}
/>
</EntityFieldContent>
<EntityFieldContent>
Expand Down
Loading