Created
July 11, 2013 15:46
-
-
Save mustmodify/5976649 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = Message::Identifier.new( hl7_file ) | |
def init_patient | |
self.patient = find_patient(i.patient_criteria) | |
some error if( patient.blank? ) | |
end | |
def init_visit | |
self.visit = find_visit( i.visit_criteria( patient )) | |
some_error if ( self.visit.blank? ) | |
end | |
def init_order | |
self.order = find_order( self.visit ) | |
some_error if self.order.blank? | |
end | |
In this case, we find the patient. If patient exists, find visit. If visit exists, find order. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = Message::Identifier.new( hl7_file ) | |
def init_order | |
self.order = find_order( i.all_criteria ) | |
if( self.order.blank? ) | |
patient = find_patient( i.patient_criteria ) | |
some_error if self.patient.blank? | |
if( self.patient ) | |
visit = find_visit( i.visit_criteria ) | |
some_error if self.visit.blank? | |
end | |
if( self.visit ) | |
error "couldn't find an order for visit #{visit.id}" | |
end | |
end | |
end | |
in this case, we do one big query. If we don't find the order, then we retrace our steps in order to figure out where the issue happened. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment