Expand description
Turn an HL7 v2 imaging order into a DICOM Modality Worklist item.
A modality queries the Modality Worklist SCP with C-FIND before an examination and receives one data set per scheduled procedure step, defined by the Modality Worklist Information Model (DICOM PS3.4 Annex K, Table K.6-1). It carries patient identification, the imaging service request (order numbers, accession), the requested procedure (procedure ID, Study Instance UID) and one or more Scheduled Procedure Steps. The modality copies Patient ID, Accession Number, Study Instance UID, Requested Procedure ID and SPS ID verbatim into every image it produces, which makes this data set the hinge of RIS/PACS linkage.
This crate maps an hl7kit::Message and the hl7kit::order::Order
extracted from it to that data set. The mapping follows IHE Radiology
Technical Framework Volume 2, transaction RAD-4 “Procedure Scheduled”,
with dcm4che’s HL7-to-MWL behaviour noted where it differs. Every choice
that comes from a document says which one in a comment in map;
every choice that does not says so too.
Nothing is invented silently. When the item needs a value the order does
not carry, it is omitted (Type 2 and 3 attributes), refused
(MwlError), or generated and reported as a Warning. The only
generated value is the Study Instance UID, governed by UidPolicy.
use hl7kit::{order::Order, Message};
use mwlkit::{worklist_item, Input, Options};
let text = "MSH|^~\\&|RIS|HOSP|PACS|HOSP|20260905121500||OMI^O23|1|P|2.5.1||||||UNICODE UTF-8\r\
PID|1||4MR1^^^HOSP^MR||Doe^Jane||19700101|F\r\
ORC|NW|ORD-1|FIL-1||SC||||20260905113000\r\
TQ1|1||||||20260905113000\r\
OBR|1|ORD-1|FIL-1|MR-HEAD^MRI head^L\r\
IPC|ACC-1^HOSP|RP-1^HOSP|1.2.3^HOSP|SPS-1^HOSP|MR|||^|MR1AE\r";
let msg = Message::parse(text).unwrap();
let order = Order::extract(&msg);
let item = worklist_item(&Input { message: &msg, order: &order }, &Options::default()).unwrap();
assert_eq!(item.study_uid.value, "1.2.3");
assert!(item.warnings.is_empty());What this crate does not do: MLLP, C-FIND, or any network code. It maps and writes; serving the item to a modality is a different component.
Re-exports§
pub use map::worklist_item;pub use uid::GeneratedFrom;pub use uid::StudyUidOrigin;pub use write::to_bytes;
Modules§
- limits
- VR length limits (DICOM PS3.5 Table 6.2-1), enforced when the item is built so that every warning names its attribute.
- map
- The mapping table, one function per DICOM module of the Modality Worklist Information Model (PS3.4 Table K.6-1).
- pn
- HL7 person names to DICOM PN.
- uid
- Study Instance UID resolution and generation, the one value this crate is allowed to invent.
- write
- Encode a worklist item as a DICOM Part 10 file.
Structs§
- Input
- The order and the message it was extracted from. The item needs more
than the four linkage fields, so the mapping reads the rest from the
message itself through
hl7kitpaths;Orderstays about linkage. - Options
- Decisions that belong to the caller, never to the mapping.
- Study
Uid - The Study Instance UID of the item with its provenance.
- Worklist
Item - A worklist item: the data set, where its Study Instance UID came from, and everything the mapping had to decide on its own.
Enums§
- Length
Policy - What to do with SH, LO and PN values longer than their VR allows.
- MwlError
- A Type 1 attribute that the mapping refuses to invent, or a value that would be wrong if cut.
- UidPolicy
- How a missing Study Instance UID is handled.
- Warning
- A decision the mapping made that a reviewer should see.