ruby_astm 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mappings.json +9 -0
- data/lib/ruby_astm/astm_server.rb +3 -1
- data/lib/ruby_astm/lab_interface.rb +22 -12
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4f3ba60a24419e04369920eb8f6ee0a465c9962b989bd6e17ae19eef14541d2d
         | 
| 4 | 
            +
              data.tar.gz: 8d27244ac7b92f552733aad743ebb9777eea930f0c0f0b44dc08ba2b4aa7d9de
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 843087dedee93ba8361371dcfbdca936c8f8b3de4085cca8f438330c4d7e903430895abd8f414daee1fef053ac3c6c690119740dfd09b4421799d8e019b541a2
         | 
| 7 | 
            +
              data.tar.gz: 4a24373742aed3f8df00ec5c68c7eb8298bf4b76fa88eacb895cd3a355998d85cbcb995c9e1fbd30b9efaee2031048ee9d2c79ea16f5eabf6c42ff11740f2dcf
         | 
    
        data/lib/mappings.json
    CHANGED
    
    | @@ -1,5 +1,9 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
            	"_comment" : "key -> code sent by analyzer, eg sysmex sends WBC count under the code 'WBC'. value -> object. Object structure: 'LIS_CODE': in the google lab interface, this code is present in two places on google drive. one) in the name of the file, two) inside the file, where the test result value should be added. For eg in the hemogram report, TLCparam, is present in the name of the file, as well as inside the file, so the google script will update it with the relevant value. 'TUBE' stands for the type of tube in which this test has to be performed. This should match the constants in the Google Lab Interface.rb file. Now there is another problem that we have to deal with here. When going bidirectional, in some machines like Roche Cobas e411, the test codes come in as numbers, and not letters, so the keys here in this file are numbers, for those tests. Because Roche is a bitch basically.",
         | 
| 3 | 
            +
            	"A1c" : {
         | 
| 4 | 
            +
                    "LIS_CODE" : "HBA1C",
         | 
| 5 | 
            +
                    "REPORT_NAME" : "Glycosylated Hemoglobin"
         | 
| 6 | 
            +
                },
         | 
| 3 7 | 
             
            	"WBC" : 
         | 
| 4 8 | 
             
            	{
         | 
| 5 9 | 
             
            		"LIS_CODE" : "TLCparam",
         | 
| @@ -176,6 +180,11 @@ | |
| 176 180 | 
             
            		"TUBE" : "SERUM",
         | 
| 177 181 | 
             
            		"REPORT_NAME" : "Total Bilirubin"
         | 
| 178 182 | 
             
            	},
         | 
| 183 | 
            +
            	"INBIL" : {
         | 
| 184 | 
            +
            		"LIS_CODE" : "BII",
         | 
| 185 | 
            +
            		"TUBE" : "SERUM",
         | 
| 186 | 
            +
            		"REPORT_NAME" : "Indirect Bilirubin"
         | 
| 187 | 
            +
            	},
         | 
| 179 188 | 
             
            	"ALPU" : {
         | 
| 180 189 | 
             
            		"LIS_CODE" : "ALPU",
         | 
| 181 190 | 
             
            		"TUBE" : "SERUM",
         | 
| @@ -83,7 +83,7 @@ module LabInterface | |
| 83 83 |  | 
| 84 84 | 
             
            	def receive_data(data)
         | 
| 85 85 |  | 
| 86 | 
            -
                begin
         | 
| 86 | 
            +
                #begin
         | 
| 87 87 |  | 
| 88 88 | 
             
                  self.data_buffer ||= ''
         | 
| 89 89 |  | 
| @@ -158,8 +158,12 @@ module LabInterface | |
| 158 158 | 
             
                    else
         | 
| 159 159 | 
             
                      puts "NO HEADERS PRESENT --- "
         | 
| 160 160 | 
             
                    end
         | 
| 161 | 
            +
                  elsif data.bytes.to_a[0] == 255
         | 
| 162 | 
            +
                    puts  " ----------- got 255 data -----------, not sending anything back. "
         | 
| 161 163 | 
             
                  else
         | 
| 162 | 
            -
                     | 
| 164 | 
            +
                    unless self.data_buffer.blank?
         | 
| 165 | 
            +
                      puts self.data_buffer.gsub(/\r/,'\n').to_s
         | 
| 166 | 
            +
                    end
         | 
| 163 167 | 
             
                    ## send the header 
         | 
| 164 168 | 
             
                    #puts "--------- SENT ACK -----------"
         | 
| 165 169 | 
             
                    if self.data_buffer =~ /MSH\|/
         | 
| @@ -175,11 +179,11 @@ module LabInterface | |
| 175 179 | 
             
                      send_data(ACK)
         | 
| 176 180 | 
             
                    end
         | 
| 177 181 | 
             
                  end
         | 
| 178 | 
            -
                rescue => e
         | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 182 | 
            -
                end
         | 
| 182 | 
            +
                #rescue => e
         | 
| 183 | 
            +
                #  self.headers = []
         | 
| 184 | 
            +
                #  AstmServer.log("data was: " + self.data_buffer + "error is:" + e.backtrace.to_s)
         | 
| 185 | 
            +
                #  send_data(EOT)
         | 
| 186 | 
            +
                #end
         | 
| 183 187 | 
             
              end
         | 
| 184 188 |  | 
| 185 189 | 
             
              def send_enq
         | 
| @@ -202,14 +206,20 @@ module LabInterface | |
| 202 206 | 
             
                    self.headers ||= []
         | 
| 203 207 | 
             
                    self.headers << hl7_header
         | 
| 204 208 | 
             
                  when "Hl7_Observation"
         | 
| 205 | 
            -
                     | 
| 206 | 
            -
             | 
| 209 | 
            +
                    unless self.headers[-1].patients.blank?
         | 
| 210 | 
            +
                      unless self.headers[-1].patients[-1].orders[-1].blank?
         | 
| 211 | 
            +
                        hl7_observation = Hl7Observation.new({:line => line})
         | 
| 212 | 
            +
                        self.headers[-1].patients[-1].orders[-1].results[hl7_observation.name] ||= hl7_observation
         | 
| 213 | 
            +
                      end
         | 
| 214 | 
            +
                    end
         | 
| 207 215 | 
             
                  when "Hl7_Patient"
         | 
| 208 216 | 
             
                    hl7_patient = Hl7Patient.new({:line => line})
         | 
| 209 217 | 
             
                    self.headers[-1].patients << hl7_patient
         | 
| 210 218 | 
             
                  when "Hl7_Order"
         | 
| 211 | 
            -
                     | 
| 212 | 
            -
             | 
| 219 | 
            +
                    unless self.headers[-1].patients.blank?
         | 
| 220 | 
            +
                      hl7_order = Hl7Order.new({:line => line, :patient_id => self.headers[-1].patients[-1].patient_id})
         | 
| 221 | 
            +
                      self.headers[-1].patients[-1].orders << hl7_order
         | 
| 222 | 
            +
                    end
         | 
| 213 223 | 
             
                  when "Header"
         | 
| 214 224 | 
             
                    puts "got header"
         | 
| 215 225 | 
             
                    header = Header.new({:line => line})
         | 
| @@ -228,7 +238,7 @@ module LabInterface | |
| 228 238 | 
             
                    self.headers[-1].patients[-1].orders << order
         | 
| 229 239 | 
             
                  when "Result"
         | 
| 230 240 | 
             
                    result = Result.new({:line => line})
         | 
| 231 | 
            -
                    self.headers[-1].patients[-1].orders[-1].results[result.name]  | 
| 241 | 
            +
                    self.headers[-1].patients[-1].orders[-1].results[result.name] ||= result
         | 
| 232 242 | 
             
                  when "Terminator"
         | 
| 233 243 | 
             
                    ## it didn't terminate so there was no commit being called.
         | 
| 234 244 | 
             
                    puts "got terminator."
         |