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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45a5db6505182ace88ffe6adb2c1b9595b432613
4
- data.tar.gz: d111d2c14ba61ca507fc4f743e94d0578f4555f5
3
+ metadata.gz: 9e4d0af70a0da589dd48c3697a5563b85ba3541a
4
+ data.tar.gz: 9043a7cae3b574636f58a84278c586c115a07fa7
5
5
  SHA512:
6
- metadata.gz: dfa51b7827945a702895e4c061697fc6b25862b918f2f4fdc098fc8e1a1513930eece5d39ff2c9a79d8c00a7bbc1ab3f28aa2f3df676d8fb071489ba3b3c0a36
7
- data.tar.gz: b64b9600d4ed08846ff172fbe433b24886e2040f3802be08b961b06492d9512c2b29d47802a108ed4a7d1d2b066ebe317b3ba3cfc9120e9784c7bf0850dba8f1
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",
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_astm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut