Exemple #1
0
 public static FM.Quantity Canonical(this FM.Quantity input)
 {
     if (IsUcum(input))
     {
         Quantity quantity = input.ToUnitsOfMeasureQuantity();
         quantity = quantity.Canonical();
         return(quantity.ToFhirModelQuantity());
     }
     else
     {
         return(input);
     }
 }
Exemple #2
0
        public static Expression ToExpression(this Quantity quantity)
        {
            quantity = quantity.Canonical();
            string searchable = quantity.LeftSearchableString();

            var values = new List <ValueExpression>();

            values.Add(new IndexValue("system", new StringValue(UcumUriString)));
            values.Add(new IndexValue("value", new NumberValue(quantity.Value.ToDecimal())));
            values.Add(new IndexValue("decimals", new StringValue(searchable)));
            values.Add(new IndexValue("unit", new StringValue(quantity.Metric.ToString())));

            return(new CompositeValue(values));
        }