Skip to content

Conversation

@mohan-13
Copy link
Member

@mohan-13 mohan-13 commented Dec 15, 2025

Summary

Refactored HL7 message generation by extracting monolithic HL7Service into specialized segment mappers, improving maintainability and separation of concerns.

Key Changes

  • Created dedicated mappers: MessageHeaderMapper, PatientIdentificationMapper, ORCMapper, OBRMapper, ZDSMapper
  • Introduced HL7MessageCreator interface to orchestrate mapper usage
  • Extended OpenMRSOrderDetails with creator, patient, and base order information
  • Enhanced StudyInstanceUIDGenerator to include order creation date for better uniqueness
  • Introduced ConceptCodeResolver service for centralized concept code resolution
  • Eliminated separate API calls for patient and provider data - now embedded in OpenMRSOrderDetails

Additional Fields Mapped

  • MSH: Dynamic sending/receiving facilities via LocationResolver (location-aware routing)
  • OBR: Ordering provider now includes structured name (given + family) from order creator
  • OBR: Universal Service Identifier now includes:
    • nameOfCodingSystem (coding system for primary identifier)
    • alternateIdentifier (duplicate identifier for compatibility)
    • alternateText (duplicate text for compatibility)
    • nameOfAlternateCodingSystem (coding system for alternate identifier)
  • ZDS: Study Instance UID generation includes dateCreated for improved uniqueness
  • ORC: Priority properly mapped as "S" (STAT) or "R" (routine) instead of raw urgency value

Fields No Longer Mapped

  • OBR: Reason for study (commentToFulfiller)
  • OBR: Collector's comment (concept display name)
  • OBR: Planned patient transport comment (patient name concatenation)

Architectural Changes

  • Concept code resolution now centralized via ConceptCodeResolver service instead of direct PACS concept source lookup
  • Ordering provider moved from ORC segment to OBR segment (correct HL7 placement)
  • Mapper pattern enables independent testing and easier maintenanc

@mohan-13 mohan-13 merged commit 93b04bf into master Dec 15, 2025
2 checks passed
@mohan-13 mohan-13 deleted the BAH-4336-1 branch December 15, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants