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

O3-3791: Dispensing: display instructions from DrugOrder.instructions… #116

Merged
merged 2 commits into from
Aug 15, 2024
Merged
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
3 changes: 3 additions & 0 deletions src/components/medication-event.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ const MedicationEvent: React.FC<{
</p>
)}
{dosageInstruction?.text && <p className={styles.bodyLong01}>{dosageInstruction.text}</p>}
{dosageInstruction?.additionalInstruction?.length > 0 && (
<p className={styles.bodyLong01}>{dosageInstruction?.additionalInstruction[0].text}</p>
)}
</div>
);
};
Expand Down
10 changes: 9 additions & 1 deletion src/medication-dispense/medication-dispense.resource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ export function initiateMedicationDispenseBody(
whenHandedOver: null,
dosageInstruction: [
{
text: medicationRequest.dosageInstruction[0].text,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sort of ugly, I'd imagine there might be a better way to do this, but if it works, that's fine I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely more than sort of ugly, agreed.... I was hoping someone might have a "duh" better way to do it, but I can also take another stab before merging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this simpler.

// see https://openmrs.atlassian.net/browse/O3-3791 for an explanation for the reason for the below
text: [
medicationRequest.dosageInstruction[0].text,
medicationRequest.dosageInstruction[0].additionalInstruction?.length > 0
? medicationRequest.dosageInstruction[0].additionalInstruction[0].text
: null,
]
.filter((str) => str != null)
.join(' '),
timing: medicationRequest.dosageInstruction[0].timing,
asNeededBoolean: false,
route: medicationRequest.dosageInstruction[0].route,
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface Attribute {
}

export interface CodeableConcept {
coding: Coding[];
coding?: Coding[];
text?: string;
}

Expand Down Expand Up @@ -131,6 +131,7 @@ export interface DosageInstruction {
doseAndRate: Array<{
doseQuantity: Quantity;
}>;
additionalInstruction?: Array<CodeableConcept>;
}

export interface Drug {
Expand Down
Loading