Skip to content

Instantly share code, notes, and snippets.

@jacobmischka
Created May 12, 2017 18:45
Show Gist options
  • Save jacobmischka/5e709b6ade956604f5447995b4648349 to your computer and use it in GitHub Desktop.
Save jacobmischka/5e709b6ade956604f5447995b4648349 to your computer and use it in GitHub Desktop.
impl DataSchemaValue for schema::MonitorCodeType {
fn from_value(data: &calamine::DataType) -> Result<schema::MonitorCodeType, MCWAnesthError> {
if let calamine::DataType::String(ref input) = *data {
match &input as &str {
"A Line" => Ok(schema::MonitorCodeType("Arterial Line".to_string())),
"CVP Line" => Ok(schema::MonitorCodeType("Central Venous Line".to_string())),
"PA Line" => Ok(schema::MonitorCodeType("Pulmonary Artery Line".to_string())),
"TEE" => Ok(schema::MonitorCodeType("Transesophageal Echocardiogram".to_string())),
"BIS" => Ok(schema::MonitorCodeType("Bispectral Index".to_string())),
"EEG" => Ok(schema::MonitorCodeType("Electroencephalogram".to_string())),
x => Ok(schema::MonitorCodeType(input.to_string())),
}
} else {
Err(MCWAnesthError::Error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment