Skip to content

Conversation

@Mwanje
Copy link

@Mwanje Mwanje commented Sep 17, 2025

This PR introduces metadata to support the structured documentation and management of patients' procedure history. These include:

  • New "Procedure History" encounter type for structured procedure documentation
  • Complete procedure history form with fields for procedure details, timing, outcomes, and duration
  • Integration with OCL procedure concepts collection (53+ standardized procedures)
  • Support for documenting completed medical procedures with comprehensive metadata
  • Validation rules for data integrity (date validation, required fields)

Read the Procedure history wiki page to learn more.

Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Great start, @Mwanje! I've left some feedback about a few things we could improve.

"rendering": "select",
"isSearchable": true,
"concept": "1651AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"answers": [
Copy link
Member

@denniskigen denniskigen Sep 24, 2025

Choose a reason for hiding this comment

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

Is the plan to eventually include all procedures from the collection as possible answers for this field so we end up with a complete procedure catalog instead of just 4 sample procedures?

Copy link
Author

Choose a reason for hiding this comment

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

@denniskigen the plan is to include all procedures from the collection

Copy link

Choose a reason for hiding this comment

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

Is this going to be done in this PR as well or we can do a follow PR

Copy link
Member

Choose a reason for hiding this comment

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

Is there an easier way we can maintain the set of answers here, e.g., by referring to a concept set or the existing concept answers? Inevitably for a real-world case this list will get long enough that maintaining it in JSON is likely impractical. @samuelmale Interested in your thoughts here.

Copy link
Member

Choose a reason for hiding this comment

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

Is there an easier way we can maintain the set of answers here, e.g., by referring to a concept set or the existing concept answers?

Yes! The form-engine infers a field's answers from the associated concept if the questionOptions.answers is empty. (Note that concept sets aren't supported)

@denniskigen denniskigen changed the title OMRS2025-Hackathon-Procedure-History Add procedure history management system with encounter type and form Sep 24, 2025
@denniskigen denniskigen added omrs25hackathon Tasks from the OMRS 25 hackathon and removed omrs25hackathon Tasks from the OMRS 25 hackathon labels Sep 24, 2025
@Mwanje
Copy link
Author

Mwanje commented Sep 24, 2025

@denniskigen have pushed a commit addressing comments

@denniskigen denniskigen requested a review from ibacher September 24, 2025 18:24
"rendering": "select",
"concept": "1732AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"answers": [
{
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the current duration units:

  1. The ordering of units seems random. Could we order them logically (e.g., minutes, hours, days, weeks, months, years), either ascending or descending?
  2. The validation currently only blocks durations greater than 100 years. Should we consider unit-specific limits (e.g., prevent excessive values in hours or minutes when those units are selected)?
  3. Referring to this sample procedure list (~50 procedures):
    • Which time units are most relevant/commonly used for these procedures?
    • What's the optimal ordering for user experience?
    • Does the current validation logic fit typical use cases?
  4. Are months and years realistic for procedure duration tracking, or should we limit to shorter timeframes?

Copy link
Member

Choose a reason for hiding this comment

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

I also think "Number of occurrences" is a completely separate question from "Duration". I.e., if I apply 3 bandages to a patient, that does need to be documented, but the procedure still took, say, 5 minutes regardless.

@denniskigen
Copy link
Member

Very useful context from @ibacher in the linked PR openmrs/openmrs-esm-patient-chart#2748 (comment).

Comment on lines +174 to +178
{
"type": "js_expression",
"failsWhenExpression": "procedureDurationUnit === '1733AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && Number(procedureDuration) > 1440",
"message": "Duration cannot exceed 1440 minutes.. Change unit or reduce duration."
},
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest we'd want this to be more like 2 days (2880 minutes) rather than 24 hours, unless there's a way to input something like 24 hours + 30 minutes or the like.

Comment on lines +189 to +198
{
"type": "js_expression",
"failsWhenExpression": "procedureDurationUnit === '1073AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && Number(procedureDuration) > 52",
"message": "Duration cannot exceed 52 weeks.. Change unit or reduce duration."
},
{
"type": "js_expression",
"failsWhenExpression": "procedureDurationUnit === '1074AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' && Number(procedureDuration) > 12",
"message": "Duration cannot exceed 12 months.. Change unit or reduce duration."
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we have a good reason for allowing durations in weeks, months or years?

}
]
},
"clearWhenExpression": "Number(procedureDuration) > 99 && (procedureDurationUnit === '1734AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')",
Copy link
Member

Choose a reason for hiding this comment

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

Why are other durations handled as validations, but this is a "clearWhenExpression"? It feels like we should use one tool for limits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

omrs25hackathon Tasks from the OMRS 25 hackathon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants