ruby_astm 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mappings.json +4 -2
- data/lib/ruby_astm/result.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4d0af70a0da589dd48c3697a5563b85ba3541a
|
4
|
+
data.tar.gz: 9043a7cae3b574636f58a84278c586c115a07fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4da7e2ac230d2a82e57161f9d73b2dd20f1e90baedda3760523d553097eb2c1baecc499f99efc3cd5e75e9436b3ebd8c0355e162a5a6208594faf79a3884e6
|
7
|
+
data.tar.gz: cf4b50b480717534db5cb752a54d18728d2ece9bf99350dfeb9473d396166d9ad9963641c02b3fb0113a935488b00d6cc95942a8f7a2b69c1bbf87772a735a34
|
data/lib/mappings.json
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
"WBC" :
|
4
4
|
{
|
5
5
|
"LIS_CODE" : "TLCparam",
|
6
|
-
"TUBE" : "EDTA"
|
6
|
+
"TUBE" : "EDTA",
|
7
|
+
"TRANSFORM" : "(self.value.to_f*1000).to_i.to_s"
|
7
8
|
},
|
8
9
|
"RBC" :
|
9
10
|
{
|
@@ -34,7 +35,8 @@
|
|
34
35
|
},
|
35
36
|
"PLT" : {
|
36
37
|
"LIS_CODE" : "PCparam",
|
37
|
-
"TUBE" : "EDTA"
|
38
|
+
"TUBE" : "EDTA",
|
39
|
+
"TRANSFORM" : "(self.value.to_f*1000).to_i.to_s"
|
38
40
|
},
|
39
41
|
"NEUT%": {
|
40
42
|
"LIS_CODE" : "Nparam",
|
data/lib/ruby_astm/result.rb
CHANGED
@@ -11,11 +11,20 @@ class Result
|
|
11
11
|
def initialize(args)
|
12
12
|
if args[:line]
|
13
13
|
line = args[:line]
|
14
|
+
transform_expression = nil
|
14
15
|
line.fields[2].scan(/\^+(?<name>[A-Za-z0-9\%\#\-\_\?\/]+)\^?(?<dilution>\d+)?/) { |name,dilution|
|
15
16
|
self.name = lookup_mapping(name)
|
16
17
|
self.dilution = dilution
|
18
|
+
transform_expression = lookup_transform(name)
|
17
19
|
}
|
18
20
|
self.value = line.fields[3].strip
|
21
|
+
|
22
|
+
if transform_expression
|
23
|
+
#puts "got transform expression, now evalling it."
|
24
|
+
self.value = eval(transform_expression)
|
25
|
+
#puts "Value after eval: #{self.value}"
|
26
|
+
end
|
27
|
+
#eval(transform_expression) unless transform_expression.blank?
|
19
28
|
self.reference_ranges = line.fields[5].strip
|
20
29
|
self.flags = line.fields[6].strip
|
21
30
|
line.fields[12].strip.scan(/(?<year>\d{4})(?<month>\d{2})(?<day>\d{2})(?<hours>\d{2})(?<minutes>\d{2})(?<seconds>\d{2})/) {|year,month,day,hours,minutes,seconds|
|
@@ -31,4 +40,8 @@ class Result
|
|
31
40
|
$mappings[name] ? $mappings[name]["LIS_CODE"] : name
|
32
41
|
end
|
33
42
|
|
43
|
+
def lookup_transform(name)
|
44
|
+
$mappings[name] ? $mappings[name]["TRANSFORM"] : nil
|
45
|
+
end
|
46
|
+
|
34
47
|
end
|