Class: Renalware::Feeds::HL7Message::Observation
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::Feeds::HL7Message::Observation
- Defined in:
- app/models/renalware/feeds/hl7_message.rb
Instance Attribute Summary collapse
-
#cancelled ⇒ Object
readonly
Returns the value of attribute cancelled.
Instance Method Summary collapse
-
#comment ⇒ Object
TODO: Implement comment extraction.
- #identifier ⇒ Object
-
#observation_value ⇒ Object
Some messages may come through with result text like ##TEST CANCELLED## Insufficient specimen received in which case replace with something more concise.
-
#units ⇒ Object
Because some units of measurement, such as 10^12/L for WBC, contain a caret, the caret will initially have been encoded by Mirth as S\ (a Mirth escape sequence for ^ or whatever the mirth component separator character is configured to be) However in the 10^12/L example above, when encoded by Mirth, becomes ā10S12/L` but the `12` within the message is interpreted as a `n` (form feed) by delayed_job when it is read into the yaml format string in the HL7 messages.
Instance Attribute Details
#cancelled ⇒ Object (readonly)
Returns the value of attribute cancelled.
56 57 58 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 56 def cancelled @cancelled end |
Instance Method Details
#comment ⇒ Object
TODO: Implement comment extraction
65 66 67 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 65 def comment @comment || "" end |
#identifier ⇒ Object
60 61 62 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 60 def identifier observation_id.split("^").first end |
#observation_value ⇒ Object
Some messages may come through with result text like
##TEST CANCELLED## Insufficient specimen received
in which case replace with something more concise. We could save the actual message somewhere
73 74 75 76 77 78 79 80 81 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 73 def observation_value if super.upcase.at("CANCELLED") @comment = super @cancelled = true "" else super end end |
#units ⇒ Object
Because some units of measurement, such as 10^12/L for WBC, contain a caret, the caret will initially have been encoded by Mirth as S\ (a Mirth escape sequence for ^ or whatever the mirth component separator character is configured to be) However in the 10^12/L example above, when encoded by Mirth, becomes ā10S12/L` but the `12` within the message is interpreted as a `n` (form feed) by delayed_job when it is read into the yaml format string in the HL7 messages. While it might be possible to write out yaml into delayed_job using a format that will not un-escape on reading, the approach here is that the we have preprocessed the message using a trigger (at the point it is inserted into delayed_jobs) by replacing any instance of S\ with \S\ in the message. Thus the raw data for units in the database will look like `10\S\12/L`. When ever this string is loaded by Ruby it will un-escaped and become āS" No `12` is not found and un-escaped to nā Note in the gsub here we double escape the 's
97 98 99 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 97 def units super&.gsub("\\S\\", "^") end |