Documentation
¶
Overview ¶
Package ir contains data structures related to internal representations of entities within Simulated Hospital.
Index ¶
- type Address
- type Allergy
- type AssociatedParty
- type ClinicalNote
- type ClinicalNoteContent
- type CodedElement
- type DiagnosisOrProcedure
- type Doctor
- type Document
- type Encounter
- type Ethnicity
- type Formattable
- type LocationHistory
- type NullTime
- type Order
- type PatientInfo
- func (p *PatientInfo) AddDiagnosesOrProceduresToEncounter(startTime time.Time, diagnoses []*DiagnosisOrProcedure, ...)
- func (p *PatientInfo) AddEncounter(startTime NullTime, status string, loc *PatientLocation) *Encounter
- func (p *PatientInfo) AddOrderToEncounter(o *Order)
- func (p *PatientInfo) LatestEncounter() *Encounter
- type PatientLocation
- type Person
- type PrimaryFacility
- type Result
- type StatusHistory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
FirstLine string
SecondLine string
City string
PostalCode string
Country string
// Type is the type of the address, eg. HOME or WORK.
Type string
}
Address represents a physical address, e.g., a patient's home. Example: 1 Goodwill Hunting Road^^London^^N1C 4AG^GBR^HOME
type Allergy ¶
type Allergy struct {
Type string
Description CodedElement
Severity string
Reaction string
IdentificationDateTime NullTime
}
Allergy represents an allergy.
type AssociatedParty ¶
type AssociatedParty struct {
*Person
Relationship *CodedElement
ContactRole *CodedElement
}
AssociatedParty represents a person associated to another person.
type ClinicalNote ¶
type ClinicalNote struct {
DateTime NullTime
DocumentTitle string
DocumentType string
DocumentID string
Contents []*ClinicalNoteContent
}
ClinicalNote represents a Clinical Note. A clinical note is a document with information about a patient. Even if "document" could be more accurate, we prefer to keep the term that clinicians use.
type ClinicalNoteContent ¶
type ClinicalNoteContent struct {
// ObservationDateTime can be different from the DateTime field in ClinicalNote struct.
// ObservationDateTime is set when the corresponding content is generated whereas ClinicalNote.DateTime is set when the ClinicalNote is generated.
ObservationDateTime NullTime
ContentType string
DocumentEncoding string
DocumentContent string
}
ClinicalNoteContent contains data used to generate an OBX segment in a ClinicalNote HL7 message.
type CodedElement ¶
CodedElement represents a HL7v2 Coded Element: https://hl7-definition.caristix.com/v2/HL7v2.2/DataTypes/CE.
type DiagnosisOrProcedure ¶
type DiagnosisOrProcedure struct {
Description *CodedElement
Type string
Clinician *Doctor
DateTime NullTime
}
DiagnosisOrProcedure represents a clinical diagnosis or procedure.
func (*DiagnosisOrProcedure) Text ¶
func (d *DiagnosisOrProcedure) Text() string
Text returns a human-readable representation of a DiagnosisOrProcedure.
type Doctor ¶
type Doctor struct {
ID string
Surname string
FirstName string
Prefix string
Specialty string // This field is not used in message building.
}
Doctor represents a doctor. Example: 216865551019^Osman^Arthur^^^Dr^^^DRNBR^PRSNL^^^ORGDR.
type Document ¶
type Document struct {
// Fields used in TXA segment.
ActivityDateTime NullTime
EditDateTime NullTime
DocumentType string
DocumentCompletionStatus string
UniqueDocumentNumber string
// Fields used in OBX segments.
// ObservationIdentifier populates the OBX.3 (Observation Identifier) field in each OBX segment.
ObservationIdentifier *CodedElement
// ContentLine contains values to be set in the OBX.5 (Observation Value) field.
// Each line generates a different OBX segment.
ContentLine []string
}
Document represents a generic document. It is used to populate the TXA and OBX segments of an MDM message.
type Encounter ¶
type Encounter struct {
Status string
// StatusStart tracks the start time of the current status.
StatusStart NullTime
// StatusHistory tracks the lifecycle of this Encounter.
// e.g. [planned -> arrived -> finished] or [planned -> in-progress -> cancelled]
StatusHistory []*StatusHistory
IsPending bool
// Start to End encompasses the entire period that this Encounter is active for.
Start NullTime
End NullTime
// LocationHistory tracks where the patient has been during this Encounter.
LocationHistory []*LocationHistory
// Orders tracks the Orders for this Encounter. Each entry in Patient.Orders is associated with
// exactly one Encounter.
Orders []*Order
// Diagnoses and Procedures track the diagnoses and procedures for each Encounter. This is
// different from PatientInfo.Procedures and PatientInfo.Diagnoses, which are used for building
// ADT^A31 messages and are cleared after each UpdatePerson step.
Diagnoses []*DiagnosisOrProcedure
Procedures []*DiagnosisOrProcedure
}
Encounter represents an interaction between a patient and healthcare provider.
func (*Encounter) EndEncounter ¶
EndEncounter finishes the specified Encounter and sets its status and final location end time. Note that this takes an Encounter as a receiver, unlike AddEncounter.
func (*Encounter) UpdateLocation ¶
func (ec *Encounter) UpdateLocation(startTime NullTime, newLocation *PatientLocation)
UpdateLocation sets the end time of the current location and appends a new entry to an Encounter's location history. If the new location is the same as the current one this is a no-op.
func (*Encounter) UpdateStatus ¶
UpdateStatus ends the current status and appends a new entry to an Encounter's status history. If the new status is the same as the current one, or the start time is before the Encounter's start time, this is a no-op.
type Ethnicity ¶
type Ethnicity CodedElement
Ethnicity is a HL7v2 coded element to represent ethnicities.
type Formattable ¶
Formattable is an interface for formatting dates in different locations.
type LocationHistory ¶
type LocationHistory struct {
Location *PatientLocation
Start NullTime
End NullTime
}
LocationHistory represents a patient location along with the period for which the patient was at that location.
type NullTime ¶
NullTime represents a time that can be null.
func NewMidnightTime ¶
NewMidnightTime returns a NullTime from the given time with Midnight and Valid set.
func NewValidTime ¶
NewValidTime returns a NullTime from the given time with Valid set.
type Order ¶
type Order struct {
// OrderProfile is the order profile for the order.
OrderProfile *CodedElement
// Placer is the PlacerOrderNumber to be set in the ORC and OBR segments.
Placer string
// Filler is the FillerOrderNumber to be set in the ORC and OBR segments.
Filler string
// OrderDateTime is the ORC -> Date/Time of Transaction.
OrderDateTime NullTime
// CollectedDateTime is the
// OBR / OBX -> Observation Date Time (the same for all observations for one report).
CollectedDateTime NullTime
// ReceivedInLabDateTime is the OBR -> Specimen Received in Lab.
ReceivedInLabDateTime NullTime
// ReportedDateTime is the OBR -> Results Rpt/Status Change.
ReportedDateTime NullTime
// OrderControl is the ORC -> Order Control
// (https://www.hl7.org/fhir/v2/0119/index.html).
OrderControl string
// MessageControlIDOriginalOrder is the MSH / MSA -> Message Control ID corresponding to the original Order message.
MessageControlIDOriginalOrder string
// OrderStatus is the ORC -> Order Status
// (http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/Default.aspx?version=HL7%20v2.5.1&table=0038)
OrderStatus string
// ResultsStatus is the OBR -> Result Status
// (http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/Default.aspx?version=HL7%20v2.5.1&table=0123)
ResultsStatus string
// Results (observations) relevant to ORU messages. They translate into OBX segments and contain
// clinically relevant information, for instance:
// "OBX|1|NM|lpdc-3384^Urea^WinPath||5.0|MMOLL|2.1 - 7.1||||F|||||".
Results []*Result
// ResultsForORM are the results to be included in ORM messages. They translate into OBX segments, as for Results.
// However these are usually not clinically relevant and contain less information than the results
// in the Results field that contain proper observations.
// For instance, "OBX|3|CD|PERSONUKRES||Yes".
ResultsForORM []*Result
// NotesForORM are the notes for ORM messages. These still generate NTE segments, but such segments are located before
// the OBX segments and refer to the order in general instead of the results as the Notes field in
// the Result struct.
NotesForORM []string
OrderingProvider *Doctor
SpecimenSource string
// DiagnosticServID is the value to be set in the Diagnostic Serv Sect ID (OBR.24) field.
// If the value matches DiagnosticServIDMDOC, the order is for a document/clinical note.
DiagnosticServID string
// NumberOfPreviousResults is used to keep track of how many results were already sent for this order.
// This allows for starting with the correct OBX SetID when sending new results linked to that order.
NumberOfPreviousResults int
}
Order represents a clinical order.
type PatientInfo ¶
type PatientInfo struct {
Person *Person
Class string // EMERGENCY / INPATIENT / OUTPATIENT / PREADMIT / RECURRING PATIENT / OBSTETRICS
Type string // values are defined per-trust if this field is used
VisitID uint64
HospitalService string
AdmitReason string
// Location is the current patient location.
Location *PatientLocation
PriorLocation *PatientLocation
// PriorLocationForCancelTransfer is the patient's PriorLocation after a CancelTransfer message.
// After a transfer message we clear the patient's PriorLocation so that it's not included in
// future messages. However in a CancelTransfer we need to know it so that we can re-instate it.
PriorLocationForCancelTransfer *PatientLocation
PendingLocation *PatientLocation
PriorPendingLocation *PatientLocation
TemporaryLocation *PatientLocation
PriorTemporaryLocation *PatientLocation
AttendingDoctor *Doctor
AccountStatus string
AdmissionDate NullTime
DischargeDate NullTime
TransferDate NullTime
ExpectedAdmitDateTime NullTime
ExpectedDischargeDateTime NullTime
ExpectedTransferDateTime NullTime
AssociatedParties []*AssociatedParty
Allergies []*Allergy
// Diagnoses and Procedures are used in UpdatePerson to build ADT^A31 messages and are cleared
// at the end of the event. Not to be confused with Encounter.Diagnoses and Encounter.Procedures
// which persist diagnoses and procedures in the medical record.
Diagnoses []*DiagnosisOrProcedure
Procedures []*DiagnosisOrProcedure
Encounters []*Encounter
PrimaryFacility *PrimaryFacility
// AdditionalData allows users to enter arbitrary information about a patient's medical record.
// It is up to the user to decide what data is stored here.
AdditionalData interface{}
}
PatientInfo represents a patient and related information.
func (*PatientInfo) AddDiagnosesOrProceduresToEncounter ¶
func (p *PatientInfo) AddDiagnosesOrProceduresToEncounter(startTime time.Time, diagnoses []*DiagnosisOrProcedure, procedures []*DiagnosisOrProcedure)
AddDiagnosesOrProceduresToEncounter either adds the specified DiagnosisOrProcedures to the current on-going Encounter, or creates a new Encounter for *each* DiagnosisOrProcedure, if one does not exist.
func (*PatientInfo) AddEncounter ¶
func (p *PatientInfo) AddEncounter(startTime NullTime, status string, loc *PatientLocation) *Encounter
AddEncounter creates a new Encounter, adds it to the list of Encounters, and sets its status and location.
func (*PatientInfo) AddOrderToEncounter ¶
func (p *PatientInfo) AddOrderToEncounter(o *Order)
AddOrderToEncounter either adds the specified order to the current on-going Encounter, or creates a new Encounter for the Order if one does not exist. In the latter case, the new Encounter will contain only that Order, and we set the start/end time of the Encounter to the order/reported time of the Order.
func (*PatientInfo) LatestEncounter ¶
func (p *PatientInfo) LatestEncounter() *Encounter
LatestEncounter retrieves the latest encounter from PatientInfo.
type PatientLocation ¶
type PatientLocation struct {
Poc string
Room string
Bed string
Facility string
LocationType string
Building string
Floor string
}
PatientLocation represents a patient location within a clinical facility. Example: RAL 12 West^Bay01^Bed10^RAL RF^^BED^RFH^Floor 1.
func (*PatientLocation) Name ¶
func (p *PatientLocation) Name() string
Name returns the name for this location by concatenating non-empty fields.
type Person ¶
type Person struct {
Prefix string
FirstName string
MiddleName string
Surname string
Suffix string
Degree string
Gender string
Ethnicity *Ethnicity
Birth NullTime
DateOfDeath NullTime
Address *Address
PhoneNumber string
MRN string
NHS string
DeathIndicator string
}
Person represents a person.
func (*Person) AlternateText ¶
AlternateText returns a more concise representation of a person.
type PrimaryFacility ¶
type PrimaryFacility struct {
Organization string
// ID is the "XON.3-Id Number" for this primary facility.
// Id Number is numeric (NM) in HL7:
// http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/PD1?version=HL7%20v2.3.1&dataType=XON.
// We make it a string instead because it's more generic.
// Also, if it's not present, it appears in the HL7 message as an empty field as opposed to a 0.
ID string
}
PrimaryFacility represents a patient's primary clinical facility (e.g. a GP practice).
type Result ¶
type Result struct {
TestName *CodedElement
Value string
Unit string
ValueType string
Range string
AbnormalFlag string
ObservationDateTime NullTime
// Status is the OBX -> Observation Result Status
// (http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/Default.aspx?version=HL7%20v2.5.1&table=0085).
Status string
Notes []string
ClinicalNote *ClinicalNote
}
Result represents a clinical result.
type StatusHistory ¶
type StatusHistory struct {
// Status must be a value from the value set EncounterStatus:
// https://www.hl7.org/fhir/codesystem-encounter-status.html
Status string
Start NullTime
End NullTime
}
StatusHistory represents an Encounter's status and its period.