Created
July 13, 2009 19:46
-
-
Save eedrummer/146388 to your computer and use it in GitHub Desktop.
This file contains 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
# this class will have to parse strings like "Data=B/P^122/82^^^^^^^" to get back a blood pressure of 122 over 82 | |
class VitalSign | |
attr_accessor :kind, :value | |
def initialize(kind, value) | |
@kind, @value = kind, value | |
end | |
def self.create_vital_sign_from_vista_string(vista_string) | |
case vista_string | |
when /Data=B\/P\^(\d+)\/(\d+).*/ | |
VitalSign.new(:blood_pressure, {:systolic => $1, :diastolic => $2}) | |
when /Data=Ht\.\^(\d+)\^(cm|in).*/ | |
VitalSign.new(:height, {:value => $1, :unit => $2}) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment