Skip to content
Snippets Groups Projects
Commit d1bdb439 authored by ur23's avatar ur23
Browse files

parsing_mesage_types1.0

parent fed72bef
No related branches found
No related tags found
1 merge request!6Parsing MLLP
...@@ -3,7 +3,7 @@ MLLP_START_CHAR = b"\x0b" ...@@ -3,7 +3,7 @@ MLLP_START_CHAR = b"\x0b"
MLLP_END_CHAR = b"\x1c\x0d" MLLP_END_CHAR = b"\x1c\x0d"
# Path to load and store the trained Decision Tree model # Path to load and store the trained Decision Tree model
DT_MODEL_PATH = "model/dt_model.joblib" DT_MODEL_PATH = "dt_model.joblib"
ON_DISK_DB_PATH = "database.db" ON_DISK_DB_PATH = "database.db"
# Map for AKI Label # Map for AKI Label
......
...@@ -34,7 +34,7 @@ def start_server(host="0.0.0.0", port=8440): ...@@ -34,7 +34,7 @@ def start_server(host="0.0.0.0", port=8440):
print(category,mrn,data,'\n') print(category,mrn,data,'\n')
# Create and send ACK message # Create and send ACK message
ack_message = create_acknowledgement(message) ack_message = create_acknowledgement()
sock.sendall(ack_message) sock.sendall(ack_message)
else: else:
print("No valid MLLP message received.") print("No valid MLLP message received.")
......
...@@ -20,7 +20,8 @@ def parse_hl7_message(hl7_data): ...@@ -20,7 +20,8 @@ def parse_hl7_message(hl7_data):
""" """
Parses the HL7 message and returns the parsed message object. Parses the HL7 message and returns the parsed message object.
""" """
message = hl7.parse(hl7_data.decode("utf-8")) hl7_string = hl7_data.decode("utf-8").replace('\r', '\n')
message = hl7.parse(hl7_string)
return message return message
...@@ -88,7 +89,10 @@ def populate_test_results_table(db, path): ...@@ -88,7 +89,10 @@ def populate_test_results_table(db, path):
def parse_system_message(message): def parse_system_message(message):
""" """
Parses the HL7 message and returns the parsed message object. Parses the HL7 message and returns components of respective message type: PAS, LIMS
Args:
- HL7 message object
Returns the category of message, MRN, [AGE, SEX] if PAS category or [DATE_BLOOD_TEST, CREATININE_VALUE] if LIMS
""" """
mrn = 0 mrn = 0
category = '' category = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment