Skip to content

stdlib/medicalView source ↗

medical

42 items · generated by scribe fromstdlib/medical.fd· synced 2026-11-15

stdlib/medical42 items

Contents

HL7_ADT_A01:

pub const HL7_ADT_A01: i64 = 1;  // Admit a patient

Defined at line 18


HL7_ADT_A02:

pub const HL7_ADT_A02: i64 = 2;  // Transfer a patient

Defined at line 19


HL7_ADT_A03:

pub const HL7_ADT_A03: i64 = 3;  // Discharge a patient

Defined at line 20


HL7_ADT_A04:

pub const HL7_ADT_A04: i64 = 4;  // Register a patient

Defined at line 21


HL7_ADT_A08:

pub const HL7_ADT_A08: i64 = 8;  // Update patient information

Defined at line 22


HL7_ORU_R01:

pub const HL7_ORU_R01: i64 = 10;  // Observation result

Defined at line 23


HL7_OUL_R22:

pub const HL7_OUL_R22: i64 = 11;  // Unsolicited lab observation

Defined at line 24


HL7_MDM_T02:

pub const HL7_MDM_T02: i64 = 12;  // Medical document notification

Defined at line 25


hl7_msg_type_code

Get HL7 message type code.

pub fn hl7_msg_type_code(msg_type: i64) -> str {

Parameters:

  • msg_type: i64

Returns: str

Defined at line 28


hl7_msg_type_name

Get HL7 message type name.

pub fn hl7_msg_type_name(msg_type: i64) -> str {

Parameters:

  • msg_type: i64

Returns: str

Defined at line 57


HL7Message

An HL7 v2 message (pipe-delimited segments).

pub struct HL7Message {

Fields:

NameType
msg_typei64
msg_idstr
sending_appstr
sending_facilitystr
receiving_appstr
receiving_facilitystr
timestampstr
segmentsVec<str>

Defined at line 88


hl7_new

Create a new HL7 message.

pub fn hl7_new(msg_type: i64, msg_id: str, sending_app: str, sending_facility: str, timestamp: str) -> HL7Message {

Parameters:

  • msg_type: i64
  • msg_id: str
  • sending_app: str
  • sending_facility: str
  • timestamp: str

Returns: HL7Message

Defined at line 101


hl7_set_receiver

Set receiving application and facility.

pub fn hl7_set_receiver(msg: & mut HL7Message, app: str, facility: str) -> void {

Parameters:

  • msg: & mut HL7Message
  • app: str
  • facility: str

Returns: void

Defined at line 108


hl7_add_segment

Add a segment to the message.

pub fn hl7_add_segment(msg: & mut HL7Message, segment: str) -> void {

Parameters:

  • msg: & mut HL7Message
  • segment: str

Returns: void

Defined at line 114


hl7_segment_count

Get segment count.

pub fn hl7_segment_count(msg: HL7Message) -> i64 {

Parameters:

  • msg: HL7Message

Returns: i64

Defined at line 119


hl7_msh_segment

Build MSH (Message Header) segment.

pub fn hl7_msh_segment(msg: HL7Message) -> str {

Parameters:

  • msg: HL7Message

Returns: str

Defined at line 126


hl7_pid_segment

Build PID (Patient Identification) segment.

pub fn hl7_pid_segment(patient_id: str, patient_name: str, dob: str, gender: str) -> str {

Parameters:

  • patient_id: str
  • patient_name: str
  • dob: str
  • gender: str

Returns: str

Defined at line 132


hl7_pv1_segment

Build PV1 (Patient Visit) segment.

pub fn hl7_pv1_segment(patient_class: str, assigned_location: str, attending_doctor: str) -> str {

Parameters:

  • patient_class: str
  • assigned_location: str
  • attending_doctor: str

Returns: str

Defined at line 138


hl7_obx_segment

Build OBX (Observation Result) segment.

pub fn hl7_obx_segment(set_id: i64, value_type: str, observation_id: str, observation_value: str, units: str) -> str {

Parameters:

  • set_id: i64
  • value_type: str
  • observation_id: str
  • observation_value: str
  • units: str

Returns: str

Defined at line 144


hl7_adt_a01

Build an ADT^A01 (Admit Patient) message.

pub fn hl7_adt_a01(sending_facility: str, patient_id: str, patient_name: str, dob: str, gender: str) -> HL7Message {

Parameters:

  • sending_facility: str
  • patient_id: str
  • patient_name: str
  • dob: str
  • gender: str

Returns: HL7Message

Defined at line 152


hl7_adt_a03

Build an ADT^A03 (Discharge Patient) message.

pub fn hl7_adt_a03(sending_facility: str, patient_id: str) -> HL7Message {

Parameters:

  • sending_facility: str
  • patient_id: str

Returns: HL7Message

Defined at line 167


hl7_serialize

Serialize an HL7 message to text (pipe-delimited, newline-separated).

pub fn hl7_serialize(msg: HL7Message) -> str {

Parameters:

  • msg: HL7Message

Returns: str

Defined at line 180


hl7_parse

Parse an HL7 message from text. Returns an HL7Message. Segments are split by CR or LF.

pub fn hl7_parse(text: str) -> HL7Message {

Parameters:

  • text: str

Returns: HL7Message

Defined at line 196


hl7_get_field

Extract a field from a segment (pipe-separated).

pub fn hl7_get_field(segment: str, field_num: i64) -> str {

Parameters:

  • segment: str
  • field_num: i64

Returns: str

Defined at line 230


hl7_segment_type

Get the segment type (first 3 characters).

pub fn hl7_segment_type(segment: str) -> str {

Parameters:

  • segment: str

Returns: str

Defined at line 239


FHIR_PATIENT:

pub const FHIR_PATIENT: i64 = 0; pub const FHIR_OBSERVATION: i64 = 1; pub const FHIR_CONDITION: i64 = 2; pub const FHIR_MEDICATION: i64 = 3; pub const FHIR_ENCOUNTER: i64 = 4; pub const FHIR_PRACTITIONER: i64 = 5;

Defined at line 245


fhir_resource_name

Get FHIR resource type name.

pub fn fhir_resource_name(resource_type: i64) -> str {

Parameters:

  • resource_type: i64

Returns: str

Defined at line 247


icd10_validate

Validate ICD-10 code format (e.g. “E11.9”, “I10”, “J45.909”).

pub fn icd10_validate(code: str) -> bool {

Parameters:

  • code: str

Returns: bool

Defined at line 272


LOINC_GLUCOSE:

pub const LOINC_GLUCOSE: str = "2339-0";  // Glucose

Defined at line 293


LOINC_HEMOGLOBIN_A1C:

pub const LOINC_HEMOGLOBIN_A1C: str = "4548-4";  // HbA1c

Defined at line 294


LOINC_CHOLESTEROL:

pub const LOINC_CHOLESTEROL: str = "2093-3";  // Cholesterol

Defined at line 295


LOINC_CREATININE:

pub const LOINC_CREATININE: str = "2160-0";  // Creatinine

Defined at line 296


LOINC_WBC:

pub const LOINC_WBC: str = "6690-2";  // White Blood Cell

Defined at line 297


LOINC_RBC:

pub const LOINC_RBC: str = "789-8";  // Red Blood Cell

Defined at line 298


LOINC_PLATELETS:

pub const LOINC_PLATELETS: str = "777-3";  // Platelets

Defined at line 299


LOINC_SODIUM:

pub const LOINC_SODIUM: str = "2951-2";  // Sodium

Defined at line 300


LOINC_POTASSIUM:

pub const LOINC_POTASSIUM: str = "2823-3";  // Potassium

Defined at line 301


LOINC_TEMPERATURE:

pub const LOINC_TEMPERATURE: str = "8310-5";  // Body Temperature

Defined at line 302


LOINC_HEART_RATE:

pub const LOINC_HEART_RATE: str = "8867-4";  // Heart Rate

Defined at line 303


LOINC_BP_SYSTOLIC:

pub const LOINC_BP_SYSTOLIC: str = "8480-6";  // BP Systolic

Defined at line 304


LOINC_BP_DIASTOLIC:

pub const LOINC_BP_DIASTOLIC: str = "8462-4";  // BP Diastolic

Defined at line 305


LOINC_SPO2:

pub const LOINC_SPO2: str = "59408-5";  // Oxygen Saturation

Defined at line 306


Generated by scribe, the Fides documentation generator