From ce33f07342554bb380c0232586c2d28a508fa43e Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Thu, 31 May 2012 13:29:00 -0700 Subject: [PATCH 001/205] Added support for importing a Scoop basic XML document --- Gemfile | 2 +- Gemfile.lock | 120 ++++++++++----------- app/controllers/records_controller.rb | 19 +++- test/functional/records_controller_test.rb | 13 ++- 4 files changed, 87 insertions(+), 67 deletions(-) diff --git a/Gemfile b/Gemfile index 1b86a6c..a9c0678 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/pophealth/patientapi.git', :branch => 'develop' -gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :branch => 'develop' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it0' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :branch => 'develop' #gem 'hqmf2js', path: '../bonnie/hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/pophealth/hqmf-parser.git', :branch => 'develop' diff --git a/Gemfile.lock b/Gemfile.lock index 97e59ea..f15300a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: http://github.com/hquery/hqmf2js.git - revision: a6a7a9ebbd423b5f79490e9b35d91c87d5e0b3b8 + revision: a274d0ec861ac266a14d513113b832abce5bdb96 branch: develop specs: hqmf2js (0.1.0) @@ -17,20 +17,20 @@ GIT hquery-patient-api (0.1.0) GIT - remote: http://github.com/projectcypress/health-data-standards.git - revision: 495b95f89505ac4a7d0383ae186e88f8deacc77a - branch: develop + remote: http://github.com/scoophealth/health-data-standards.git + revision: ef6218469884a9baa41b121590e08fc875f67d2d + branch: feature-scoop-it0 specs: health-data-standards (0.8.1) builder (~> 3.0.0) erubis (~> 2.6) mongoid (~> 2.4.2) - nokogiri (>= 1.4.7) + nokogiri (>= 1.4.4) uuid (~> 2.3.4) GIT remote: https://github.com/pophealth/hqmf-parser.git - revision: f23ab28e58a6a2fbd6f602bc2ad023d722592fef + revision: 19aecfa5a0a4f54ff3b28a3e8c62885695cdc19d branch: develop specs: hqmf-parser (0.0.1) @@ -42,42 +42,42 @@ GIT GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.2) - actionpack (= 3.2.2) - mail (~> 2.4.0) - actionpack (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) + actionmailer (3.2.4) + actionpack (= 3.2.4) + mail (~> 2.4.4) + actionpack (3.2.4) + activemodel (= 3.2.4) + activesupport (= 3.2.4) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.1) rack (~> 1.4.0) - rack-cache (~> 1.1) + rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.2) - activesupport (= 3.2.2) + sprockets (~> 2.1.3) + activemodel (3.2.4) + activesupport (= 3.2.4) builder (~> 3.0.0) - activerecord (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) + activerecord (3.2.4) + activemodel (= 3.2.4) + activesupport (= 3.2.4) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) + activeresource (3.2.4) + activemodel (= 3.2.4) + activesupport (= 3.2.4) + activesupport (3.2.4) i18n (~> 0.6) multi_json (~> 1.0) ansi (1.4.2) arel (3.0.2) awesome_print (1.0.2) - bson (1.6.0) - bson_ext (1.6.0) - bson (= 1.6.0) + bson (1.6.2) + bson_ext (1.6.2) + bson (~> 1.6.2) builder (3.0.0) choice (0.1.6) - coderay (1.0.5) + coderay (1.0.6) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -85,13 +85,13 @@ GEM coffee-script-source execjs coffee-script-source (1.3.3) - configatron (2.9.0) + configatron (2.9.1) yamler (>= 0.1.0) cover_me (1.2.0) configatron hashie - daemons (1.1.4) - delayed_job (3.0.1) + daemons (1.1.8) + delayed_job (3.0.3) activesupport (~> 3.0) delayed_job_mongoid (1.0.8) delayed_job (~> 3.0.0) @@ -100,7 +100,7 @@ GEM execjs (1.4.0) multi_json (~> 1.0) factory_girl (1.3.3) - faraday (0.8.0) + faraday (0.8.1) multipart-post (~> 1.1) google-spreadsheet-ruby (0.1.8) nokogiri (>= 1.4.3.1) @@ -111,11 +111,11 @@ GEM httpauth (0.1) i18n (0.6.0) journey (1.0.3) - jquery-rails (2.0.0) - railties (>= 3.2.0.beta, < 5.0) + jquery-rails (2.0.2) + railties (>= 3.2.0, < 5.0) thor (~> 0.14) - json (1.6.6) - kramdown (0.13.5) + json (1.7.3) + kramdown (0.13.6) libv8 (3.3.10.4) log4r (1.1.10) macaddr (1.6.0) @@ -125,18 +125,18 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) metaclass (0.0.1) - method_source (0.7.0) + method_source (0.7.1) mime-types (1.18) - minitest (2.11.2) - mocha (0.10.4) + minitest (3.0.1) + mocha (0.11.4) metaclass (~> 0.0.1) - mongo (1.6.0) - bson (= 1.6.0) + mongo (1.6.2) + bson (~> 1.6.2) mongoid (2.4.10) activemodel (~> 3.1) mongo (~> 1.3) tzinfo (~> 0.3.22) - multi_json (1.3.5) + multi_json (1.3.6) multipart-post (1.1.5) nokogiri (1.5.2) oauth (0.4.6) @@ -146,9 +146,9 @@ GEM multi_json (~> 1.0) rack (~> 1.4) polyglot (0.3.3) - pry (0.9.8.2) + pry (0.9.9.6) coderay (~> 1.0.5) - method_source (~> 0.7) + method_source (~> 0.7.1) slop (>= 2.4.4, < 3) rack (1.4.1) rack-cache (1.2) @@ -157,21 +157,21 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) - rails (3.2.2) - actionmailer (= 3.2.2) - actionpack (= 3.2.2) - activerecord (= 3.2.2) - activeresource (= 3.2.2) - activesupport (= 3.2.2) + rails (3.2.4) + actionmailer (= 3.2.4) + actionpack (= 3.2.4) + activerecord (= 3.2.4) + activeresource (= 3.2.4) + activesupport (= 3.2.4) bundler (~> 1.0) - railties (= 3.2.2) - railties (3.2.2) - actionpack (= 3.2.2) - activesupport (= 3.2.2) + railties (= 3.2.4) + railties (3.2.4) + actionpack (= 3.2.4) + activesupport (= 3.2.4) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) - thor (~> 0.14.6) + thor (>= 0.14.6, < 2.0) rake (0.9.2.2) rdoc (3.12) json (~> 1.4) @@ -184,8 +184,8 @@ GEM todonotes (>= 0.1.0) ruby-ole (1.2.11.3) rubyzip (0.9.8) - sass (3.1.15) - sass-rails (3.2.4) + sass (3.1.19) + sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) @@ -197,19 +197,19 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) systemu (2.2.0) - therubyracer (0.9.10) + therubyracer (0.10.1) libv8 (~> 3.3.10) - thor (0.14.6) + thor (0.15.2) tilt (1.3.3) todonotes (0.1.0) log4r treetop (1.4.10) polyglot polyglot (>= 0.3.1) - turn (0.9.3) + turn (0.9.5) ansi tzinfo (0.3.33) - uglifier (1.2.3) + uglifier (1.2.4) execjs (>= 0.3.0) multi_json (>= 1.0.2) uuid (2.3.5) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 85054c3..7f556d8 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -3,12 +3,23 @@ def create xml_file = params[:content].read doc = Nokogiri::XML(xml_file) doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') - pi = HealthDataStandards::Import::C32::PatientImporter.instance - patient = pi.parse_c32(doc) - patient.save! + if params[:content_type]== 'c32' + pi = HealthDataStandards::Import::C32::PatientImporter.instance + patient = pi.parse_c32(doc) + patient.save! + render :text => 'Patient imported', :status => 201 - render :text => 'Patient imported', :status => 201 + elsif params[:content_type] == 'scoop_basic' + pi = HealthDataStandards::Import::ScoopBasic::PatientImporter.instance + patient = pi.parse_scoop_basic(doc) + patient.save! + render :text => 'Patient imported', :status => 201 + + else + render :text => 'Patient not imported', :status => 422 + end + end end diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index 983b190..6f7e074 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -6,13 +6,22 @@ class RecordsControllerTest < ActionController::TestCase dump_database end - test "should POST a C32 to create" do + test "should POST a C32 to create" do c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') - post :create, {:content => c32} + post :create, {:content => c32, :content_type => 'c32'} assert_response 201 r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) assert r assert_equal -773020800, r['birthdate'] end + test "should POST a Scoop Basic XML to create" do + c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'Sample-SCOOP-IT0-Document.xml'), 'application/xml') + post :create, {:content => c32, :content_type => 'scoop_basic'} + assert_response 201 + r = Mongoid.master['records'].find_one({:first => 'Henry', :last => 'Levin'}) + assert r + assert_equal -1176163200, r['birthdate'] + end + end From f34b95aea89873e411b5cd95354aa1f2c6667cc1 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 1 Jun 2012 11:38:01 -0700 Subject: [PATCH 002/205] Updated production database config to use heroku with mongohq --- config/mongoid.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index 23b4d0d..531058d 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -8,11 +8,12 @@ test: # set these environment variables on your prod server production: - host: <%= ENV['MONGOID_HOST'] %> - port: <%= ENV['MONGOID_PORT'] %> - username: <%= ENV['MONGOID_USERNAME'] %> - password: <%= ENV['MONGOID_PASSWORD'] %> - database: <%= ENV['MONGOID_DATABASE'] %> + uri: <%= ENV['MONGOHQ_URL'] %> + #host: <%= ENV['MONGOID_HOST'] %> + #port: <%= ENV['MONGOID_PORT'] %> + #username: <%= ENV['MONGOID_USERNAME'] %> + #password: <%= ENV['MONGOID_PASSWORD'] %> + #database: <%= ENV['MONGOID_DATABASE'] %> # slaves: # - host: slave1.local # port: 27018 From 53b9464a883174b17511166f3e1dabc1d4c5f917 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 1 Jun 2012 12:10:55 -0700 Subject: [PATCH 003/205] Added ruby version to gemfile --- Gemfile | 6 ++++++ Gemfile.lock | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Gemfile b/Gemfile index a9c0678..14830bc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,8 @@ source 'http://rubygems.org' #gem 'java-query-gateway', '0.1', :git =>"http://github.com/rdingwell/java-hquery-executor.git", :platforms => :jruby + +ruby '1.9.2' + gem 'rails', '~> 3.2.1' gem 'jruby-openssl', :platforms => :jruby group :assets do @@ -28,6 +31,9 @@ gem 'coderay' gem 'kramdown' gem 'pry' +# Specific to the SCOOP staging environment +gem "heroku" + group :test do # Pretty printed test output diff --git a/Gemfile.lock b/Gemfile.lock index f15300a..0d1fc31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,6 +69,7 @@ GEM activesupport (3.2.4) i18n (~> 0.6) multi_json (~> 1.0) + addressable (2.2.8) ansi (1.4.2) arel (3.0.2) awesome_print (1.0.2) @@ -97,6 +98,7 @@ GEM delayed_job (~> 3.0.0) mongoid (>= 2.0) erubis (2.7.0) + excon (0.14.0) execjs (1.4.0) multi_json (~> 1.0) factory_girl (1.3.3) @@ -107,6 +109,14 @@ GEM oauth (>= 0.3.6) oauth2 (>= 0.5.0) hashie (1.2.0) + heroku (2.26.3) + heroku-api (~> 0.2.1) + launchy (>= 0.3.2) + netrc (~> 0.7.2) + rest-client (~> 1.6.1) + rubyzip + heroku-api (0.2.4) + excon (~> 0.14.0) hike (1.2.1) httpauth (0.1) i18n (0.6.0) @@ -116,6 +126,8 @@ GEM thor (~> 0.14) json (1.7.3) kramdown (0.13.6) + launchy (2.1.0) + addressable (~> 2.2.6) libv8 (3.3.10.4) log4r (1.1.10) macaddr (1.6.0) @@ -138,6 +150,7 @@ GEM tzinfo (~> 0.3.22) multi_json (1.3.6) multipart-post (1.1.5) + netrc (0.7.2) nokogiri (1.5.2) oauth (0.4.6) oauth2 (0.7.1) @@ -175,6 +188,8 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) + rest-client (1.6.7) + mime-types (>= 1.16) roo (1.10.1) choice (>= 0.1.4) google-spreadsheet-ruby (>= 0.1.5) @@ -229,6 +244,7 @@ DEPENDENCIES delayed_job_mongoid (~> 1.0.8) factory_girl (= 1.3.3) health-data-standards! + heroku hqmf-parser! hqmf2js! hquery-patient-api! From 0ef587e7e549bf3c36de1b3c1548061ace9236c9 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 1 Jun 2012 12:20:43 -0700 Subject: [PATCH 004/205] Added thin to gemfile --- Gemfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 14830bc..f4d3dc1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'http://rubygems.org' #gem 'java-query-gateway', '0.1', :git =>"http://github.com/rdingwell/java-hquery-executor.git", :platforms => :jruby -ruby '1.9.2' gem 'rails', '~> 3.2.1' gem 'jruby-openssl', :platforms => :jruby @@ -48,3 +47,7 @@ group :test do end +group :production do + gem 'thin' +end + From 9cea66f72e16b62613558adfe5d2c2addf94074e Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 1 Jun 2012 12:30:03 -0700 Subject: [PATCH 005/205] Adding test fixture --- Gemfile.lock | 6 +++++ test/fixtures/Sample-SCOOP-IT0-Document.xml | 28 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/fixtures/Sample-SCOOP-IT0-Document.xml diff --git a/Gemfile.lock b/Gemfile.lock index 0d1fc31..f03beeb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -98,6 +98,7 @@ GEM delayed_job (~> 3.0.0) mongoid (>= 2.0) erubis (2.7.0) + eventmachine (0.12.10) excon (0.14.0) execjs (1.4.0) multi_json (~> 1.0) @@ -214,6 +215,10 @@ GEM systemu (2.2.0) therubyracer (0.10.1) libv8 (~> 3.3.10) + thin (1.3.1) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) thor (0.15.2) tilt (1.3.3) todonotes (0.1.0) @@ -259,5 +264,6 @@ DEPENDENCIES sass-rails therubyracer therubyrhino + thin turn uglifier diff --git a/test/fixtures/Sample-SCOOP-IT0-Document.xml b/test/fixtures/Sample-SCOOP-IT0-Document.xml new file mode 100644 index 0000000..a9f8664 --- /dev/null +++ b/test/fixtures/Sample-SCOOP-IT0-Document.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + Henry + Levin + the 7th + + + + + + + From 8113f9834bbf45ece6493b380a422d83940eebe6 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 1 Jun 2012 13:00:07 -0700 Subject: [PATCH 006/205] Added Procfile to application to support delayed_job process on heroku --- Procfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..8b3136a --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORT +worker: bundle exec rake jobs:work \ No newline at end of file From 55da8c8140e8f9b5f6297da274c6d900227b58e1 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 22 Jun 2012 13:47:26 -0700 Subject: [PATCH 007/205] Changed record import controller to peek and CDA document content to determine importer type --- Gemfile | 2 +- app/controllers/records_controller.rb | 35 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index f4d3dc1..406fccb 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem 'kramdown' gem 'pry' # Specific to the SCOOP staging environment -gem "heroku" +gem 'heroku' group :test do diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 7f556d8..77d48bc 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -2,22 +2,33 @@ class RecordsController < ApplicationController def create xml_file = params[:content].read doc = Nokogiri::XML(xml_file) - doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') - if params[:content_type]== 'c32' - pi = HealthDataStandards::Import::C32::PatientImporter.instance - patient = pi.parse_c32(doc) - patient.save! - render :text => 'Patient imported', :status => 201 + root_element_name = doc.root.name + + if root_element_name == 'ClinicalDocument' + doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') + + document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root'] - elsif params[:content_type] == 'scoop_basic' - pi = HealthDataStandards::Import::ScoopBasic::PatientImporter.instance - patient = pi.parse_scoop_basic(doc) - patient.save! - render :text => 'Patient imported', :status => 201 + # check the specific flavour of cda + # scoop basic + if document_type == 'scoop_basic' + pi = HealthDataStandards::Import::ScoopBasic::PatientImporter.instance + patient = pi.parse_scoop_basic(doc) + patient.save! + render :text => 'Scoop Basic Patient imported', :status => 201 + + # C32 + else + pi = HealthDataStandards::Import::C32::PatientImporter.instance + patient = pi.parse_c32(doc) + patient.save! + render :text => 'C32 Patient imported', :status => 201 + + end else - render :text => 'Patient not imported', :status => 422 + render :text => 'Unknown XML Format', :status => 400 end end From 7bd1bf7709863780508c01485c4877354aca6f34 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 29 Jun 2012 13:55:17 -0700 Subject: [PATCH 008/205] Added support for mirth-rest-adapter --- app/controllers/records_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 77d48bc..01f2688 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -1,6 +1,8 @@ class RecordsController < ApplicationController def create + xml_file = params[:content].read + doc = Nokogiri::XML(xml_file) root_element_name = doc.root.name From 9425edbd8e182a83be1d6a6771e73c9ed68a835d Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Tue, 3 Jul 2012 12:08:16 -0700 Subject: [PATCH 009/205] Added webservice to delete all records --- app/controllers/records_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 01f2688..917534a 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -35,4 +35,11 @@ def create end + def destory + Patient.delete_all + + render :text => 'All patients were deleted', :status => 200 + + end + end From a89f26add87bc568840b82730b35bd1ba4f93a96 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Tue, 3 Jul 2012 12:23:48 -0700 Subject: [PATCH 010/205] Added route for purging records from db --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index f7eec19..5dd6446 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,7 @@ get 'hdata/root' post 'records/create' + delete 'records/destroy' post 'library_functions', :to => "library_functions#create" root :to => 'queries#index' From d4d741592be192580d2c6942223c24e887417c96 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Tue, 3 Jul 2012 12:33:43 -0700 Subject: [PATCH 011/205] Corrected typo on records controller --- app/controllers/records_controller.rb | 2 +- config/routes.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 917534a..e3e7a79 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -35,7 +35,7 @@ def create end - def destory + def destroy Patient.delete_all render :text => 'All patients were deleted', :status => 200 diff --git a/config/routes.rb b/config/routes.rb index 5dd6446..ae473d0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,6 +19,7 @@ post 'records/create' delete 'records/destroy' + post 'library_functions', :to => "library_functions#create" root :to => 'queries#index' From 405bf72da86199767ee4a7ec8e134a38fd54f74d Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Tue, 3 Jul 2012 12:42:30 -0700 Subject: [PATCH 012/205] Bug fix in record controller --- app/controllers/records_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index e3e7a79..20a44b5 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -36,7 +36,7 @@ def create end def destroy - Patient.delete_all + Record.delete_all render :text => 'All patients were deleted', :status => 200 From 677227bc50450396511b5487193d8ed8c8494a6d Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Thu, 4 Oct 2012 10:29:49 -0700 Subject: [PATCH 013/205] Updated query-gateway to support E2E import type --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ app/controllers/records_controller.rb | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 406fccb..846468f 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/pophealth/patientapi.git', :branch => 'develop' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it0' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it1' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :branch => 'develop' #gem 'hqmf2js', path: '../bonnie/hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/pophealth/hqmf-parser.git', :branch => 'develop' diff --git a/Gemfile.lock b/Gemfile.lock index f03beeb..313df16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,10 +18,10 @@ GIT GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: ef6218469884a9baa41b121590e08fc875f67d2d - branch: feature-scoop-it0 + revision: aae69b7cb30b86f7b1fb55fc84ab8897207cd93d + branch: feature-scoop-it1 specs: - health-data-standards (0.8.1) + health-data-standards (1.0.1) builder (~> 3.0.0) erubis (~> 2.6) mongoid (~> 2.4.2) @@ -131,8 +131,8 @@ GEM addressable (~> 2.2.6) libv8 (3.3.10.4) log4r (1.1.10) - macaddr (1.6.0) - systemu (~> 2.2.0) + macaddr (1.6.1) + systemu (~> 2.5.0) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -212,7 +212,7 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - systemu (2.2.0) + systemu (2.5.2) therubyracer (0.10.1) libv8 (~> 3.3.10) thin (1.3.1) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 20a44b5..af158ad 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -13,12 +13,12 @@ def create document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root'] # check the specific flavour of cda - # scoop basic - if document_type == 'scoop_basic' - pi = HealthDataStandards::Import::ScoopBasic::PatientImporter.instance - patient = pi.parse_scoop_basic(doc) + # E2E + if document_type == 'E2E' + pi = HealthDataStandards::Import::E2E::PatientImporter.instance + patient = pi.parse_e2e(doc) patient.save! - render :text => 'Scoop Basic Patient imported', :status => 201 + render :text => 'Scoop E2E Document imported', :status => 201 # C32 else From 45ea177b74b86236c7575473521255e54d575564 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Thu, 4 Oct 2012 10:50:47 -0700 Subject: [PATCH 014/205] updated peek logic to account for new E2E format --- app/controllers/records_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index af158ad..de050b6 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -10,18 +10,19 @@ def create if root_element_name == 'ClinicalDocument' doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') - document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root'] + ##document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root'] + document_type = doc.at_xpath('/cda:ClinicalDocument/cda:realmCode')['code'] # check the specific flavour of cda # E2E - if document_type == 'E2E' + if document_type == 'CA' pi = HealthDataStandards::Import::E2E::PatientImporter.instance patient = pi.parse_e2e(doc) patient.save! render :text => 'Scoop E2E Document imported', :status => 201 # C32 - else + else pi = HealthDataStandards::Import::C32::PatientImporter.instance patient = pi.parse_c32(doc) patient.save! From 0a095e43952eec314e92178bb7ddd7ffc4024074 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Apr 2013 13:09:41 -0700 Subject: [PATCH 015/205] Removed Gemfile.lock which causes problems --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e773938..243bc1b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/ doc/patient-api coverage.data coverage/ +Gemfile.lock From 486cdacdcf5da06720647bdf71400c9337c1d070 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Apr 2013 13:27:48 -0700 Subject: [PATCH 016/205] Removed Gemfile.lock from repo --- Gemfile.lock | 272 --------------------------------------------------- 1 file changed, 272 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index d03cf3d..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,272 +0,0 @@ -GIT - remote: http://github.com/hquery/hqmf2js.git - revision: cc1936810085fa43542c351e92765677976cfd1f - tag: V0.3 - specs: - hqmf2js (0.1.0) - coffee-script (~> 2.2.0) - nokogiri (~> 1.5.2) - sprockets (~> 2.1.2) - tilt (~> 1.3.3) - -GIT - remote: http://github.com/hquery/patientapi.git - revision: b81d65013444263b0a6c8db1516b339e73bf1e9a - tag: V0.3 - specs: - hquery-patient-api (0.1.0) - -GIT - remote: http://github.com/scoophealth/health-data-standards.git - revision: aae69b7cb30b86f7b1fb55fc84ab8897207cd93d - branch: feature-scoop-it1 - specs: - health-data-standards (1.0.1) - builder (~> 3.0.0) - erubis (~> 2.6) - mongoid (~> 2.4.2) - nokogiri (>= 1.4.4) - uuid (~> 2.3.4) - -GIT - remote: https://github.com/hquery/hqmf-parser.git - revision: 8cbd14029c76c2c27409366528c59d0c34bddcc4 - tag: V0.3 - specs: - hqmf-parser (0.0.1) - google-spreadsheet-ruby (= 0.1.8) - roo (= 1.10.1) - rubyzip - spreadsheet (= 0.6.8) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.2.8) - actionpack (= 3.2.8) - mail (~> 2.4.4) - actionpack (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.0) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.1.3) - activemodel (3.2.8) - activesupport (= 3.2.8) - builder (~> 3.0.0) - activerecord (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - activesupport (3.2.8) - i18n (~> 0.6) - multi_json (~> 1.0) - addressable (2.3.2) - ansi (1.4.3) - arel (3.0.2) - awesome_print (1.1.0) - bson (1.7.0) - bson_ext (1.7.0) - bson (~> 1.7.0) - builder (3.0.3) - choice (0.1.6) - coderay (1.0.7) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.3.3) - configatron (2.9.1) - yamler (>= 0.1.0) - cover_me (1.2.0) - configatron - hashie - daemons (1.1.9) - delayed_job (3.0.3) - activesupport (~> 3.0) - delayed_job_mongoid (1.0.8) - delayed_job (~> 3.0.0) - mongoid (>= 2.0) - erubis (2.7.0) - eventmachine (1.0.0) - excon (0.16.4) - execjs (1.4.0) - multi_json (~> 1.0) - factory_girl (1.3.3) - faraday (0.8.4) - multipart-post (~> 1.1) - google-spreadsheet-ruby (0.1.8) - nokogiri (>= 1.4.3.1) - oauth (>= 0.3.6) - oauth2 (>= 0.5.0) - hashie (1.2.0) - heroku (2.32.8) - heroku-api (~> 0.3.5) - launchy (>= 0.3.2) - netrc (~> 0.7.7) - rest-client (~> 1.6.1) - rubyzip - heroku-api (0.3.5) - excon (~> 0.16.1) - hike (1.2.1) - httpauth (0.2.0) - i18n (0.6.1) - journey (1.0.4) - jquery-rails (2.1.3) - railties (>= 3.1.0, < 5.0) - thor (~> 0.14) - json (1.7.5) - jwt (0.1.5) - multi_json (>= 1.0) - kramdown (0.14.0) - launchy (2.1.2) - addressable (~> 2.3) - libv8 (3.3.10.4) - log4r (1.1.10) - macaddr (1.6.1) - systemu (~> 2.5.0) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - method_source (0.8) - mime-types (1.19) - minitest (4.0.0) - mocha (0.12.6) - metaclass (~> 0.0.1) - mongo (1.3.1) - bson (>= 1.3.1) - mongoid (2.4.12) - activemodel (~> 3.1) - mongo (<= 1.6.2) - tzinfo (~> 0.3.22) - multi_json (1.3.6) - multipart-post (1.1.5) - netrc (0.7.7) - nokogiri (1.5.5) - oauth (0.4.7) - oauth2 (0.8.0) - faraday (~> 0.8) - httpauth (~> 0.1) - jwt (~> 0.1.4) - multi_json (~> 1.0) - rack (~> 1.2) - polyglot (0.3.3) - pry (0.9.10) - coderay (~> 1.0.5) - method_source (~> 0.8) - slop (~> 3.3.1) - rack (1.4.1) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.2) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.8) - actionmailer (= 3.2.8) - actionpack (= 3.2.8) - activerecord (= 3.2.8) - activeresource (= 3.2.8) - activesupport (= 3.2.8) - bundler (~> 1.0) - railties (= 3.2.8) - railties (3.2.8) - actionpack (= 3.2.8) - activesupport (= 3.2.8) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (0.9.2.2) - rdoc (3.12) - json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - roo (1.10.1) - choice (>= 0.1.4) - google-spreadsheet-ruby (>= 0.1.5) - nokogiri (>= 1.5.0) - rubyzip (>= 0.9.4) - spreadsheet (> 0.6.4) - todonotes (>= 0.1.0) - ruby-ole (1.2.11.4) - rubyzip (0.9.9) - sass (3.2.1) - sass-rails (3.2.5) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - slop (3.3.3) - spreadsheet (0.6.8) - ruby-ole (>= 1.0) - sprockets (2.1.3) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - systemu (2.5.2) - therubyracer (0.10.2) - libv8 (~> 3.3.10) - thin (1.5.0) - daemons (>= 1.0.9) - eventmachine (>= 0.12.6) - rack (>= 1.0.0) - thor (0.16.0) - tilt (1.3.3) - todonotes (0.1.0) - log4r - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - turn (0.9.6) - ansi - tzinfo (0.3.33) - uglifier (1.3.0) - execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - uuid (2.3.5) - macaddr (~> 1.0) - yamler (0.1.0) - -PLATFORMS - ruby - -DEPENDENCIES - awesome_print - bson_ext (~> 1.3) - coderay - coffee-rails - cover_me (>= 1.0.0.rc6) - daemons - delayed_job_mongoid (~> 1.0.8) - factory_girl (= 1.3.3) - health-data-standards! - heroku - hqmf-parser! - hqmf2js! - hquery-patient-api! - jquery-rails - jruby-openssl - kramdown - minitest - mocha - mongoid (~> 2.0) - pry - rails (~> 3.2.1) - sass-rails - therubyracer - therubyrhino - thin - turn - uglifier From 7771a5e21539bcee9ba450b86b0fbfbef0cf3896 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Apr 2013 13:38:56 -0700 Subject: [PATCH 017/205] Added installation information for IT2 --- README.scoop-IT2 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README.scoop-IT2 diff --git a/README.scoop-IT2 b/README.scoop-IT2 new file mode 100644 index 0000000..796b7f4 --- /dev/null +++ b/README.scoop-IT2 @@ -0,0 +1,20 @@ +Get the source code for the gateway. Do this with the following: + +cd ~ + +git clone -b feature-scoop-it1 git://github.com/scoophealth/query-gateway.git + +Afterwards, go into the new directory, install, seed, and start the server. + +cd query-gateway + +bundle install + +bundle exec rake db:seed + +mkdir -p tmp/pids + +The following commands starts the server on port 3001. + +bundle exec script/delayed_job start +bundle exec rails server -p 3001 From 55db4281f6ba5ee8a18df15e33d853adfb1c33bf Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Apr 2013 14:07:34 -0700 Subject: [PATCH 018/205] Moving on to IT4 --- README.scoop-IT2 => README.scoop-IT4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename README.scoop-IT2 => README.scoop-IT4 (85%) diff --git a/README.scoop-IT2 b/README.scoop-IT4 similarity index 85% rename from README.scoop-IT2 rename to README.scoop-IT4 index 796b7f4..27e4b18 100644 --- a/README.scoop-IT2 +++ b/README.scoop-IT4 @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b feature-scoop-it1 git://github.com/scoophealth/query-gateway.git +git clone -b feature-scoop-it4 git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. From 48ea6a138359d29d7c30481cec33d871e3d881ce Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Apr 2013 14:08:41 -0700 Subject: [PATCH 019/205] Fixed typo in documentation. --- README.scoop-IT2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.scoop-IT2 b/README.scoop-IT2 index 796b7f4..dd873be 100644 --- a/README.scoop-IT2 +++ b/README.scoop-IT2 @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b feature-scoop-it1 git://github.com/scoophealth/query-gateway.git +git clone -b feature-scoop-it2 git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. From 184a63425814681cb28f4ae92c48bcca714b9716 Mon Sep 17 00:00:00 2001 From: Glen McCallum Date: Fri, 5 Apr 2013 15:06:29 -0700 Subject: [PATCH 020/205] minor update to e2e test files --- Gemfile | 2 +- test/fixtures/JOHN_CLEESE_1_25091940.xml | 3312 ++++++++++++++++++++ test/functional/records_controller_test.rb | 27 +- test/test_helper.rb | 1 + 4 files changed, 3328 insertions(+), 14 deletions(-) create mode 100755 test/fixtures/JOHN_CLEESE_1_25091940.xml diff --git a/Gemfile b/Gemfile index db4c52c..85c2d7f 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it1' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it4' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3' diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml new file mode 100755 index 0000000..9bd523a --- /dev/null +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -0,0 +1,3312 @@ + + + + + + + + PITO EMR-2-EMR Complete Instance Example + + + + + + + + + JOHN + CLEESE + + + + + + + + + + + + + + + + + + + + + + +
+ + + Allergies and Intolerances (Reaction List) [with entries] + Allergies + + + + + + + + + + + + + + + + + + + PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + Immunizations List [with entries] + Immunizations + + + + + + + + + + + + + + + Td + 1234 + + + + + + + + + + + + + + + Left Delt + + + + + + + + + + + + + + + + + + + Pneumovax + + + + + + + + + + + + + + + + + + + + + + + + Flu + + + + + + + + + + + + + + + Right Delt + + + + + +
+
+ + +
+ + + Laboratory Results and Reports [with entries] + Labs + + + + + + + HAEM1/CHEM4/CHEM27 + + + + + + + + + + + + + + + + + + + + WBC + + + 6.9 + + + + + + + + + + + + + + + + + + + + RBC + + + 4.39 + + + + + + + + + + + + + + + + + + + + Hemoglobin + + + 141 + + + + + + + + + + + + + + + + + + + + Hematocrit + + + 0.42 + + + + + + + + + + + + + + + + + + + + MCV + + + 95 + + + + + + + + + + + + + + + + + + + + RDW + + + 12.6 + + + + + + + + + + + + + + + + + + + + Platelet Count + + + 182 + + + + + + + + + + + + + + + + + + + + Neutrophils + + + 3.6 + + + + + + + + + + + + + + + + + + + + Lymphocytes + + + 2.5 + + + + + + + + + + + + + + + + + + + + Monocytes + + + 0.5 + + + + + + + + + + + + + + + + + + + + Eosinophils + + + 0.3 + + + + + + + + + + + + + + + + + + + + Basophils + + + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total Protein + + + 75 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Albumin + + + 39 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total Bilirubin + + + 12 + + + + + + + + + + + + + + + + + + + + Direct Bilirubin + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Alkaline Phosphatase + + + 56 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gamma GT + + + 43 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ALT + + + 85 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AST + + + 51 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LD + + + 191 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fluid Neutrophils + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Lymphocytes + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Monocytes + Macrophages + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Mesothelial Cells + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + + + + + MICRO3 + + + + + + + + + + + + + + + + + + + + Specimen Source + + + Bone Chip +bone Lt metatarsal + + + + + + + + + + + + + + + + + + + + Gram Stain + + + +3 Polymorphs ++4 Gram negative bacilli resembling coliforms ++4 Gram positive cocci in pairs and chains ++2 Gram positive cocci in clusters ++2 Yeast + + + + + + + + + + + + + + + + + + + + Report Status Preliminary + + + +3 Proteus mirabilis +Imipenem : Further report to follow ++3 Escherichia coli ++3 Klebsiella oxytoca + + + + + + + + + + + + + + + + + + + + Culture + + + Proteus mirabilis + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + R + + + + + + + + + + + + + + + + + + + + Cefazolin + + + R + + + + + + + + + + + + + + + + + + + + Cefuroxime Parenteral + + + R + + + + + + + + + + + + + + + + + + + + Cefixime + + + R + + + + + + + + + + + + + + + + + + + + Cefotaxime + + + R + + + + + + + + + + + + + + + + + + + + Ceftriaxone + + + R + + + + + + + + + + + + + + + + + + + + Cefpodoxime + + + R + + + + + + + + + + + + + + + + + + + + Ceftazidime + + + R + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + S + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + + + + Tetracycline + + + R + + + + + + + + + + + + + + + + + + + + Culture + + + Escherichia coli + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + S + + + + + + + + + + + + + + + + + + + + Cefazolin + + + S + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + R + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + + + + Culture + + + Klebsiella oxytoca + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + S + + + + + + + + + + + + + + + + + + + + Cefazolin + + + S + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + S + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + Medications and Prescriptions - Medication List [with entries] + + + + + + + + + + + + + + TYLENOL EXTRA STRENGTH TAB 500MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE 25MG TABLET + + +
+ + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + IBUPROFEN TAB 400MG + + +
+ + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + ATIVAN 1MG + + +
+ + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + ASA 81 MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE 20MG + + +
+ + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + AVA-RAMIPRIL 5MG + + +
+ + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + CARVEDILOL 12.5MG + + +
+ + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN 40MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + PRN Indicator: false + + + + + + + +
+
+ + +
+ + + Problems and Conditions - Problem List [with entries] + Text text text + + + + + + + + + + + + HEART FAILURE* + + + + + + + + + + + + + + + + + + + ESSENTIAL HYPERTENSION* + + + + + + + + + + + + + + + + + + + DIABETES MELLITUS* + + + + + + + + + + + + + + + + + + + CHRONIC BRONCHITIS* + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index 6f7e074..f586dc4 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -6,22 +6,23 @@ class RecordsControllerTest < ActionController::TestCase dump_database end - test "should POST a C32 to create" do - c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') - post :create, {:content => c32, :content_type => 'c32'} - assert_response 201 - r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) - assert r - assert_equal -773020800, r['birthdate'] - end + #test "should POST a C32 to create" do + # c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') + # post :create, {:content => c32} + # assert_response 201 + # r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) + + # assert r + # assert_equal -773020800, r['birthdate'] + #end - test "should POST a Scoop Basic XML to create" do - c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'Sample-SCOOP-IT0-Document.xml'), 'application/xml') - post :create, {:content => c32, :content_type => 'scoop_basic'} + test "should POST a E2E to create" do + c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'JOHN_CLEESE_1_25091940.xml'), 'application/xml') + post :create, {:content => c32} assert_response 201 - r = Mongoid.master['records'].find_one({:first => 'Henry', :last => 'Levin'}) + r = Mongoid.master['records'].find_one({:first => 'JOHN', :last => 'CLEESE'}) assert r - assert_equal -1176163200, r['birthdate'] + assert_equal -923616000, r['birthdate'] end end diff --git a/test/test_helper.rb b/test/test_helper.rb index c395124..be3475a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,6 +35,7 @@ def dump_database db.collection('results').remove({}) if db['results'] db.collection('queries').remove({}) if db['queries'] db.collection('pmn_requests').remove({}) if db['pmn_requests'] + db.collection('records').remove({}) if db['records'] end def dump_jobs From d8e0d55949454319a2d069199363c4937cce1d02 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Wed, 10 Apr 2013 13:55:32 -0700 Subject: [PATCH 021/205] Reenabled the c32 tests --- test/functional/records_controller_test.rb | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index f586dc4..70b92bd 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -6,20 +6,19 @@ class RecordsControllerTest < ActionController::TestCase dump_database end - #test "should POST a C32 to create" do - # c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') - # post :create, {:content => c32} - # assert_response 201 - # r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) - - # assert r - # assert_equal -773020800, r['birthdate'] - #end - - test "should POST a E2E to create" do - c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'JOHN_CLEESE_1_25091940.xml'), 'application/xml') + test "should POST a C32 to create" do + c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') post :create, {:content => c32} assert_response 201 + r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) + assert r + assert_equal -773020800, r['birthdate'] + end + + test "should POST a E2E to create" do + e2e = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'JOHN_CLEESE_1_25091940.xml'), 'application/xml') + post :create, {:content => e2e} + assert_response 201 r = Mongoid.master['records'].find_one({:first => 'JOHN', :last => 'CLEESE'}) assert r assert_equal -923616000, r['birthdate'] From 845d19b22dc838eae238684ebe87f7924b627d9e Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Sun, 14 Apr 2013 14:49:13 -0700 Subject: [PATCH 022/205] Added .idea to ignored files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 243bc1b..dbc7774 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ doc/patient-api coverage.data coverage/ Gemfile.lock +.idea From 09292f9086026ac1b352c1083b89cdc22b88bed2 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 30 May 2013 10:12:21 -0700 Subject: [PATCH 023/205] Modified so we pull from a generic scoop-develop branch --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 85c2d7f..1382619 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it4' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3' From 5f175a8a5498fe3ad1bcfef1efffbdc61fbe65a9 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 30 May 2013 10:15:49 -0700 Subject: [PATCH 024/205] Renamed README for new branch --- README.scoop-IT4 => README.scoop-develop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename README.scoop-IT4 => README.scoop-develop (81%) diff --git a/README.scoop-IT4 b/README.scoop-develop similarity index 81% rename from README.scoop-IT4 rename to README.scoop-develop index 27e4b18..63ffb01 100644 --- a/README.scoop-IT4 +++ b/README.scoop-develop @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b feature-scoop-it4 git://github.com/scoophealth/query-gateway.git +git clone -b scoop-develop git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. From 1f356adbf1a4f7aef2df28367d70676b086b487b Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 19 Jun 2013 12:28:57 -0700 Subject: [PATCH 025/205] Redirect hqmf-parser and patientapi to scoophealth fork Signed-off-by: Jeremy Ho --- Gemfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 1382619..7ba39c5 100644 --- a/Gemfile +++ b/Gemfile @@ -13,16 +13,16 @@ end gem 'daemons' gem 'jquery-rails' -gem "mongoid", "~> 2.0" -gem "bson_ext", "~> 1.3", :platforms => :mri +gem 'mongoid', '~> 2.0' +gem 'bson_ext', '~> 1.3', :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' -gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' -gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' +gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'V0.3' +gem 'health-data-standards', :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' +gem 'hqmf2js', :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' -gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3' +gem 'hqmf-parser', :git => 'https://github.com/scoophealth/hqmf-parser.git', :tag => 'V0.3' gem 'coderay' @@ -30,7 +30,7 @@ gem 'kramdown' gem 'pry' # Specific to the SCOOP staging environment -gem 'heroku' +#gem 'heroku' group :test do From 3b8cdbf2894cbb53306056e0ad3022e0da793987 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 20 Jun 2013 16:30:21 -0700 Subject: [PATCH 026/205] Tests now somewhat work Signed-off-by: Jeremy Ho --- Gemfile | 8 ++-- test/factories/factory.rb | 90 ++++++++++++++++++++++----------------- test/test_helper.rb | 6 +-- 3 files changed, 58 insertions(+), 46 deletions(-) diff --git a/Gemfile b/Gemfile index 7ba39c5..fa12eb0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' #gem 'java-query-gateway', '0.1', :git =>"http://github.com/rdingwell/java-hquery-executor.git", :platforms => :jruby @@ -22,7 +22,7 @@ gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git' gem 'health-data-standards', :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' gem 'hqmf2js', :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' -gem 'hqmf-parser', :git => 'https://github.com/scoophealth/hqmf-parser.git', :tag => 'V0.3' +gem 'hqmf-parser', :git => 'https://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' gem 'coderay' @@ -35,10 +35,10 @@ gem 'pry' group :test do # Pretty printed test output - gem 'minitest' + gem 'minitest', '< 5.0.0' gem 'turn', :require => false gem 'cover_me', '>= 1.0.0.rc6', :platforms => :ruby - gem 'factory_girl', '1.3.3' + gem 'factory_girl' gem 'awesome_print', :require => 'ap' gem 'mocha', :require => false gem 'therubyracer', :platforms => :ruby diff --git a/test/factories/factory.rb b/test/factories/factory.rb index a85b733..0e6ee38 100644 --- a/test/factories/factory.rb +++ b/test/factories/factory.rb @@ -4,57 +4,69 @@ # = jobs = # ========== -Factory.define :queued_job, :class => Query do |q| - q.format 'js' - q.map 'foo' - q.reduce 'foo' - q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued')] - q.status :queued +FactoryGirl.define do + factory :queued_job, :class => Query do |q| + q.format 'js' + q.map 'foo' + q.reduce 'foo' + q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued')] + q.status :queued + end end -Factory.define :running_job, :class => Query do |q| - q.format 'js' - q.map 'foo' - q.reduce 'foo' - q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), - JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running')] - q.status :running +FactoryGirl.define do + factory :running_job, :class => Query do |q| + q.format 'js' + q.map 'foo' + q.reduce 'foo' + q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), + JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running')] + q.status :running + end end -Factory.define :successful_job, :class => Query do |q| - q.format 'js' - q.map 'foo' - q.reduce 'foo' - q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), - JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), - JobLog.new(:created_at => 30.seconds.ago.time, :message => 'Job successful')] - q.status :complete +FactoryGirl.define do + factory :successful_job, :class => Query do |q| + q.format 'js' + q.map 'foo' + q.reduce 'foo' + q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), + JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), + JobLog.new(:created_at => 30.seconds.ago.time, :message => 'Job successful')] + q.status :complete + end end -Factory.define :rescheduled_job,:class => Query do |q| - q.format 'js' - q.map 'foo' - q.reduce 'foo' - q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), - JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), - JobLog.new(:created_at => 15.seconds.ago.time, :message => 'Job rescheduled')] - q.status :rescheduled +FactoryGirl.define do + factory :rescheduled_job,:class => Query do |q| + q.format 'js' + q.map 'foo' + q.reduce 'foo' + q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), + JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), + JobLog.new(:created_at => 15.seconds.ago.time, :message => 'Job rescheduled')] + q.status :rescheduled + end end -Factory.define :failed_job, :class => Query do |q| - q.format 'js' - q.map 'foo' - q.reduce 'foo' - q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), - JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), - JobLog.new(:created_at => 10.seconds.ago.time, :message => 'Job failed')] - q.status :failed +FactoryGirl.define do + factory :failed_job, :class => Query do |q| + q.format 'js' + q.map 'foo' + q.reduce 'foo' + q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'), + JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'), + JobLog.new(:created_at => 10.seconds.ago.time, :message => 'Job failed')] + q.status :failed + end end # =========== # = Results = # =========== -Factory.define :gender_result, :class => Result do |r| - r.created_at Time.now +FactoryGirl.define do + factory :gender_result, :class => Result do |r| + r.created_at Time.now + end end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index be3475a..2395869 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,11 +1,11 @@ -#require 'cover_me' +require 'cover_me' ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'factory_girl' -require 'mocha' +require 'mocha/setup' -Factory.find_definitions +FactoryGirl.find_definitions class ActiveSupport::TestCase From 76ff9bf3df56467271899a447c88a08eb70f5193 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 21 Jun 2013 16:26:34 -0700 Subject: [PATCH 027/205] Fixed some functional test errors Signed-off-by: Jeremy Ho --- test/functional/queries_controller_test.rb | 6 +++--- test/functional/results_controller_test.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 31afa7b..a66eb24 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -7,8 +7,8 @@ class QueriesControllerTest < ActionController::TestCase end test "should get an atom feed at index" do - Factory(:successful_job) - Factory(:successful_job) + FactoryGirl.create(:successful_job) + FactoryGirl.create(:successful_job) get :index, :format => :atom assert_response :success end @@ -58,7 +58,7 @@ class QueriesControllerTest < ActionController::TestCase end test 'should show JSON for a successful job' do - query = Factory(:successful_job) + query = FactoryGirl.create(:successful_job) get :show, :id => query.id.to_s assert_response :success end diff --git a/test/functional/results_controller_test.rb b/test/functional/results_controller_test.rb index 6a49889..b95d679 100644 --- a/test/functional/results_controller_test.rb +++ b/test/functional/results_controller_test.rb @@ -3,7 +3,7 @@ class ResultsControllerTest < ActionController::TestCase setup do dump_database - Factory(:gender_result) + FactoryGirl.create(:gender_result) end test "should get an atom feed at index" do From b2a6e97934eba978b4a4506346a473c15f69d23d Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 24 Jun 2013 16:22:20 -0700 Subject: [PATCH 028/205] Minor whitespace tweaks Signed-off-by: Jeremy Ho --- Gemfile | 2 +- app/controllers/records_controller.rb | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index fa12eb0..dea5373 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git' gem 'health-data-standards', :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' gem 'hqmf2js', :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' -gem 'hqmf-parser', :git => 'https://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' +gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' gem 'coderay' diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index de050b6..fbde9ed 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -1,15 +1,11 @@ class RecordsController < ApplicationController def create - xml_file = params[:content].read - doc = Nokogiri::XML(xml_file) - root_element_name = doc.root.name if root_element_name == 'ClinicalDocument' doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') - ##document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root'] document_type = doc.at_xpath('/cda:ClinicalDocument/cda:realmCode')['code'] @@ -19,28 +15,21 @@ def create pi = HealthDataStandards::Import::E2E::PatientImporter.instance patient = pi.parse_e2e(doc) patient.save! - render :text => 'Scoop E2E Document imported', :status => 201 - + render :text => 'E2E Document imported', :status => 201 # C32 else pi = HealthDataStandards::Import::C32::PatientImporter.instance patient = pi.parse_c32(doc) patient.save! render :text => 'C32 Patient imported', :status => 201 - end - else render :text => 'Unknown XML Format', :status => 400 end - end def destroy Record.delete_all - render :text => 'All patients were deleted', :status => 200 - end - end From b53cbba32637b235e1b6f82c425f4850b556fe62 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Wed, 26 Jun 2013 13:34:36 -0700 Subject: [PATCH 029/205] Added Gemfile.lock back into branch --- .gitignore | 1 - Gemfile | 10 +- Gemfile.lock | 250 ++++++++++++++++++++++++++++++++++++++++++++ test/test_helper.rb | 2 +- 4 files changed, 256 insertions(+), 7 deletions(-) create mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index dbc7774..3a17e31 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ tmp/ doc/patient-api coverage.data coverage/ -Gemfile.lock .idea diff --git a/Gemfile b/Gemfile index 85c2d7f..4361469 100644 --- a/Gemfile +++ b/Gemfile @@ -30,12 +30,12 @@ gem 'kramdown' gem 'pry' # Specific to the SCOOP staging environment -gem 'heroku' +#gem 'heroku' group :test do # Pretty printed test output - gem 'minitest' + gem 'minitest', '< 5.0.0' gem 'turn', :require => false gem 'cover_me', '>= 1.0.0.rc6', :platforms => :ruby gem 'factory_girl', '1.3.3' @@ -46,7 +46,7 @@ group :test do end -group :production do - gem 'thin' -end +#group :production do +# gem 'thin' +#end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..21af8aa --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,250 @@ +GIT + remote: http://github.com/hquery/hqmf2js.git + revision: cc1936810085fa43542c351e92765677976cfd1f + tag: V0.3 + specs: + hqmf2js (0.1.0) + coffee-script (~> 2.2.0) + nokogiri (~> 1.5.2) + sprockets (~> 2.1.2) + tilt (~> 1.3.3) + +GIT + remote: http://github.com/hquery/patientapi.git + revision: b81d65013444263b0a6c8db1516b339e73bf1e9a + tag: V0.3 + specs: + hquery-patient-api (0.1.0) + +GIT + remote: http://github.com/scoophealth/health-data-standards.git + revision: b6857963b36e786ae9b2e37c995681e3be73f036 + branch: feature-scoop-it4 + specs: + health-data-standards (1.0.1) + builder (~> 3.0.0) + erubis (~> 2.6) + mongoid (~> 2.4.2) + nokogiri (>= 1.4.4) + uuid (~> 2.3.4) + +GIT + remote: https://github.com/hquery/hqmf-parser.git + revision: 8cbd14029c76c2c27409366528c59d0c34bddcc4 + tag: V0.3 + specs: + hqmf-parser (0.0.1) + google-spreadsheet-ruby (= 0.1.8) + roo (= 1.10.1) + rubyzip + spreadsheet (= 0.6.8) + +GEM + remote: http://rubygems.org/ + specs: + actionmailer (3.2.2) + actionpack (= 3.2.2) + mail (~> 2.4.0) + actionpack (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.1) + rack-test (~> 0.6.1) + sprockets (~> 2.1.2) + activemodel (3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + activerecord (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + activesupport (3.2.2) + i18n (~> 0.6) + multi_json (~> 1.0) + ansi (1.4.2) + arel (3.0.2) + awesome_print (1.0.2) + bson (1.6.0) + bson_ext (1.6.0) + bson (= 1.6.0) + builder (3.0.0) + choice (0.1.6) + coderay (1.0.5) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.3.3) + configatron (2.9.0) + yamler (>= 0.1.0) + cover_me (1.2.0) + configatron + hashie + daemons (1.1.4) + delayed_job (3.0.1) + activesupport (~> 3.0) + delayed_job_mongoid (1.0.8) + delayed_job (~> 3.0.0) + mongoid (>= 2.0) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + factory_girl (1.3.3) + faraday (0.8.4) + multipart-post (~> 1.1) + google-spreadsheet-ruby (0.1.8) + nokogiri (>= 1.4.3.1) + oauth (>= 0.3.6) + oauth2 (>= 0.5.0) + hashie (1.2.0) + hike (1.2.1) + httpauth (0.1) + i18n (0.6.0) + journey (1.0.4) + jquery-rails (2.1.1) + railties (>= 3.1.0, < 5.0) + thor (~> 0.14) + json (1.7.5) + jwt (0.1.5) + multi_json (>= 1.0) + kramdown (0.13.5) + libv8 (3.3.10.4) + log4r (1.1.10) + macaddr (1.6.1) + systemu (~> 2.5.0) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.1) + method_source (0.7.0) + mime-types (1.18) + minitest (2.11.2) + mocha (0.10.4) + metaclass (~> 0.0.1) + mongo (1.6.0) + bson (= 1.6.0) + mongoid (2.4.12) + activemodel (~> 3.1) + mongo (<= 1.6.2) + tzinfo (~> 0.3.22) + multi_json (1.3.6) + multipart-post (1.1.5) + nokogiri (1.5.5) + oauth (0.4.6) + oauth2 (0.8.0) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + polyglot (0.3.3) + pry (0.9.8.2) + coderay (~> 1.0.5) + method_source (~> 0.7) + slop (>= 2.4.4, < 3) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.2.2) + actionmailer (= 3.2.2) + actionpack (= 3.2.2) + activerecord (= 3.2.2) + activeresource (= 3.2.2) + activesupport (= 3.2.2) + bundler (~> 1.0) + railties (= 3.2.2) + railties (3.2.2) + actionpack (= 3.2.2) + activesupport (= 3.2.2) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + roo (1.10.1) + choice (>= 0.1.4) + google-spreadsheet-ruby (>= 0.1.5) + nokogiri (>= 1.5.0) + rubyzip (>= 0.9.4) + spreadsheet (> 0.6.4) + todonotes (>= 0.1.0) + ruby-ole (1.2.11.4) + rubyzip (0.9.9) + sass (3.1.15) + sass-rails (3.2.4) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + slop (2.4.4) + spreadsheet (0.6.8) + ruby-ole (>= 1.0) + sprockets (2.1.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + systemu (2.5.2) + therubyracer (0.9.10) + libv8 (~> 3.3.10) + thor (0.14.6) + tilt (1.3.3) + todonotes (0.1.0) + log4r + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + turn (0.9.3) + ansi + tzinfo (0.3.33) + uglifier (1.2.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + uuid (2.3.7) + macaddr (~> 1.0) + yamler (0.1.0) + +PLATFORMS + ruby + +DEPENDENCIES + awesome_print + bson_ext (~> 1.3) + coderay + coffee-rails + cover_me (>= 1.0.0.rc6) + daemons + delayed_job_mongoid (~> 1.0.8) + factory_girl (= 1.3.3) + health-data-standards! + hqmf-parser! + hqmf2js! + hquery-patient-api! + jquery-rails + jruby-openssl + kramdown + minitest (< 5.0.0) + mocha + mongoid (~> 2.0) + pry + rails (~> 3.2.1) + sass-rails + therubyracer + therubyrhino + turn + uglifier diff --git a/test/test_helper.rb b/test/test_helper.rb index be3475a..22eab1b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,7 +35,7 @@ def dump_database db.collection('results').remove({}) if db['results'] db.collection('queries').remove({}) if db['queries'] db.collection('pmn_requests').remove({}) if db['pmn_requests'] - db.collection('records').remove({}) if db['records'] + #db.collection('records').remove({}) if db['records'] end def dump_jobs From ac3a90a6f2f1fae8a53c658c6861230313408a22 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 27 Jun 2013 11:51:14 -0700 Subject: [PATCH 030/205] Merge commit '845d19b' into tempit5 Signed-off-by: Jeremy Ho --- .gitignore | 1 + Gemfile | 3 +- Gemfile.lock | 4 +- README.scoop-IT2 => README.scoop-IT4 | 2 +- test/fixtures/JOHN_CLEESE_1_25091940.xml | 3312 +++++++++++++++++++ test/fixtures/Sample-SCOOP-IT0-Document.xml | 28 - test/functional/records_controller_test.rb | 12 +- test/test_helper.rb | 2 + 8 files changed, 3325 insertions(+), 39 deletions(-) rename README.scoop-IT2 => README.scoop-IT4 (85%) create mode 100755 test/fixtures/JOHN_CLEESE_1_25091940.xml delete mode 100644 test/fixtures/Sample-SCOOP-IT0-Document.xml diff --git a/.gitignore b/.gitignore index e773938..3a17e31 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/ doc/patient-api coverage.data coverage/ +.idea diff --git a/Gemfile b/Gemfile index 40352fa..4aa4929 100644 --- a/Gemfile +++ b/Gemfile @@ -19,8 +19,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3' -#gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :branch => 'develop' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it1' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it4' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3' diff --git a/Gemfile.lock b/Gemfile.lock index 186d1ae..8416a1f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,8 +18,8 @@ GIT GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: 9a79eea4a80c838299bc79f41ebac24439095976 - branch: feature-scoop-it1 + revision: b6857963b36e786ae9b2e37c995681e3be73f036 + branch: feature-scoop-it4 specs: health-data-standards (1.0.1) builder (~> 3.0.0) diff --git a/README.scoop-IT2 b/README.scoop-IT4 similarity index 85% rename from README.scoop-IT2 rename to README.scoop-IT4 index dd873be..27e4b18 100644 --- a/README.scoop-IT2 +++ b/README.scoop-IT4 @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b feature-scoop-it2 git://github.com/scoophealth/query-gateway.git +git clone -b feature-scoop-it4 git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml new file mode 100755 index 0000000..9bd523a --- /dev/null +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -0,0 +1,3312 @@ + + + + + + + + PITO EMR-2-EMR Complete Instance Example + + + + + + + + + JOHN + CLEESE + + + + + + + + + + + + + + + + + + + + + + +
+ + + Allergies and Intolerances (Reaction List) [with entries] + Allergies + + + + + + + + + + + + + + + + + + + PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + Immunizations List [with entries] + Immunizations + + + + + + + + + + + + + + + Td + 1234 + + + + + + + + + + + + + + + Left Delt + + + + + + + + + + + + + + + + + + + Pneumovax + + + + + + + + + + + + + + + + + + + + + + + + Flu + + + + + + + + + + + + + + + Right Delt + + + + + +
+
+ + +
+ + + Laboratory Results and Reports [with entries] + Labs + + + + + + + HAEM1/CHEM4/CHEM27 + + + + + + + + + + + + + + + + + + + + WBC + + + 6.9 + + + + + + + + + + + + + + + + + + + + RBC + + + 4.39 + + + + + + + + + + + + + + + + + + + + Hemoglobin + + + 141 + + + + + + + + + + + + + + + + + + + + Hematocrit + + + 0.42 + + + + + + + + + + + + + + + + + + + + MCV + + + 95 + + + + + + + + + + + + + + + + + + + + RDW + + + 12.6 + + + + + + + + + + + + + + + + + + + + Platelet Count + + + 182 + + + + + + + + + + + + + + + + + + + + Neutrophils + + + 3.6 + + + + + + + + + + + + + + + + + + + + Lymphocytes + + + 2.5 + + + + + + + + + + + + + + + + + + + + Monocytes + + + 0.5 + + + + + + + + + + + + + + + + + + + + Eosinophils + + + 0.3 + + + + + + + + + + + + + + + + + + + + Basophils + + + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total Protein + + + 75 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Albumin + + + 39 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total Bilirubin + + + 12 + + + + + + + + + + + + + + + + + + + + Direct Bilirubin + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Alkaline Phosphatase + + + 56 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gamma GT + + + 43 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ALT + + + 85 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AST + + + 51 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LD + + + 191 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fluid Neutrophils + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Lymphocytes + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Monocytes + Macrophages + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + Fluid Mesothelial Cells + + + Results unavailable due to laboratory error. + + + + + + + + + + + + + + + + + + + + + + + + MICRO3 + + + + + + + + + + + + + + + + + + + + Specimen Source + + + Bone Chip +bone Lt metatarsal + + + + + + + + + + + + + + + + + + + + Gram Stain + + + +3 Polymorphs ++4 Gram negative bacilli resembling coliforms ++4 Gram positive cocci in pairs and chains ++2 Gram positive cocci in clusters ++2 Yeast + + + + + + + + + + + + + + + + + + + + Report Status Preliminary + + + +3 Proteus mirabilis +Imipenem : Further report to follow ++3 Escherichia coli ++3 Klebsiella oxytoca + + + + + + + + + + + + + + + + + + + + Culture + + + Proteus mirabilis + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + R + + + + + + + + + + + + + + + + + + + + Cefazolin + + + R + + + + + + + + + + + + + + + + + + + + Cefuroxime Parenteral + + + R + + + + + + + + + + + + + + + + + + + + Cefixime + + + R + + + + + + + + + + + + + + + + + + + + Cefotaxime + + + R + + + + + + + + + + + + + + + + + + + + Ceftriaxone + + + R + + + + + + + + + + + + + + + + + + + + Cefpodoxime + + + R + + + + + + + + + + + + + + + + + + + + Ceftazidime + + + R + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + S + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + + + + Tetracycline + + + R + + + + + + + + + + + + + + + + + + + + Culture + + + Escherichia coli + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + S + + + + + + + + + + + + + + + + + + + + Cefazolin + + + S + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + R + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + + + + Culture + + + Klebsiella oxytoca + + + + + + + + + + + + + + + + + + + + Ampicillin + + + R + + + + + + + + + + + + + + + + + + + + Cephalexin + + + S + + + + + + + + + + + + + + + + + + + + Cefazolin + + + S + + + + + + + + + + + + + + + + + + + + Trimethoprim-Sulfa + + + S + + + + + + + + + + + + + + + + + + + + Ciprofloxacin + + + S + + + + + + + + + + + + + + + + + + + + Gentamicin + + + S + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + Medications and Prescriptions - Medication List [with entries] + + + + + + + + + + + + + + TYLENOL EXTRA STRENGTH TAB 500MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE 25MG TABLET + + +
+ + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + IBUPROFEN TAB 400MG + + +
+ + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + ATIVAN 1MG + + +
+ + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + + + + + + + + + + + PRN Indicator: true + + + + + + + + + + + + + + + + + + + + + ASA 81 MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE 20MG + + +
+ + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + AVA-RAMIPRIL 5MG + + +
+ + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + CARVEDILOL 12.5MG + + +
+ + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + + + + + + + + + + + PRN Indicator: false + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN 40MG + + +
+ + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + PRN Indicator: false + + + + + + + +
+
+ + +
+ + + Problems and Conditions - Problem List [with entries] + Text text text + + + + + + + + + + + + HEART FAILURE* + + + + + + + + + + + + + + + + + + + ESSENTIAL HYPERTENSION* + + + + + + + + + + + + + + + + + + + DIABETES MELLITUS* + + + + + + + + + + + + + + + + + + + CHRONIC BRONCHITIS* + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/test/fixtures/Sample-SCOOP-IT0-Document.xml b/test/fixtures/Sample-SCOOP-IT0-Document.xml deleted file mode 100644 index 7570ed7..0000000 --- a/test/fixtures/Sample-SCOOP-IT0-Document.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - Henry - Levin - the 7th - - - - - - - diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index e060ff4..70b92bd 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -8,20 +8,20 @@ class RecordsControllerTest < ActionController::TestCase test "should POST a C32 to create" do c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') - post :create, {:content => c32, :content_type => 'c32'} + post :create, {:content => c32} assert_response 201 r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) assert r assert_equal -773020800, r['birthdate'] end - test "should POST a Scoop Basic XML to create" do - c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'Sample-SCOOP-IT0-Document.xml'), 'application/xml') - post :create, {:content => c32, :content_type => 'scoop_basic'} + test "should POST a E2E to create" do + e2e = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'JOHN_CLEESE_1_25091940.xml'), 'application/xml') + post :create, {:content => e2e} assert_response 201 - r = Mongoid.master['records'].find_one({:first => 'Henry', :last => 'Levin'}) + r = Mongoid.master['records'].find_one({:first => 'JOHN', :last => 'CLEESE'}) assert r - assert_equal -1176163200, r['birthdate'] + assert_equal -923616000, r['birthdate'] end end diff --git a/test/test_helper.rb b/test/test_helper.rb index c395124..7b9dceb 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,6 +35,8 @@ def dump_database db.collection('results').remove({}) if db['results'] db.collection('queries').remove({}) if db['queries'] db.collection('pmn_requests').remove({}) if db['pmn_requests'] +# TODO Add records cleaning without impacting tests that require the records +# db.collection('records').remove({}) if db['records'] end def dump_jobs From c044ee483dcf7ff972f8ca03387e64bc79cf3517 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 27 Jun 2013 13:45:30 -0700 Subject: [PATCH 031/205] All tests run cleanly against develop-preMongoid3 branch of scoophealth's health-data-standards fork --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 4361469..2ca675a 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "bson_ext", "~> 1.3", :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'feature-scoop-it4' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'develop-preMongoid3' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3' diff --git a/Gemfile.lock b/Gemfile.lock index 21af8aa..c9af448 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,8 +18,8 @@ GIT GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: b6857963b36e786ae9b2e37c995681e3be73f036 - branch: feature-scoop-it4 + revision: 1407eed0e3659c8424ccf5fa753178b3a7b59f77 + branch: develop-preMongoid3 specs: health-data-standards (1.0.1) builder (~> 3.0.0) From f4f204705e893e9b0136d1e2a07200c13062ac0a Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 27 Jun 2013 13:52:06 -0700 Subject: [PATCH 032/205] Replaced ruby 1.9.2 with ruby 1.9.3 in README files --- .travis.yml | 12 ------------ README.md | 6 +++--- README.rdoc | 8 ++++---- 3 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b7f5d1f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: ruby -rvm: - - 1.9.2 -branches: - only: - - master - - develop -notifications: - email: - recipients: - - healthcare-ci@googlegroups.com - on_failure: change \ No newline at end of file diff --git a/README.md b/README.md index 3f7f411..b2d2070 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ hQuery will also run on Windows, however, there are some minor limitations to fu Dependencies ------------ -* Ruby = 1.9.2 -* Rails 3.1 +* Ruby = 1.9.3 +* Rails >= 3.1 * MongoDB >= 1.8.1 Install Instructions @@ -44,4 +44,4 @@ limitations under the License. Project Practices ----------------- -Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project. \ No newline at end of file +Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project. diff --git a/README.rdoc b/README.rdoc index 05d537d..0a09c3c 100644 --- a/README.rdoc +++ b/README.rdoc @@ -13,10 +13,10 @@ hQuery will also run on Windows, however, there are some minor limitations to fu = Dependencies -* Ruby = 1.9.2 -* Rails 3.1 -* MongoDB >= 1.8.1 +* Ruby = 1.9.3 +* Rails >= 3.1 +* MongoDB >= 1.8.1+ = End-to-end Install Instructions See the query composer for installation instructions for both the composer and gateway - http://github \ No newline at end of file + http://github From 2bbfead40800b80c28ad8cc5fc78c582a68c1302 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 27 Jun 2013 14:00:43 -0700 Subject: [PATCH 033/205] Renamed to agree with branch name --- README.scoop-IT4 => README.develop-preMongoid3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename README.scoop-IT4 => README.develop-preMongoid3 (81%) diff --git a/README.scoop-IT4 b/README.develop-preMongoid3 similarity index 81% rename from README.scoop-IT4 rename to README.develop-preMongoid3 index 27e4b18..0b9d360 100644 --- a/README.scoop-IT4 +++ b/README.develop-preMongoid3 @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b feature-scoop-it4 git://github.com/scoophealth/query-gateway.git +git clone -b develop-preMongoid3 git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. From c2460008bceef0efd2649d11d7867be49a301a81 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 27 Jun 2013 14:51:17 -0700 Subject: [PATCH 034/205] Partial update of Gemfile.lock Signed-off-by: Jeremy Ho --- Gemfile.lock | 62 +++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4fff266..c5a53af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ GEM activesupport (3.2.2) i18n (~> 0.6) multi_json (~> 1.0) - ansi (1.4.2) + ansi (1.4.3) arel (3.0.2) awesome_print (1.0.2) bson (1.6.0) @@ -77,21 +77,21 @@ GEM bson (= 1.6.0) builder (3.0.0) choice (0.1.6) - coderay (1.0.5) + coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.3.3) - configatron (2.9.0) + coffee-script-source (1.6.2) + configatron (2.13.0) yamler (>= 0.1.0) cover_me (1.2.0) configatron hashie - daemons (1.1.4) - delayed_job (3.0.1) + daemons (1.1.9) + delayed_job (3.0.5) activesupport (~> 3.0) delayed_job_mongoid (1.0.8) delayed_job (~> 3.0.0) @@ -108,19 +108,19 @@ GEM nokogiri (>= 1.4.3.1) oauth (>= 0.3.6) oauth2 (>= 0.5.0) - hashie (1.2.0) - hike (1.2.1) + hashie (2.0.5) + hike (1.2.3) httpauth (0.2.0) - i18n (0.6.0) + i18n (0.6.4) journey (1.0.4) - jquery-rails (2.1.1) - railties (>= 3.1.0, < 5.0) - thor (~> 0.14) - json (1.7.5) - jwt (0.1.6) - multi_json (>= 1.0) - kramdown (0.13.5) - libv8 (3.3.10.4) + jquery-rails (3.0.1) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.8.0) + jwt (0.1.8) + multi_json (>= 1.5) + kramdown (1.0.2) + libv8 (3.11.8.17) log4r (1.1.10) macaddr (1.6.1) systemu (~> 2.5.0) @@ -140,10 +140,10 @@ GEM activemodel (~> 3.1) mongo (<= 1.6.2) tzinfo (~> 0.3.22) - multi_json (1.3.6) + multi_json (1.7.7) multi_xml (0.5.4) multipart-post (1.2.0) - nokogiri (1.5.5) + nokogiri (1.5.10) oauth (0.4.7) oauth2 (0.9.1) faraday (~> 0.8) @@ -182,6 +182,7 @@ GEM rake (10.1.0) rdoc (3.12.2) json (~> 1.4) + ref (1.0.5) roo (1.10.1) choice (>= 0.1.4) google-spreadsheet-ruby (>= 0.1.5) @@ -191,12 +192,12 @@ GEM todonotes (>= 0.1.0) ruby-ole (1.2.11.7) rubyzip (0.9.9) - sass (3.1.15) - sass-rails (3.2.4) + sass (3.2.9) + sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - slop (2.4.4) + slop (3.4.5) spreadsheet (0.6.8) ruby-ole (>= 1.0) sprockets (2.1.3) @@ -204,23 +205,24 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) systemu (2.5.2) - therubyracer (0.9.10) - libv8 (~> 3.3.10) + therubyracer (0.11.4) + libv8 (~> 3.11.8.12) + ref thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) - thor (0.14.6) - tilt (1.3.3) + thor (0.18.1) + tilt (1.3.7) todonotes (0.1.1) log4r - treetop (1.4.10) + treetop (1.4.14) polyglot polyglot (>= 0.3.1) - turn (0.9.3) + turn (0.9.6) ansi - tzinfo (0.3.33) - uglifier (1.2.3) + tzinfo (0.3.37) + uglifier (2.1.1) execjs (>= 0.3.0) multi_json (>= 1.0.2) uuid (2.3.7) From fbdf81b7bff035433900c77b693177ee6c51726b Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 27 Jun 2013 15:45:33 -0700 Subject: [PATCH 035/205] Removed redundant scoop README Signed-off-by: Jeremy Ho --- README.scoop | 2 +- README.scoop-develop | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 README.scoop-develop diff --git a/README.scoop b/README.scoop index 0b9d360..63ffb01 100644 --- a/README.scoop +++ b/README.scoop @@ -2,7 +2,7 @@ Get the source code for the gateway. Do this with the following: cd ~ -git clone -b develop-preMongoid3 git://github.com/scoophealth/query-gateway.git +git clone -b scoop-develop git://github.com/scoophealth/query-gateway.git Afterwards, go into the new directory, install, seed, and start the server. diff --git a/README.scoop-develop b/README.scoop-develop deleted file mode 100644 index 63ffb01..0000000 --- a/README.scoop-develop +++ /dev/null @@ -1,20 +0,0 @@ -Get the source code for the gateway. Do this with the following: - -cd ~ - -git clone -b scoop-develop git://github.com/scoophealth/query-gateway.git - -Afterwards, go into the new directory, install, seed, and start the server. - -cd query-gateway - -bundle install - -bundle exec rake db:seed - -mkdir -p tmp/pids - -The following commands starts the server on port 3001. - -bundle exec script/delayed_job start -bundle exec rails server -p 3001 From e3f0d12e8037c3c838fbd747a6cc9671b532a37e Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 28 Jun 2013 11:44:20 -0700 Subject: [PATCH 036/205] Use master branch of patientapi Signed-off-by: Jeremy Ho --- Gemfile | 2 +- Gemfile.lock | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1cd699e..37151fc 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'bson_ext', '~> 1.3', :platforms => :mri gem 'delayed_job_mongoid', '~> 1.0.8' -gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'V0.3' +gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git'#, :tag => 'V0.3' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'develop-preMongoid3' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' diff --git a/Gemfile.lock b/Gemfile.lock index 0534f85..b4ee721 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,8 +34,7 @@ GIT GIT remote: http://github.com/scoophealth/patientapi.git - revision: b81d65013444263b0a6c8db1516b339e73bf1e9a - tag: V0.3 + revision: 2ead21dc2040485e4625a7d3245ef656e50db7e3 specs: hquery-patient-api (0.1.0) From 0f662a8589429053d57ce249e9d35817f1a40a93 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 28 Jun 2013 15:42:05 -0700 Subject: [PATCH 037/205] Added Scoop IT0 Unit Test Signed-off-by: Jeremy Ho --- test/fixtures/scoop-records.json | 9 ++++++++ test/fixtures/scoop/scoop_general_reduce.js | 9 ++++++++ test/fixtures/scoop/scoop_it0_map.js | 9 ++++++++ test/test_helper.rb | 7 +++++-- test/unit/scoop_job_test.rb | 23 +++++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/scoop-records.json create mode 100644 test/fixtures/scoop/scoop_general_reduce.js create mode 100644 test/fixtures/scoop/scoop_it0_map.js create mode 100644 test/unit/scoop_job_test.rb diff --git a/test/fixtures/scoop-records.json b/test/fixtures/scoop-records.json new file mode 100644 index 0000000..cee9316 --- /dev/null +++ b/test/fixtures/scoop-records.json @@ -0,0 +1,9 @@ +{ "_id" : { "$oid" : "51cdfdc342582221e8000001" }, "effective_time" : 1370835720, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000008" }, "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000009" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000a" }, "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800000b" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000002" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000003" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000004" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000005" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000006" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000007" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc342582221e800000c" }, "effective_time" : 1370835720, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001b" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001c" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001d" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001e" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001f" }, "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000020" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000021" }, "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000022" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000d" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800000e" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000f" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000010" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000011" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000012" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000013" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000014" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000015" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000016" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000017" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000018" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000019" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc342582221e8000023" }, "effective_time" : 1370835720, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000056" }, "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000057" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "12227-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000024" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "WBC", "referenceRange" : "4.0...11.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000025" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "6.9", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000026" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "RBC", "referenceRange" : "4.20...5.80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000027" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "4.39", "units" : "tera/L" } ] }, { "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000028" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Hemoglobin", "referenceRange" : "135...170", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000029" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "141", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Hematocrit", "referenceRange" : "0.40...0.50", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.42", "units" : null } ] }, { "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "MCV", "referenceRange" : "82...98", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "95", "units" : "fL" } ] }, { "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "RDW", "referenceRange" : "11.0...15.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.6", "units" : "%" } ] }, { "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000030" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Platelet Count", "referenceRange" : "150...400", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000031" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "182", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000032" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Neutrophils", "referenceRange" : "2.0...8.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000033" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "3.6", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000034" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Lymphocytes", "referenceRange" : "1.2...3.5", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000035" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "2.5", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000036" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Monocytes", "referenceRange" : "0.2...1.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000037" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.5", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000038" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Eosinophils", "referenceRange" : "0.0...0.7", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000039" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.3", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Basophils", "referenceRange" : "0.0...0.2", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.0", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "2885-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243790, "description" : "Total Protein", "referenceRange" : "62...82", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "75", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Albumin", "referenceRange" : "34...50", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "39", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000040" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Total Bilirubin", "referenceRange" : "0...18", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000041" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12", "units" : "umol/L" } ] }, { "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000042" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Direct Bilirubin", "referenceRange" : "0...5", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000043" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "2", "units" : "umol/L" } ] }, { "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000044" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Alkaline Phosphatase", "referenceRange" : "30...135", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000045" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "56", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000046" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Gamma GT", "referenceRange" : "15...80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000047" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "43", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000048" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1314243763, "description" : "ALT", "referenceRange" : "25...80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000049" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "85", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004a" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1314243763, "description" : "AST", "referenceRange" : "10...38", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "51", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "2532-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "LD", "referenceRange" : "90...240", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "191", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "26513-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Neutrophils", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "11031-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000050" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Lymphocytes", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000051" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "30437-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000052" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Monocytes + Macrophages", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000053" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "28544-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000054" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Mesothelial Cells", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000055" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e8000058" }, "effective_time" : 1370835720, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006b" }, "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006c" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006d" }, "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006e" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006f" }, "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000070" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000059" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005b" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005c" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005d" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005e" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005f" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000060" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000061" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000062" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000063" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000064" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000065" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000066" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000067" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000068" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000069" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e8000071" }, "effective_time" : 1370835720, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e8" }, "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e9" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ea" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000eb" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ec" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ed" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ee" }, "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ef" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d6" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d8" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000da" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000db" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "400.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000dc" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000dd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000de" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000df" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e0" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e2" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e4" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e6" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "31208-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000072" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304066400, "description" : "Specimen Source", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000073" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Bone Chip\nbone Lt metatarsal", "units" : null } ] }, { "codes" : { "LOINC" : [ "664-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000074" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304045349, "description" : "Gram Stain", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000075" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+3 Polymorphs \n+4 Gram negative bacilli resembling coliforms \n+4 Gram positive cocci in pairs and chains \n+2 Gram positive cocci in clusters \n+2 Yeast", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10114C" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000076" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419909, "description" : "Report Status Preliminary", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000077" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+3 Proteus mirabilis \nImipenem : Further report to follow \n+3 Escherichia coli \n+3 Klebsiella oxytoca", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000078" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419753, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000079" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Proteus mirabilis", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "145-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000080" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419753, "description" : "Cefuroxime Parenteral", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000081" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "80-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000082" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefixime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000083" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "108-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000084" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefotaxime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000085" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "141-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000086" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Ceftriaxone", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000087" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "120-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000088" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefpodoxime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000089" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "133-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Ceftazidime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000090" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000091" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "496-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000092" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Tetracycline", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000093" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000094" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000095" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Escherichia coli", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000096" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000097" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000098" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000099" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Klebsiella oxytoca", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000aa" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ab" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ac" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ad" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ae" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000af" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "5778-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Colour", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "YELLOW", "units" : null } ] }, { "codes" : { "LOINC" : [ "5767-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Appearance", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "CLEAR", "units" : null } ] }, { "codes" : { "LOINC" : [ "2756-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "pH", "referenceRange" : "5.0...8.5", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "7.5", "units" : null } ] }, { "codes" : { "LOINC" : [ "5811-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Specific Gravity", "referenceRange" : "1.003...1.035", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.010", "units" : null } ] }, { "codes" : { "LOINC" : [ "5804-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Protein", "referenceRange" : "...0.3", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<0.3 g/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "2349-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ba" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Glucose", "referenceRange" : "...6", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<6 mmol/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "2514-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000bc" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ketones", "referenceRange" : "...1.5", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<1.5 mmol/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "5794-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000be" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Hemoglobin", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bf" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "NEG", "units" : null } ] }, { "codes" : { "LOINC" : [ "5802-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Nitrite", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "NEG", "units" : null } ] }, { "codes" : { "LOINC" : [ "5799-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c2" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1312111200, "description" : "Leukocytes", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+2", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10114" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Report Status", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Final", "units" : null } ] }, { "codes" : { "LOINC" : [ "X433" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Organism 1", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "ESCHERICHIA COLI\\.Zt\\OVER 100 M CFU/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10042" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ca" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Cephalothin-Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000cc" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ce" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cf" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "496-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Tetracycline", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "363-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Nitrofurantoin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e80000f0" }, "effective_time" : 1370835720, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f7" }, "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f8" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f3" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 0 }, "denominator" : { "unit" : null, "value" : 0 } } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f4" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f5" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f6" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f1" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f2" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "131.6", "units" : "umol/L" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e80000f9" }, "effective_time" : 1370835720, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000110" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000111" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000112" }, "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000113" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000114" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000115" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000116" }, "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000117" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fc" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000fd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fe" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ff" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000100" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000101" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "400.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000102" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000103" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000104" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000105" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000106" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000107" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.25", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000108" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000109" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010a" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010c" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010e" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fa" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000fb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "161.2", "units" : "umol/L" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e8000118" }, "effective_time" : 1370835720, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800011d" }, "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011e" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000119" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800011b" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011c" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] } ] } +{ "_id" : { "$oid" : "51cdfdc442582221e800011f" }, "effective_time" : 1370835720, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000128" }, "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000129" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800012a" }, "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800012b" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000122" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000123" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "10.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000124" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000125" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "112.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000126" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000127" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.25", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000120" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000121" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "158.4", "units" : "umol/L" } ] } ] } diff --git a/test/fixtures/scoop/scoop_general_reduce.js b/test/fixtures/scoop/scoop_general_reduce.js new file mode 100644 index 0000000..de1161b --- /dev/null +++ b/test/fixtures/scoop/scoop_general_reduce.js @@ -0,0 +1,9 @@ +function reduce(key, values) { + var result = 0; + + while (values.hasNext()) { + result += values.next(); + } + + return result; +} diff --git a/test/fixtures/scoop/scoop_it0_map.js b/test/fixtures/scoop/scoop_it0_map.js new file mode 100644 index 0000000..71128da --- /dev/null +++ b/test/fixtures/scoop/scoop_it0_map.js @@ -0,0 +1,9 @@ +function map(patient) { + var time = new Date(2013, 5, 1); + if (patient.gender() == "M") { + var age = Math.floor(patient.age(time)); + if(age >= 65) { + emit("male_>65", 1); + } + } +}; diff --git a/test/test_helper.rb b/test/test_helper.rb index a314518..aea8798 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,8 +35,11 @@ def dump_database db.collection('results').remove({}) if db['results'] db.collection('queries').remove({}) if db['queries'] db.collection('pmn_requests').remove({}) if db['pmn_requests'] -# TODO Add records cleaning without impacting tests that require the records -# db.collection('records').remove({}) if db['records'] +end + +def load_scoop_database + # Deletes any existing records and loads in scoop records + `mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/scoop-records.json` end def dump_jobs diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb new file mode 100644 index 0000000..1f6d1a3 --- /dev/null +++ b/test/unit/scoop_job_test.rb @@ -0,0 +1,23 @@ +require 'test_helper' + +class ScoopJobTest < ActiveSupport::TestCase + + setup do + dump_database + dump_jobs + Delayed::Worker.delay_jobs=false + load_scoop_database + end + + test "iteration 0 query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it0_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["male_>65"].to_i, 4 + end +end \ No newline at end of file From 74f5dcef2e6dc8c9068cc0f476221d3c9b5d9820 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 28 Jun 2013 15:57:47 -0700 Subject: [PATCH 038/205] Added IT1 Unit Test Signed-off-by: Jeremy Ho --- test/fixtures/scoop/scoop_it1_map.js | 56 ++++++++++++++++++++++++++++ test/unit/scoop_job_test.rb | 16 +++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/scoop/scoop_it1_map.js diff --git a/test/fixtures/scoop/scoop_it1_map.js b/test/fixtures/scoop/scoop_it1_map.js new file mode 100644 index 0000000..ead76d0 --- /dev/null +++ b/test/fixtures/scoop/scoop_it1_map.js @@ -0,0 +1,56 @@ +function map(patient) { + var ageLimit = 65; + var drugLimit = 5; + var time = new Date(2013, 2, 10); + + var drugList = patient.medications(); + var currentDrugs = findCurrentDrugs(drugList, time); + + emit('total_population', 1); + if (patient.age(time) > ageLimit) { + emit('sampled_number', 1); + + // Adds patient to count if over ageLimit & over drugLimit + if (currentDrugs > drugLimit) { + emit('polypharmacy_number', 1); + } + } +} + +// Returns count of "active" drugs that are between start & end date +// Also checks for the same "active" drug and doesn't overcount +function findCurrentDrugs(drugs, time) { + var now = time.getTime(); + var count = 0; + var seenDrugs = []; + + for(var i = 0; i < drugs.length; i++) { + var repeat = false; + var drugStart = drugs[i].indicateMedicationStart().getTime(); + var drugEnd = drugs[i].indicateMedicationStop().getTime(); + + // Check if drug is within the right time + if(drugEnd >= now && drugStart <= now) { + // Check if this entry is a repeat of same drug (codesystem agnostic) + var codes = drugs[i].medicationInformation().codedProduct(); + + for (var j = 0; j < codes.length; j++) { + var code = codes[j].code(); + + if(seenDrugs.indexOf(code) == -1) { + seenDrugs.push(code); + } + else { + repeat = true; + } + } + + // Increment count if not a repeat + if(!repeat) { + count++; + } + } + } + + return count; +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 1f6d1a3..7019ff0 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -20,4 +20,18 @@ class ScoopJobTest < ActiveSupport::TestCase results = query.result assert_equal results["male_>65"].to_i, 4 end -end \ No newline at end of file + + test "iteration 1 query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it1_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["total_population"].to_i, 9 + assert_equal results["sampled_number"].to_i, 7 + assert_equal results["polypharmacy_number"].to_i, 3 + end +end From 4e90c55ae33914f935add863aeb8de514843ac9c Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 28 Jun 2013 16:19:31 -0700 Subject: [PATCH 039/205] Added IT2 Unit Test Signed-off-by: Jeremy Ho --- test/fixtures/scoop/scoop_it2_map.js | 53 ++++++++++++++++++++++++++++ test/unit/scoop_job_test.rb | 28 +++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 test/fixtures/scoop/scoop_it2_map.js diff --git a/test/fixtures/scoop/scoop_it2_map.js b/test/fixtures/scoop/scoop_it2_map.js new file mode 100644 index 0000000..18890a7 --- /dev/null +++ b/test/fixtures/scoop/scoop_it2_map.js @@ -0,0 +1,53 @@ +function map(patient) { + var atcLevel = 4; // Level definition based on definition found on Wikipedia + + var drugClasses = findATCDrugClasses(patient.medications(), atcLevel); + + for(var i = 0; i < drugClasses.length; i++) { + emit(drugClasses[i], 1); + } +} + +// Returns list of all ATC medication codes +function findATCDrugClasses(drugs, level) { + var list = []; + var cutoff; + + // Define ATC cutoff levels + switch(level) { + case 1: + cutoff = 1; + break; + case 2: + cutoff = 3; + break; + case 3: + cutoff = 4; + break; + case 4: + cutoff = 5; + break; + /* Prevent data leakage - only want classes, not specific substance + case 5: + cutoff = 7; + break; + */ + default: + return list; + } + + for(var i = 0; i < drugs.length; i++) { + // Get all represented codes for each drug + var codes = drugs[i].medicationInformation().codedProduct(); + + // Filter out only ATC codes + for(var j = 0; j < codes.length; j++) { + if(codes[j].codeSystemName() == "whoATC") { + // Truncate to appropriate level length + list.push(codes[j].code().substring(0, cutoff)); + } + } + } + + return list; +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 7019ff0..34f7a71 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -34,4 +34,32 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["sampled_number"].to_i, 7 assert_equal results["polypharmacy_number"].to_i, 3 end + + test "iteration 2 query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it2_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["B01AC"].to_i, 4 + assert_equal results["C01AA"].to_i, 2 + assert_equal results["C01CA"].to_i, 1 + assert_equal results["C03CA"].to_i, 3 + assert_equal results["C03DA"].to_i, 3 + assert_equal results["C07AG"].to_i, 3 + assert_equal results["C09AA"].to_i, 3 + assert_equal results["C10AA"].to_i, 4 + assert_equal results["H03AA"].to_i, 2 + assert_equal results["M01AE"].to_i, 2 + assert_equal results["N02AA"].to_i, 2 + assert_equal results["N02BE"].to_i, 4 + assert_equal results["N05BA"].to_i, 3 + assert_equal results["N06AB"].to_i, 1 + assert_equal results["R03AC"].to_i, 3 + assert_equal results["R03BA"].to_i, 2 + assert_equal results["R03BB"].to_i, 3 + end end From c69aa0f2312007c5a2f3f414f19a2e19bcd995c6 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 2 Jul 2013 10:24:26 -0700 Subject: [PATCH 040/205] Added IT4 Unit Test Signed-off-by: Jeremy Ho --- test/fixtures/scoop/scoop_it4_map.js | 80 ++++++++++++++++++++++++++++ test/unit/scoop_job_test.rb | 14 +++++ 2 files changed, 94 insertions(+) create mode 100644 test/fixtures/scoop/scoop_it4_map.js diff --git a/test/fixtures/scoop/scoop_it4_map.js b/test/fixtures/scoop/scoop_it4_map.js new file mode 100644 index 0000000..de864a4 --- /dev/null +++ b/test/fixtures/scoop/scoop_it4_map.js @@ -0,0 +1,80 @@ +function map(patient) { + var targetMedicationCodes = { + "whoATC": ["C01AA05"], + "HC-DIN": ["02281236", "02281228", "02281201", "02245428", "02245427", + "02245426", "02048264", "02048272", "0021415", "00698296", "00647470"] + }; + + var targetLabCodes = { + "LOINC": ["45066-8", "2160-0", "33914-3", "50044-7", "48642-3", "48643-1"] + }; + + var ageLimit = 65; + + var drugList = patient.medications(); + var resultList = patient.results(); + + var now = new Date(2013, 5, 12); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + // Checks for Creatinine labs performed within the last year + function hasLabCode(patient) { + return resultList.match(targetLabCodes, addDate(now, -1, 0, 0), end).length; + } + + // Checks for existence of Digoxin + function hasMedication(patient) { + return drugList.match(targetMedicationCodes, start, end).length; + } + + function hasCurrentMedication(patient) { + for (var i = 0; i < drugList.length; i++) { + var tmpArray = new hQuery.CodedEntryList(); + tmpArray[0] = drugList[i]; + if (tmpArray.match(targetMedicationCodes)) { + var drugStart = drugList[i].indicateMedicationStart().getTime(); + var drugEnd = drugList[i].indicateMedicationStop().getTime(); + + // Check if drug is within the right time + if (drugEnd >= now && drugStart <= now) { + return true; + } + } + } + return false; + } + + emit('total_pop', 1); + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit("senior_pop", 1); + if (hasLabCode(patient)) { + if (hasMedication(patient) && hasCurrentMedication(patient)) { + //emit("Digoxin: " + patient.given() + " " + patient.last(), 1); + //emit("Creatinine: " + patient.given() + " " + patient.last(), 1); + var c = patient.results(); + for (var i = 0; i < c.length; i++) { + if (c[i].interpretation().code() == "A") { + //emit("Abnormal Creatinine: " + patient.given() + " " + patient.last(), 1); + emit("senior_pop_digoxin_creatinine_abnormal", 1); + } + } + } + } + } +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 34f7a71..bfaea41 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -62,4 +62,18 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["R03BA"].to_i, 2 assert_equal results["R03BB"].to_i, 3 end + + test "iteration 4 query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it4_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["senior_pop"].to_i, 7 + assert_equal results["senior_pop_digoxin_creatinine_abnormal"].to_i, 2 + assert_equal results["total_pop"].to_i, 9 + end end From a26f683c3ddced8fde682a990fd56ccd8dd92318 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 2 Jul 2013 10:24:51 -0700 Subject: [PATCH 041/205] Update John Cleese test file Signed-off-by: Jeremy Ho --- test/fixtures/JOHN_CLEESE_1_25091940.xml | 1785 ++++++++++++---------- 1 file changed, 1005 insertions(+), 780 deletions(-) mode change 100755 => 100644 test/fixtures/JOHN_CLEESE_1_25091940.xml diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml old mode 100755 new mode 100644 index 9bd523a..199e495 --- a/test/fixtures/JOHN_CLEESE_1_25091940.xml +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -15,7 +15,7 @@ CDA Header PITO EMR-2-EMR Complete Instance Example - + - + + + + + BC + + + + JOHN @@ -32,6 +40,9 @@ CDA Header + + + @@ -41,9 +52,15 @@ CDA Header ******************************************************** --> - + +
+ + + Alerts [without entries] + No Alerts +
+
+ @@ -120,6 +151,260 @@ Allergies and Intolerances - (Reaction List) + +
+ + + Clinical Measured Observations [with entries] + Clinical Measured Observations + + + + + + + + + + + + + + + + + Blood Pressure + + 130/85 (sitting position) + + + + + + + + + + + + + + + + + + + + + Temperature + + 37 (degrees celcius) + + + + + + + + + + + + + + + + + + + + + Weight + + 71 (in kg) + + + + + + + + + + + + + + + + + + + + + Height + + 170 (in cm) + + + + + + + + + + + + + + + + + + + + + Waist + + 36 (Waist Circum in cm) + + + + + + + + + + + + + + + + + + + + + Heart Rate + + 85 (in bpm (nnn) Range:40-180) + + + + +
+
+ + +
+ + + Family History [with entries] + Family History + + + + + + + Heart Attack + + Heart Attack + + + + + + + + + + + + + + + +
+
+ @@ -171,10 +456,10 @@ Immunization List Left Delt - + - + @@ -208,7 +493,7 @@ Immunization List - + @@ -251,10 +536,10 @@ Immunization List Right Delt - + - + @@ -273,9 +558,9 @@ Laboratory Results & Results - + - HAEM1/CHEM4/CHEM27 + MICRO3 @@ -285,10 +570,7 @@ Laboratory Results & Results - - doctor - doe - + BOB MDCARE @@ -304,23 +586,23 @@ Laboratory Results & Results - - - WBC + + + Specimen Source - - 6.9 + + Bone Chip +bone Lt metatarsal - @@ -336,23 +618,26 @@ Laboratory Results & Results - - - RBC + + + Gram Stain - - 4.39 + + +3 Polymorphs ++4 Gram negative bacilli resembling coliforms ++4 Gram positive cocci in pairs and chains ++2 Gram positive cocci in clusters ++2 Yeast - @@ -368,23 +653,25 @@ Laboratory Results & Results - - - Hemoglobin + + + Report Status Preliminary - - 141 + + +3 Proteus mirabilis +Imipenem : Further report to follow ++3 Escherichia coli ++3 Klebsiella oxytoca - @@ -400,23 +687,22 @@ Laboratory Results & Results - - - Hematocrit + + + Culture - - 0.42 + + Proteus mirabilis - @@ -432,23 +718,22 @@ Laboratory Results & Results - - - MCV + + + Ampicillin - - 95 + + R - @@ -464,23 +749,22 @@ Laboratory Results & Results - - - RDW + + + Cephalexin - - 12.6 + + R - @@ -496,23 +780,22 @@ Laboratory Results & Results - - - Platelet Count + + + Cefazolin - - 182 + + R - @@ -528,23 +811,22 @@ Laboratory Results & Results - - - Neutrophils + + + Cefuroxime Parenteral - - 3.6 + + R - @@ -560,23 +842,22 @@ Laboratory Results & Results - - - Lymphocytes + + + Cefixime - - 2.5 + + R - @@ -592,23 +873,22 @@ Laboratory Results & Results - - - Monocytes + + + Cefotaxime - - 0.5 + + R - @@ -624,23 +904,22 @@ Laboratory Results & Results - - - Eosinophils + + + Ceftriaxone - - 0.3 + + R - @@ -656,23 +935,22 @@ Laboratory Results & Results - - - Basophils + + + Cefpodoxime - - 0.0 + + R - @@ -684,36 +962,26 @@ Laboratory Results & Results - - - - - - - - - - - - Total Protein + + + Ceftazidime - - 75 + + R - @@ -725,36 +993,26 @@ Laboratory Results & Results - - - - - - - - - - - - Albumin + + + Trimethoprim-Sulfa - - 39 + + S - @@ -766,36 +1024,26 @@ Laboratory Results & Results - - - - - - - - - - - - Total Bilirubin + + + Ciprofloxacin - - 12 + + S - @@ -811,23 +1059,22 @@ Laboratory Results & Results - - - Direct Bilirubin + + + Gentamicin - - 2 + + S - @@ -839,36 +1086,26 @@ Laboratory Results & Results - - - - - - - - - - - - Alkaline Phosphatase + + + Tetracycline - - 56 + + R - @@ -880,118 +1117,26 @@ Laboratory Results & Results - - - - - - - - - - - - Gamma GT + + + Culture - - 43 + + Escherichia coli - - - - - - - - - - - - - - - - - - - - - - - - - ALT - - - 85 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AST - - - 51 - - - - - @@ -1003,173 +1148,26 @@ Laboratory Results & Results - - - - - - - - - - - - LD + + + Ampicillin - - 191 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fluid Neutrophils - - - Results unavailable due to laboratory error. - - - - - - - - - - - - - - - - - - - - Fluid Lymphocytes - - - Results unavailable due to laboratory error. - - - - - - - - - - - - - - - - - - - - Fluid Monocytes + Macrophages - - - Results unavailable due to laboratory error. - - - - - - - - - - - - - - - - - - - - Fluid Mesothelial Cells - - - Results unavailable due to laboratory error. + + R - @@ -1181,58 +1179,21 @@ Laboratory Results & Results - - - - - - - - - - - MICRO3 - - - - - - - - - - - - - - - Specimen Source + + Cephalexin - - Bone Chip -bone Lt metatarsal + + S - + + + + + + + + + + + CHEM2/MICRO3 + + + + + + + + + + + + + - - - Ceftazidime + + + Colour - - R + + YELLOW - @@ -1644,23 +1618,22 @@ Imipenem : Further report to follow - - - Trimethoprim-Sulfa + + + Appearance - - S + + CLEAR - @@ -1676,23 +1649,22 @@ Imipenem : Further report to follow - - - Ciprofloxacin + + + pH - - S + + 7.5 - @@ -1702,29 +1674,35 @@ Imipenem : Further report to follow + + + + 5.0...8.5 + 5.0...8.5 + + - - - Gentamicin + + + Specific Gravity - - S + + 1.010 - @@ -1734,29 +1712,35 @@ Imipenem : Further report to follow + + + + 1.003...1.035 + 1.003...1.035 + + - - - Tetracycline + + + Protein - - R + + <0.3 g/L - @@ -1766,29 +1750,35 @@ Imipenem : Further report to follow + + + + ...0.3 + ...0.3 + + - - - Culture + + + Glucose - - Escherichia coli + + <6 mmol/L - @@ -1798,29 +1788,35 @@ Imipenem : Further report to follow + + + + ...6 + ...6 + + - - - Ampicillin + + + Ketones - - R + + <1.5 mmol/L - @@ -1830,29 +1826,35 @@ Imipenem : Further report to follow + + + + ...1.5 + ...1.5 + + - - - Cephalexin + + + Hemoglobin - - S + + NEG - @@ -1862,29 +1864,35 @@ Imipenem : Further report to follow + + + + Neg + Neg + + - - - Cefazolin + + + Nitrite - - S + + NEG - @@ -1894,29 +1902,35 @@ Imipenem : Further report to follow + + + + Neg + Neg + + - - - Trimethoprim-Sulfa + + + Leukocytes - - R - + + +2 + - @@ -1926,29 +1940,44 @@ Imipenem : Further report to follow + + + + Neg + Neg + + + + + + + + + + + - - - Ciprofloxacin + + + Report Status - - S + + Final - @@ -1964,23 +1993,23 @@ Imipenem : Further report to follow - - - Gentamicin + + + Organism 1 - - S + + ESCHERICHIA COLI\.Zt\OVER 100 M CFU/L + - @@ -1996,23 +2025,22 @@ Imipenem : Further report to follow - - - Culture + + + Ampicillin - - Klebsiella oxytoca + + R - @@ -2028,23 +2056,22 @@ Imipenem : Further report to follow - - - Ampicillin + + + Cephalothin-Cephalexin - - R + + S - @@ -2060,23 +2087,22 @@ Imipenem : Further report to follow - - - Cephalexin + + + Trimethoprim-Sulfa - + S - @@ -2092,23 +2118,22 @@ Imipenem : Further report to follow - - - Cefazolin + + + Ciprofloxacin - + S - @@ -2124,23 +2149,22 @@ Imipenem : Further report to follow - - - Trimethoprim-Sulfa + + + Gentamicin - + S - @@ -2156,23 +2180,22 @@ Imipenem : Further report to follow - - - Ciprofloxacin + + + Tetracycline - + S - @@ -2188,23 +2211,22 @@ Imipenem : Further report to follow - - - Gentamicin + + + Nitrofurantoin - + S - @@ -2238,7 +2260,7 @@ Medications and Prescriptions - Medication List - + @@ -2252,15 +2274,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2274,7 +2315,6 @@ Medications and Prescriptions - Medication List - @@ -2297,7 +2337,7 @@ Medications and Prescriptions - Medication List - + @@ -2310,7 +2350,7 @@ Medications and Prescriptions - Medication List - + @@ -2342,7 +2382,7 @@ Medications and Prescriptions - Medication List - + @@ -2356,15 +2396,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2378,7 +2437,6 @@ Medications and Prescriptions - Medication List - @@ -2401,7 +2459,7 @@ Medications and Prescriptions - Medication List - + @@ -2414,7 +2472,7 @@ Medications and Prescriptions - Medication List - + @@ -2446,7 +2504,7 @@ Medications and Prescriptions - Medication List - + @@ -2460,15 +2518,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2482,7 +2559,6 @@ Medications and Prescriptions - Medication List - @@ -2505,7 +2581,7 @@ Medications and Prescriptions - Medication List - + @@ -2518,7 +2594,7 @@ Medications and Prescriptions - Medication List - + @@ -2550,7 +2626,7 @@ Medications and Prescriptions - Medication List - + @@ -2564,15 +2640,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2586,7 +2681,6 @@ Medications and Prescriptions - Medication List - @@ -2609,7 +2703,7 @@ Medications and Prescriptions - Medication List - + @@ -2622,7 +2716,7 @@ Medications and Prescriptions - Medication List - + @@ -2654,7 +2748,7 @@ Medications and Prescriptions - Medication List - + @@ -2668,15 +2762,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2690,7 +2803,6 @@ Medications and Prescriptions - Medication List - @@ -2713,7 +2825,7 @@ Medications and Prescriptions - Medication List - + @@ -2726,7 +2838,7 @@ Medications and Prescriptions - Medication List - + @@ -2758,7 +2870,7 @@ Medications and Prescriptions - Medication List - + @@ -2772,8 +2884,27 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + @@ -2794,7 +2925,6 @@ Medications and Prescriptions - Medication List - @@ -2817,7 +2947,7 @@ Medications and Prescriptions - Medication List - + @@ -2830,7 +2960,7 @@ Medications and Prescriptions - Medication List - + @@ -2862,7 +2992,7 @@ Medications and Prescriptions - Medication List - + @@ -2876,15 +3006,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -2898,7 +3047,6 @@ Medications and Prescriptions - Medication List - @@ -2921,7 +3069,7 @@ Medications and Prescriptions - Medication List - + @@ -2934,7 +3082,7 @@ Medications and Prescriptions - Medication List - + @@ -2966,7 +3114,7 @@ Medications and Prescriptions - Medication List - + @@ -2980,15 +3128,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -3002,7 +3169,6 @@ Medications and Prescriptions - Medication List - @@ -3025,7 +3191,7 @@ Medications and Prescriptions - Medication List - + @@ -3038,7 +3204,7 @@ Medications and Prescriptions - Medication List - + @@ -3070,7 +3236,7 @@ Medications and Prescriptions - Medication List - + @@ -3084,15 +3250,34 @@ Medications and Prescriptions - Medication List - - + + + + + + + + Usual/long-term medication + + + + + + + + + + + + - + @@ -3106,7 +3291,6 @@ Medications and Prescriptions - Medication List - @@ -3129,7 +3313,7 @@ Medications and Prescriptions - Medication List - + @@ -3142,7 +3326,7 @@ Medications and Prescriptions - Medication List - + @@ -3170,7 +3354,7 @@ Medications and Prescriptions - Medication List - - + @@ -3208,8 +3391,16 @@ codeSystemName="ICD-9" displayName="HEART FAILURE*"/> doe - + + + + + + + + @@ -3217,8 +3408,7 @@ codeSystemName="ICD-9" displayName="HEART FAILURE*"/> - + @@ -3239,8 +3429,16 @@ codeSystemName="ICD-9" displayName="ESSENTIAL HYPERTENSION*"/> doe - + + + + + + + + @@ -3248,8 +3446,7 @@ codeSystemName="ICD-9" displayName="ESSENTIAL HYPERTENSION*"/> - + @@ -3270,8 +3467,16 @@ codeSystemName="ICD-9" displayName="DIABETES MELLITUS*"/> doe - + + + + + + + + @@ -3279,8 +3484,7 @@ codeSystemName="ICD-9" displayName="DIABETES MELLITUS*"/> - + @@ -3301,12 +3505,33 @@ codeSystemName="ICD-9" displayName="CHRONIC BRONCHITIS*"/> doe - + + + + + + + + + + +
+ + + Risk Factors [without entries] + No Risk Factors +
+
- \ No newline at end of file + From ab2cde1ce5471a6e68e7e279d7ce92bc0fe54f46 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 2 Jul 2013 12:33:35 -0700 Subject: [PATCH 042/205] Update hqmf-parser dependency Signed-off-by: Jeremy Ho --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b4ee721..fa84ae9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,10 +23,10 @@ GIT GIT remote: http://github.com/scoophealth/hqmf-parser.git - revision: 4554b0df14abf86226547f5ea3ef201739082212 + revision: ef279cb3f14823ca89316877b0c62a8817cc857c branch: scoop-develop specs: - hqmf-parser (0.0.1) + hqmf-parser (1.1.0) google-spreadsheet-ruby (= 0.1.8) roo (= 1.10.1) rubyzip @@ -143,9 +143,9 @@ GEM multipart-post (1.2.0) nokogiri (1.5.10) oauth (0.4.7) - oauth2 (0.9.1) + oauth2 (0.9.2) faraday (~> 0.8) - httpauth (~> 0.1) + httpauth (~> 0.2) jwt (~> 0.1.4) multi_json (~> 1.0) multi_xml (~> 0.5) From 07073c85d5b2a2d51adcb58bbfe3ce202cbb1e44 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 2 Jul 2013 13:42:15 -0700 Subject: [PATCH 043/205] Mod so unit tests don't run when using rake db:seed, etc. --- lib/tasks/patient_console.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/patient_console.rake b/lib/tasks/patient_console.rake index 3659cb2..ae92db5 100644 --- a/lib/tasks/patient_console.rake +++ b/lib/tasks/patient_console.rake @@ -1,6 +1,6 @@ require 'patient_console' require 'bundler/setup' -require 'test/unit' +require 'test/unit/testcase' require 'tilt' require 'coffee_script' require 'sprockets' @@ -14,4 +14,4 @@ namespace :patient do PatientConsole.run end -end \ No newline at end of file +end From 1c3091a91c5f0e42db1e973f9c0fe10baebbff45 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Wed, 3 Jul 2013 11:07:11 -0700 Subject: [PATCH 044/205] Reverted to v1.0.0 of patientapi to avoid change from codeSystem to code_system in json --- Gemfile | 6 +++--- Gemfile.lock | 20 ++++++++++--------- .../importer/procedure_importer_api_test.rb | 2 +- .../importer/results_importer_api_test.rb | 2 +- .../importer/vitals_importer_api_test.rb | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 37151fc..8c92918 100644 --- a/Gemfile +++ b/Gemfile @@ -13,12 +13,12 @@ end gem 'daemons' gem 'jquery-rails' -gem 'mongoid', '~> 2.0' +gem 'mongoid' #, '2.4.2' gem 'bson_ext', '~> 1.3', :platforms => :mri -gem 'delayed_job_mongoid', '~> 1.0.8' +gem 'delayed_job_mongoid' #, '~> 1.0.8' -gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git'#, :tag => 'V0.3' +gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'develop-preMongoid3' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' diff --git a/Gemfile.lock b/Gemfile.lock index fa84ae9..27f04f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,9 +34,10 @@ GIT GIT remote: http://github.com/scoophealth/patientapi.git - revision: 2ead21dc2040485e4625a7d3245ef656e50db7e3 + revision: 779b4d707fb7b325c81be2a9713ee073f7d84375 + tag: v1.0.0 specs: - hquery-patient-api (0.1.0) + hquery-patient-api (1.0.0) GEM remote: https://rubygems.org/ @@ -74,7 +75,7 @@ GEM bson (1.6.0) bson_ext (1.6.0) bson (= 1.6.0) - builder (3.0.0) + builder (3.0.4) choice (0.1.6) coderay (1.0.9) coffee-rails (3.2.2) @@ -92,8 +93,9 @@ GEM daemons (1.1.9) delayed_job (3.0.5) activesupport (~> 3.0) - delayed_job_mongoid (1.0.8) - delayed_job (~> 3.0.0) + delayed_job_mongoid (1.1.0) + delayed_job (~> 3.0) + mongo (~> 1.6) mongoid (>= 2.0) erubis (2.7.0) execjs (1.4.0) @@ -134,9 +136,9 @@ GEM metaclass (~> 0.0.1) mongo (1.6.0) bson (= 1.6.0) - mongoid (2.4.12) + mongoid (2.4.10) activemodel (~> 3.1) - mongo (<= 1.6.2) + mongo (~> 1.3) tzinfo (~> 0.3.22) multi_json (1.7.7) multi_xml (0.5.4) @@ -233,7 +235,7 @@ DEPENDENCIES coffee-rails cover_me (>= 1.0.0.rc6) daemons - delayed_job_mongoid (~> 1.0.8) + delayed_job_mongoid factory_girl health-data-standards! hqmf-parser! @@ -244,7 +246,7 @@ DEPENDENCIES kramdown minitest (< 5.0.0) mocha - mongoid (~> 2.0) + mongoid pry rails (~> 3.2.1) sass-rails diff --git a/test/integration/importer/procedure_importer_api_test.rb b/test/integration/importer/procedure_importer_api_test.rb index ee9dbcc..6750161 100644 --- a/test/integration/importer/procedure_importer_api_test.rb +++ b/test/integration/importer/procedure_importer_api_test.rb @@ -4,7 +4,7 @@ class ProcedureImporterApiTest < ImporterApiTest def test_procedure_importing assert_equal '52734007', @context.eval('patient.procedures()[0].type()[0].code()') assert_equal 'SNOMED-CT', @context.eval('patient.procedures()[0].type()[0].codeSystemName()') - assert_not_equal nil, @context.eval('patient.procedures()[0].performer()') + assert_equal nil, @context.eval('patient.procedures()[0].performer()') assert_equal '1234567', @context.eval('patient.procedures()[0].site().code()') assert_equal 'SNOMED-CT', @context.eval('patient.procedures()[0].site().codeSystemName()') end diff --git a/test/integration/importer/results_importer_api_test.rb b/test/integration/importer/results_importer_api_test.rb index cd3d7f9..71a90a3 100644 --- a/test/integration/importer/results_importer_api_test.rb +++ b/test/integration/importer/results_importer_api_test.rb @@ -6,7 +6,7 @@ def test_results_importing assert_equal 'LOINC', @context.eval('patient.results()[0].type()[0].codeSystemName()') assert_equal 'N', @context.eval('patient.results()[0].interpretation().code()') assert_equal 'HITSP C80 Observation Status', @context.eval('patient.results()[0].interpretation().codeSystemName()') - assert_equal '13.2', @context.eval('patient.results()[0].values()[0].scalar()') + assert_equal 13.2, @context.eval('patient.results()[0].values()[0].scalar()') assert_equal 'g/dl', @context.eval('patient.results()[0].values()[0].units()') assert_equal 2000, @context.eval('patient.results()[0].date().getUTCFullYear()') assert_equal 2, @context.eval('patient.results()[0].date().getUTCMonth()') diff --git a/test/integration/importer/vitals_importer_api_test.rb b/test/integration/importer/vitals_importer_api_test.rb index 1be3a98..8faf991 100644 --- a/test/integration/importer/vitals_importer_api_test.rb +++ b/test/integration/importer/vitals_importer_api_test.rb @@ -6,7 +6,7 @@ def test_vitals_importing assert @context.eval('patient.vitalSigns().match({"SNOMED-CT": ["50373000"]}).length != 0') assert_equal 'N', @context.eval('patient.vitalSigns()[0].interpretation().code()') assert_equal 'HITSP C80 Observation Status', @context.eval('patient.vitalSigns()[0].interpretation().codeSystemName()') - assert_equal '177', @context.eval('patient.vitalSigns()[0].values()[0].scalar()') + assert_equal 177, @context.eval('patient.vitalSigns()[0].values()[0].scalar()') assert_equal 'cm', @context.eval('patient.vitalSigns()[0].values()[0].units()') assert_equal 1999, @context.eval('patient.vitalSigns()[0].date().getUTCFullYear()') assert_equal 10, @context.eval('patient.vitalSigns()[0].date().getUTCMonth()') From 3e85b25e9a29ff4acd7d8bf547cce27e75e2a260 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 4 Jul 2013 16:27:42 -0700 Subject: [PATCH 045/205] Branch for work on mongoid3 migration --- Gemfile | 5 +- Gemfile.lock | 109 ++-- Gemfile.lock.bckup | 253 +++++++++ Marshal.4.8 | Bin 0 -> 45 bytes Marshal.4.8.Z | Bin 0 -> 53 bytes config/mongoid.yml | 95 +++- config/mongoid.yml.bckup | 21 + db/seeds.rb | 3 +- error.txt | 630 +++++++++++++++++++++ latest_specs.4.8 | Bin 0 -> 4 bytes latest_specs.4.8.gz | Bin 0 -> 24 bytes lib/job_stats.rb | 4 +- lib/mongo_query_executor.rb | 6 +- lib/patient_console.rb | 6 +- lib/query_job.rb | 5 +- lib/query_utilities.rb | 2 +- prerelease_specs.4.8 | Bin 0 -> 4 bytes prerelease_specs.4.8.gz | Bin 0 -> 24 bytes specs.4.8 | Bin 0 -> 4 bytes specs.4.8.gz | Bin 0 -> 24 bytes test/functional/pmn_controller_test.rb | 3 +- test/functional/records_controller_test.rb | 8 +- test/test_helper.rb | 22 +- test/unit/query_executor_test.rb | 5 +- test/unit/query_job_test.rb | 10 +- test/unit/query_utilities_test.rb | 2 +- 26 files changed, 1089 insertions(+), 100 deletions(-) create mode 100644 Gemfile.lock.bckup create mode 100644 Marshal.4.8 create mode 100644 Marshal.4.8.Z create mode 100644 config/mongoid.yml.bckup create mode 100644 error.txt create mode 100644 latest_specs.4.8 create mode 100644 latest_specs.4.8.gz create mode 100644 prerelease_specs.4.8 create mode 100644 prerelease_specs.4.8.gz create mode 100644 specs.4.8 create mode 100644 specs.4.8.gz diff --git a/Gemfile b/Gemfile index 8c92918..a62565e 100644 --- a/Gemfile +++ b/Gemfile @@ -14,12 +14,13 @@ gem 'daemons' gem 'jquery-rails' gem 'mongoid' #, '2.4.2' -gem 'bson_ext', '~> 1.3', :platforms => :mri +#gem 'bson_ext', '~> 1.3', :platforms => :mri +gem 'delayed_job' gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'develop-preMongoid3' +gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :tag => 'fda23ee8678cfda314412e3e18815653bbcffb63' #, :branch => 'develop-preMongoid3' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index 27f04f5..8b4e4b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,16 +10,16 @@ GIT tilt (~> 1.3.3) GIT - remote: http://github.com/scoophealth/health-data-standards.git - revision: 1407eed0e3659c8424ccf5fa753178b3a7b59f77 - branch: develop-preMongoid3 + remote: http://github.com/projectcypress/health-data-standards.git + revision: fda23ee8678cfda314412e3e18815653bbcffb63 + tag: fda23ee8678cfda314412e3e18815653bbcffb63 specs: - health-data-standards (1.0.1) + health-data-standards (2.0.0) builder (~> 3.0.0) - erubis (~> 2.6) - mongoid (~> 2.4.2) - nokogiri (>= 1.4.4) - uuid (~> 2.3.4) + erubis (~> 2.7.0) + mongoid (~> 3.0.6) + nokogiri (~> 1.5.5) + uuid (~> 2.3.5) GIT remote: http://github.com/scoophealth/hqmf-parser.git @@ -42,39 +42,36 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.2) - actionpack (= 3.2.2) - mail (~> 2.4.0) - actionpack (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) + actionmailer (3.2.8) + actionpack (= 3.2.8) + mail (~> 2.4.4) + actionpack (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) builder (~> 3.0.0) erubis (~> 2.7.0) - journey (~> 1.0.1) + journey (~> 1.0.4) rack (~> 1.4.0) - rack-cache (~> 1.1) + rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.2) - activesupport (= 3.2.2) + sprockets (~> 2.1.3) + activemodel (3.2.8) + activesupport (= 3.2.8) builder (~> 3.0.0) - activerecord (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) + activerecord (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) + activeresource (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + activesupport (3.2.8) i18n (~> 0.6) multi_json (~> 1.0) ansi (1.4.3) arel (3.0.2) - awesome_print (1.0.2) - bson (1.6.0) - bson_ext (1.6.0) - bson (= 1.6.0) + awesome_print (1.1.0) builder (3.0.4) choice (0.1.6) coderay (1.0.9) @@ -93,10 +90,9 @@ GEM daemons (1.1.9) delayed_job (3.0.5) activesupport (~> 3.0) - delayed_job_mongoid (1.1.0) + delayed_job_mongoid (2.0.0) delayed_job (~> 3.0) - mongo (~> 1.6) - mongoid (>= 2.0) + mongoid (~> 3.0) erubis (2.7.0) execjs (1.4.0) multi_json (~> 1.0) @@ -119,7 +115,7 @@ GEM json (1.8.0) jwt (0.1.8) multi_json (>= 1.5) - kramdown (1.0.2) + kramdown (1.1.0) libv8 (3.11.8.17) log4r (1.1.10) macaddr (1.6.1) @@ -134,12 +130,12 @@ GEM minitest (4.7.5) mocha (0.14.0) metaclass (~> 0.0.1) - mongo (1.6.0) - bson (= 1.6.0) - mongoid (2.4.10) + mongoid (3.0.23) activemodel (~> 3.1) - mongo (~> 1.3) + moped (~> 1.2) + origin (~> 1.0) tzinfo (~> 0.3.22) + moped (1.5.0) multi_json (1.7.7) multi_xml (0.5.4) multipart-post (1.2.0) @@ -152,29 +148,30 @@ GEM multi_json (~> 1.0) multi_xml (~> 0.5) rack (~> 1.2) + origin (1.1.0) polyglot (0.3.3) - pry (0.9.8.2) + pry (0.9.12.2) coderay (~> 1.0.5) - method_source (~> 0.7) - slop (>= 2.4.4) - rack (1.4.1) + method_source (~> 0.8) + slop (~> 3.4) + rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.2) + rack-ssl (1.3.3) rack - rack-test (0.6.1) + rack-test (0.6.2) rack (>= 1.0) - rails (3.2.2) - actionmailer (= 3.2.2) - actionpack (= 3.2.2) - activerecord (= 3.2.2) - activeresource (= 3.2.2) - activesupport (= 3.2.2) + rails (3.2.8) + actionmailer (= 3.2.8) + actionpack (= 3.2.8) + activerecord (= 3.2.8) + activeresource (= 3.2.8) + activesupport (= 3.2.8) bundler (~> 1.0) - railties (= 3.2.2) - railties (3.2.2) - actionpack (= 3.2.2) - activesupport (= 3.2.2) + railties (= 3.2.8) + railties (3.2.8) + actionpack (= 3.2.8) + activesupport (= 3.2.8) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -220,7 +217,7 @@ GEM tzinfo (0.3.37) uglifier (2.1.1) execjs (>= 0.3.0) - multi_json (>= 1.0.2) + multi_json (~> 1.0, >= 1.0.2) uuid (2.3.7) macaddr (~> 1.0) yamler (0.1.0) @@ -230,11 +227,11 @@ PLATFORMS DEPENDENCIES awesome_print - bson_ext (~> 1.3) coderay coffee-rails cover_me (>= 1.0.0.rc6) daemons + delayed_job delayed_job_mongoid factory_girl health-data-standards! diff --git a/Gemfile.lock.bckup b/Gemfile.lock.bckup new file mode 100644 index 0000000..f8d49d5 --- /dev/null +++ b/Gemfile.lock.bckup @@ -0,0 +1,253 @@ +GIT + remote: http://github.com/hquery/hqmf2js.git + revision: cc1936810085fa43542c351e92765677976cfd1f + tag: V0.3 + specs: + hqmf2js (0.1.0) + coffee-script (~> 2.2.0) + nokogiri (~> 1.5.2) + sprockets (~> 2.1.2) + tilt (~> 1.3.3) + +GIT + remote: http://github.com/projectcypress/health-data-standards.git + revision: fda23ee8678cfda314412e3e18815653bbcffb63 + tag: fda23ee8678cfda314412e3e18815653bbcffb63 + specs: + health-data-standards (2.0.0) + builder (~> 3.0.0) + erubis (~> 2.7.0) + mongoid (~> 3.0.6) + nokogiri (~> 1.5.5) + uuid (~> 2.3.5) + +GIT + remote: http://github.com/scoophealth/hqmf-parser.git + revision: ef279cb3f14823ca89316877b0c62a8817cc857c + branch: scoop-develop + specs: + hqmf-parser (1.1.0) + google-spreadsheet-ruby (= 0.1.8) + roo (= 1.10.1) + rubyzip + spreadsheet (= 0.6.8) + +GIT + remote: http://github.com/scoophealth/patientapi.git + revision: 779b4d707fb7b325c81be2a9713ee073f7d84375 + tag: v1.0.0 + specs: + hquery-patient-api (1.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.2) + actionpack (= 3.2.2) + mail (~> 2.4.0) + actionpack (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.1) + rack-test (~> 0.6.1) + sprockets (~> 2.1.2) + activemodel (3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + activerecord (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + activesupport (3.2.2) + i18n (~> 0.6) + multi_json (~> 1.0) + ansi (1.4.3) + arel (3.0.2) + awesome_print (1.0.2) + builder (3.0.4) + choice (0.1.6) + coderay (1.0.9) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.2) + configatron (2.13.0) + yamler (>= 0.1.0) + cover_me (1.2.0) + configatron + hashie + daemons (1.1.9) + delayed_job (3.0.5) + activesupport (~> 3.0) + delayed_job_mongoid (2.0.0) + delayed_job (~> 3.0) + mongoid (~> 3.0) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + factory_girl (4.2.0) + activesupport (>= 3.0.0) + faraday (0.8.7) + multipart-post (~> 1.1) + google-spreadsheet-ruby (0.1.8) + nokogiri (>= 1.4.3.1) + oauth (>= 0.3.6) + oauth2 (>= 0.5.0) + hashie (2.0.5) + hike (1.2.3) + httpauth (0.2.0) + i18n (0.6.4) + journey (1.0.4) + jquery-rails (3.0.1) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.8.0) + jwt (0.1.8) + multi_json (>= 1.5) + kramdown (1.0.2) + libv8 (3.11.8.17) + log4r (1.1.10) + macaddr (1.6.1) + systemu (~> 2.5.0) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.1) + method_source (0.8.1) + mime-types (1.23) + minitest (4.7.5) + mocha (0.14.0) + metaclass (~> 0.0.1) + mongoid (3.0.23) + activemodel (~> 3.1) + moped (~> 1.2) + origin (~> 1.0) + tzinfo (~> 0.3.22) + moped (1.5.0) + multi_json (1.7.7) + multi_xml (0.5.4) + multipart-post (1.2.0) + nokogiri (1.5.10) + oauth (0.4.7) + oauth2 (0.9.2) + faraday (~> 0.8) + httpauth (~> 0.2) + jwt (~> 0.1.4) + multi_json (~> 1.0) + multi_xml (~> 0.5) + rack (~> 1.2) + origin (1.1.0) + polyglot (0.3.3) + pry (0.9.8.2) + coderay (~> 1.0.5) + method_source (~> 0.7) + slop (>= 2.4.4) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.2.2) + actionmailer (= 3.2.2) + actionpack (= 3.2.2) + activerecord (= 3.2.2) + activeresource (= 3.2.2) + activesupport (= 3.2.2) + bundler (~> 1.0) + railties (= 3.2.2) + railties (3.2.2) + actionpack (= 3.2.2) + activesupport (= 3.2.2) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.1.0) + rdoc (3.12.2) + json (~> 1.4) + ref (1.0.5) + roo (1.10.1) + choice (>= 0.1.4) + google-spreadsheet-ruby (>= 0.1.5) + nokogiri (>= 1.5.0) + rubyzip (>= 0.9.4) + spreadsheet (> 0.6.4) + todonotes (>= 0.1.0) + ruby-ole (1.2.11.7) + rubyzip (0.9.9) + sass (3.2.9) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + slop (3.4.5) + spreadsheet (0.6.8) + ruby-ole (>= 1.0) + sprockets (2.1.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + systemu (2.5.2) + therubyracer (0.11.4) + libv8 (~> 3.11.8.12) + ref + thor (0.18.1) + tilt (1.3.7) + todonotes (0.1.1) + log4r + treetop (1.4.14) + polyglot + polyglot (>= 0.3.1) + turn (0.9.6) + ansi + tzinfo (0.3.37) + uglifier (2.1.1) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + uuid (2.3.7) + macaddr (~> 1.0) + yamler (0.1.0) + +PLATFORMS + ruby + +DEPENDENCIES + awesome_print + coderay + coffee-rails + cover_me (>= 1.0.0.rc6) + daemons + delayed_job + delayed_job_mongoid + factory_girl + health-data-standards! + hqmf-parser! + hqmf2js! + hquery-patient-api! + jquery-rails + jruby-openssl + kramdown + minitest (< 5.0.0) + mocha + mongoid + pry + rails (~> 3.2.1) + sass-rails + therubyracer + therubyrhino + turn + uglifier diff --git a/Marshal.4.8 b/Marshal.4.8 new file mode 100644 index 0000000000000000000000000000000000000000..2e720c5e968cb2588d50f3ae7ccc72edb9d95f61 GIT binary patch literal 45 zcmZSK$hQ)8PtCQm3eGPrN>266OG&L@x8ib0Pt7f^X0YOSC@x4%j!(%fDvo9V05w+* A6951J literal 0 HcmV?d00001 diff --git a/Marshal.4.8.Z b/Marshal.4.8.Z new file mode 100644 index 0000000000000000000000000000000000000000..9e4dfa76df90b41bb19ac7e2e5075f74bfd1f3e3 GIT binary patch literal 53 zcmV-50LuS(oMYk0w-R+v&9$-$&Mz%WPW8-7Nv&YF;&Mn&%`L8Gu;O - database: query_gateway_test - -# set these environment variables on your prod server -production: - uri: <%= ENV['MONGOHQ_URL'] %> - #host: <%= ENV['MONGOID_HOST'] %> - #port: <%= ENV['MONGOID_PORT'] %> - #username: <%= ENV['MONGOID_USERNAME'] %> - #password: <%= ENV['MONGOID_PASSWORD'] %> - #database: <%= ENV['MONGOID_DATABASE'] %> - # slaves: - # - host: slave1.local - # port: 27018 - # - host: slave2.local - # port: 27019 + sessions: + default: + database: query_gateway_test + hosts: + - localhost:27017 + options: + consistency: :strong + # In the test environment we lower the retries and retry interval to + # low amounts for fast failures. + max_retries: 1 + retry_interval: 0 diff --git a/config/mongoid.yml.bckup b/config/mongoid.yml.bckup new file mode 100644 index 0000000..531058d --- /dev/null +++ b/config/mongoid.yml.bckup @@ -0,0 +1,21 @@ +development: + host: localhost + database: query_gateway_development + +test: + host: <%= ENV['TEST_DB_HOST'] || 'localhost' %> + database: query_gateway_test + +# set these environment variables on your prod server +production: + uri: <%= ENV['MONGOHQ_URL'] %> + #host: <%= ENV['MONGOID_HOST'] %> + #port: <%= ENV['MONGOID_PORT'] %> + #username: <%= ENV['MONGOID_USERNAME'] %> + #password: <%= ENV['MONGOID_PASSWORD'] %> + #database: <%= ENV['MONGOID_DATABASE'] %> + # slaves: + # - host: slave1.local + # port: 27018 + # - host: slave2.local + # port: 27019 diff --git a/db/seeds.rb b/db/seeds.rb index 95e724c..bbf45d6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,4 +5,5 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) -`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/records.json` \ No newline at end of file +#`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/records.json` +`mongoimport -d query_gateway_development --drop --collection records --file test/fixtures/records.json` \ No newline at end of file diff --git a/error.txt b/error.txt new file mode 100644 index 0000000..6aaa0e4 --- /dev/null +++ b/error.txt @@ -0,0 +1,630 @@ +WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 +WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 + SECURITY WARNING: No secret option provided to Rack::Session::Cookie. + This poses a security threat. It is strongly recommended that you + provide a secret to prevent exploits that may be possible from crafted + cookies. This will not be supported in future versions of Rack, and + future versions will even invalidate your existing user cookies. + + Called from: /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. + +Rack::File headers parameter replaces cache_control after Rack 1.5. + +*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`. + +Loaded Suite test,test/factories,test/functional,test/integration/importer,test/performance,test/unit/helpers,test/unit + +Started at 2013-07-04 16:22:38 -0700 w/ seed 58183. + +QueryExecutorTest + FAIL (0:00:00.217) execute + <213> expected but was + <0>. + @ test/unit/query_executor_test.rb:23:in `test_execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4281320697472554873__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + FAIL (0:00:01.646) handwritten hqmf execute + <269> expected but was + <0>. + @ test/unit/query_executor_test.rb:36:in `test_handwritten_hqmf_execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4281320697472554873__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +QueryJobTest + ERROR (0:00:01.865) Job executes correctly + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n emit(patient.gender(), 1);\n};\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(gender, counts) {\n var sum = 0;\n while(counts.hasNext()){\n sum += counts.next();\n }\n return sum;\n};\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/query_job_test.rb:91:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3438448412012551206__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + ERROR (0:00:02.084) Job executes correctly with function + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n function sum(values) {\n result = 0;\n values.forEach(function(value) {\n result += value;\n });\n return result;\n}\n function map(patient) {\n sum([1,1,1]);\n emit(patient.gender(), 1);\n};\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(gender, counts) {\n var sum = 0;\n while(counts.hasNext()){\n sum += counts.next();\n }\n return sum;\n};\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/query_job_test.rb:105:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3438448412012551206__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + PASS (0:00:02.306) before logs running event properly + PASS (0:00:02.448) error logs event properly + PASS (0:00:02.610) failure logs event properly + PASS (0:00:02.806) job status should report property + PASS (0:00:02.946) job submission should execute properly + PASS (0:00:03.093) success logs event properly + PASS (0:00:03.245) cancel job + +QueryTest + PASS (0:00:03.402) Can convert a JSON string into a hash + PASS (0:00:04.541) Can see if they have been updated + PASS (0:00:04.681) Still get last query update before any queries are added + +QueryUtilitesTest + ERROR (0:00:04.816) Stringification + undefined method `[]=' for Moped::BSON:Module + @ test/unit/query_utilities_test.rb:7:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1701913134296835570__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +ScoopJobTest + ERROR (0:00:05.071) iteration 0 query works properly + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var time = new Date(2013, 5, 1);\n if (patient.gender() == \"M\") {\n var age = Math.floor(patient.age(time));\n if(age >= 65) {\n emit(\"male_>65\", 1);\n }\n }\n};\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/scoop_job_test.rb:18:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + ERROR (0:00:05.323) iteration 1 query works properly + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var ageLimit = 65;\n var drugLimit = 5;\n var time = new Date(2013, 2, 10);\n\n var drugList = patient.medications();\n var currentDrugs = findCurrentDrugs(drugList, time);\n\n emit('total_population', 1);\n if (patient.age(time) > ageLimit) {\n emit('sampled_number', 1);\n\n // Adds patient to count if over ageLimit & over drugLimit\n if (currentDrugs > drugLimit) {\n emit('polypharmacy_number', 1);\n }\n }\n}\n\n// Returns count of \"active\" drugs that are between start & end date\n// Also checks for the same \"active\" drug and doesn't overcount\nfunction findCurrentDrugs(drugs, time) {\n var now = time.getTime();\n var count = 0;\n var seenDrugs = [];\n\n for(var i = 0; i < drugs.length; i++) {\n var repeat = false;\n var drugStart = drugs[i].indicateMedicationStart().getTime();\n var drugEnd = drugs[i].indicateMedicationStop().getTime();\n\n // Check if drug is within the right time\n if(drugEnd >= now && drugStart <= now) {\n // Check if this entry is a repeat of same drug (codesystem agnostic)\n var codes = drugs[i].medicationInformation().codedProduct();\n\n for (var j = 0; j < codes.length; j++) {\n var code = codes[j].code();\n\n if(seenDrugs.indexOf(code) == -1) {\n seenDrugs.push(code);\n }\n else {\n repeat = true;\n }\n }\n\n // Increment count if not a repeat\n if(!repeat) {\n count++;\n }\n }\n }\n\n return count;\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/scoop_job_test.rb:30:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + ERROR (0:00:05.530) iteration 2 query works properly + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var atcLevel = 4; // Level definition based on definition found on Wikipedia\n\n var drugClasses = findATCDrugClasses(patient.medications(), atcLevel);\n\n for(var i = 0; i < drugClasses.length; i++) {\n emit(drugClasses[i], 1);\n }\n}\n\n// Returns list of all ATC medication codes\nfunction findATCDrugClasses(drugs, level) {\n var list = [];\n var cutoff;\n\n // Define ATC cutoff levels\n switch(level) {\n case 1:\n cutoff = 1;\n break;\n case 2:\n cutoff = 3;\n break;\n case 3:\n cutoff = 4;\n break;\n case 4:\n cutoff = 5;\n break;\n /* Prevent data leakage - only want classes, not specific substance\n case 5:\n cutoff = 7;\n break;\n */\n default:\n return list;\n }\n\n for(var i = 0; i < drugs.length; i++) {\n // Get all represented codes for each drug\n var codes = drugs[i].medicationInformation().codedProduct();\n\n // Filter out only ATC codes\n for(var j = 0; j < codes.length; j++) {\n if(codes[j].codeSystemName() == \"whoATC\") {\n // Truncate to appropriate level length\n list.push(codes[j].code().substring(0, cutoff));\n }\n }\n }\n\n return list;\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/scoop_job_test.rb:44:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + ERROR (0:00:05.791) iteration 4 query works properly + The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var targetMedicationCodes = {\n \"whoATC\": [\"C01AA05\"],\n \"HC-DIN\": [\"02281236\", \"02281228\", \"02281201\", \"02245428\", \"02245427\",\n \"02245426\", \"02048264\", \"02048272\", \"0021415\", \"00698296\", \"00647470\"]\n };\n\n var targetLabCodes = {\n \"LOINC\": [\"45066-8\", \"2160-0\", \"33914-3\", \"50044-7\", \"48642-3\", \"48643-1\"]\n };\n\n var ageLimit = 65;\n\n var drugList = patient.medications();\n var resultList = patient.results();\n\n var now = new Date(2013, 5, 12);\n var start = new Date(2000, 6, 1);\n var end = addDate(now, 0, 1, 0);\n\n function addDate(date, y, m, d) {\n var n = new Date(date);\n n.setFullYear(date.getFullYear() + (y || 0));\n n.setMonth(date.getMonth() + (m || 0));\n n.setDate(date.getDate() + (d || 0));\n return n;\n }\n\n // Checks if patient is older than ageLimit\n function population(patient) {\n return (patient.age(now) >= ageLimit);\n }\n\n // Checks for Creatinine labs performed within the last year\n function hasLabCode(patient) {\n return resultList.match(targetLabCodes, addDate(now, -1, 0, 0), end).length;\n }\n\n // Checks for existence of Digoxin\n function hasMedication(patient) {\n return drugList.match(targetMedicationCodes, start, end).length;\n }\n\n function hasCurrentMedication(patient) {\n for (var i = 0; i < drugList.length; i++) {\n var tmpArray = new hQuery.CodedEntryList();\n tmpArray[0] = drugList[i];\n if (tmpArray.match(targetMedicationCodes)) {\n var drugStart = drugList[i].indicateMedicationStart().getTime();\n var drugEnd = drugList[i].indicateMedicationStop().getTime();\n\n // Check if drug is within the right time\n if (drugEnd >= now && drugStart <= now) {\n return true;\n }\n }\n }\n return false;\n }\n\n emit('total_pop', 1);\n\n if (population(patient)) {\n //emit(\"senior_pop: \" + patient.given() + \" \" + patient.last(), 1);\n emit(\"senior_pop\", 1);\n if (hasLabCode(patient)) {\n if (hasMedication(patient) && hasCurrentMedication(patient)) {\n //emit(\"Digoxin: \" + patient.given() + \" \" + patient.last(), 1);\n //emit(\"Creatinine: \" + patient.given() + \" \" + patient.last(), 1);\n var c = patient.results();\n for (var i = 0; i < c.length; i++) {\n if (c[i].interpretation().code() == \"A\") {\n //emit(\"Abnormal Creatinine: \" + patient.given() + \" \" + patient.last(), 1);\n emit(\"senior_pop_digoxin_creatinine_abnormal\", 1);\n }\n }\n }\n }\n }\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} + @fields=nil> + failed with error "ns doesn't exist" + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' + lib/mongo_query_executor.rb:26:in `execute' + lib/query_job.rb:8:in `perform' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' + test/unit/scoop_job_test.rb:72:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +Finished in 5.794980 seconds. + +19 tests, 10 passed, 2 failures, 7 errors, 0 skips, 24 assertions + +WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 + SECURITY WARNING: No secret option provided to Rack::Session::Cookie. + This poses a security threat. It is strongly recommended that you + provide a secret to prevent exploits that may be possible from crafted + cookies. This will not be supported in future versions of Rack, and + future versions will even invalidate your existing user cookies. + + Called from: /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. + +Rack::File headers parameter replaces cache_control after Rack 1.5. + +*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`. + +Loaded Suite test,test/factories,test/functional,test/integration/importer,test/performance,test/unit/helpers,test/unit + +Started at 2013-07-04 16:22:50 -0700 w/ seed 50754. + +HdataControllerTest + PASS (0:00:00.222) should get and atom feed at index, if desired + PASS (0:00:00.375) should get index + PASS (0:00:00.528) should get root + +PmnControllerTest + PASS (0:00:00.899) should create a new PMN request with native JS + +QueriesControllerTest + PASS (0:00:02.315) HQMF form upload processing + PASS (0:00:03.284) POST should add a new job from HQMF + PASS (0:00:03.463) POST should add a new job with filter and functions + + PASS (0:00:03.612) POST should add a new job without filter or functions + PASS (0:00:03.753) should get a form at new + PASS (0:00:03.906) should get an atom feed at index + PASS (0:00:04.104) should reject jobs without a reduce function + ERROR (0:00:04.245) should show JSON for a successful job + No route matches {:action=>"show", :controller=>"results", :id=>nil} + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:532:in `raise_routing_error' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:528:in `rescue in generate' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:520:in `generate' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:561:in `generate' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:586:in `url_for' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/url_for.rb:148:in `url_for' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:213:in `result_url' + app/controllers/queries_controller.rb:52:in `show' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1211291760765731366__process_action__2935680412871421367__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:469:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:49:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:386:in `get' + test/functional/queries_controller_test.rb:62:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:458:in `_run__982015856664391190__setup__1198230082574878696__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +RecordsControllerTest + PASS (0:00:04.451) should POST a C32 to create + ERROR (0:00:04.585) should POST a E2E to create + uninitialized constant HealthDataStandards::Import::E2E + @ app/controllers/records_controller.rb:13:in `create' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__274140934617978993__process_action__2119836349403840075__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:469:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:49:in `process' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:391:in `post' + test/functional/records_controller_test.rb:22:in `block in ' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:458:in `_run__1920726951506855142__setup__1198230082574878696__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +ResultsControllerTest + PASS (0:00:04.791) should get an atom feed at index + PASS (0:00:05.043) should get an individual result + +Finished in 5.043800 seconds. + +16 tests, 14 passed, 0 failures, 2 errors, 0 skips, 72 assertions + +WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 + SECURITY WARNING: No secret option provided to Rack::Session::Cookie. + This poses a security threat. It is strongly recommended that you + provide a secret to prevent exploits that may be possible from crafted + cookies. This will not be supported in future versions of Rack, and + future versions will even invalidate your existing user cookies. + + Called from: /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. + +Rack::File headers parameter replaces cache_control after Rack 1.5. + +*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`. + +Loaded Suite test,test/factories,test/functional,test/integration/importer,test/performance,test/unit/helpers,test/unit + +Started at 2013-07-04 16:23:00 -0700 w/ seed 32834. + +DemographicsImporterApiTest + FAIL (0:00:00.411) demographics importing + <"FirstName"> expected but was + <"ELIZABETH">. + @ test/integration/importer/demographics_importer_api_test.rb:5:in `test_demographics_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__431334645960705777__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +EncounterImporterApiTest + FAIL (0:00:00.797) encounter importing + <1> expected but was + <0>. + @ test/integration/importer/encounter_importer_api_test.rb:5:in `test_encounter_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4579578112627754533__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +ImmunizationsImporterApiTest + FAIL (0:00:01.165) imunizations importing + <4> expected but was + <0>. + @ test/integration/importer/immunizations_importer_api_test.rb:5:in `test_imunizations_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__3679144445520351986__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +MedicationsImporterApiTest + FAIL (0:00:01.515) medications importing + Failed assertion, no message given. + @ test/integration/importer/medications_importer_api_test.rb:5:in `test_medications_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__3685490420293127251__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +ProcedureImporterApiTest + ERROR (0:00:01.861) procedure importing + TypeError: Cannot call method 'type' of undefined + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:34:in `rescue in block in eval' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:28:in `block in eval' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `Locker' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `lock' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:27:in `eval' + test/integration/importer/procedure_importer_api_test.rb:5:in `test_procedure_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1825310941018774747__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +ResultsImporterApiTest + ERROR (0:00:02.229) results importing + TypeError: Cannot call method 'type' of undefined + @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:34:in `rescue in block in eval' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:28:in `block in eval' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `call' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `Locker' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `lock' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:27:in `eval' + test/integration/importer/results_importer_api_test.rb:5:in `test_results_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1113957463528310751__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +VitalsImporterApiTest + FAIL (0:00:02.578) vitals importing + Failed assertion, no message given. + @ test/integration/importer/vitals_importer_api_test.rb:5:in `test_vitals_importing' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__485554421318113745__setup__469520946808616379__callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' + /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' + + +Finished in 2.579911 seconds. + +7 tests, 0 passed, 5 failures, 2 errors, 0 skips, 5 assertions + +Errors running test:units! # +Errors running test:functionals! # +Errors running test:integration! # diff --git a/latest_specs.4.8 b/latest_specs.4.8 new file mode 100644 index 0000000000000000000000000000000000000000..0ba94359df472e358cfe3fa92192fc82832db5b6 GIT binary patch literal 4 LcmZSKh-Lr)0O9~> literal 0 HcmV?d00001 diff --git a/latest_specs.4.8.gz b/latest_specs.4.8.gz new file mode 100644 index 0000000000000000000000000000000000000000..a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8 GIT binary patch literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ literal 0 HcmV?d00001 diff --git a/lib/job_stats.rb b/lib/job_stats.rb index 52dcdea..bd8ad82 100644 --- a/lib/job_stats.rb +++ b/lib/job_stats.rb @@ -30,12 +30,14 @@ class JobStats def self.stats # check to see if we have a working connection to mongo begin - Mongoid.master.stats + #Mongoid.master.stats + Mongoid.default_session.stats rescue return {error: "Backend Down"} end s = {backend_status: :good} + #result = Query.collection().map_reduce(MAP, REDUCE, {out: {inline: 1}, raw: true}) result = Query.collection().map_reduce(MAP, REDUCE, {out: {inline: 1}, raw: true}) result["results"].each do |res| type = res["_id"] diff --git a/lib/mongo_query_executor.rb b/lib/mongo_query_executor.rb index 1f83bba..4fbdf0f 100644 --- a/lib/mongo_query_executor.rb +++ b/lib/mongo_query_executor.rb @@ -18,10 +18,12 @@ def initialize(format, map_js, reduce_js, functions_js, query_id, filter={}) end def execute - db = Mongoid.master + #db = Mongoid.master + db = Mongoid.default_session #.options[:database] exts = [] exts << @functions_js - results = db[PATIENTS_COLLECTION].map_reduce(build_map_function(exts), build_reduce_function(), :query => @filter, raw: true, out: {inline: 1}) + #results = db[PATIENTS_COLLECTION].map_reduce(build_map_function(exts), build_reduce_function(), :query => @filter, raw: true, out: {inline: 1}) + results = Result.where(@filter).map_reduce(build_map_function(exts), build_reduce_function()).out(inline: true).raw() result = {} results['results'].each do |rv| key = QueryUtilities.stringify_key(rv['_id']) diff --git a/lib/patient_console.rb b/lib/patient_console.rb index d1bf882..be9a841 100644 --- a/lib/patient_console.rb +++ b/lib/patient_console.rb @@ -48,7 +48,8 @@ def self.run next end query = JSON.parse(parts[1..parts.length].join(' ')) - db = Mongoid.master + #db = Mongoid.master + db = Mongoid.default_session @@patients = [] @@ -81,7 +82,8 @@ def self.load_patient(index) def self.init @@patient_index = 0 - db = Mongoid.master + #db = Mongoid.master + db = Mongoid.default_session patient_api = QueryExecutor.patient_api_javascript.to_s @@patients = [] db['records'].find().each {|p| @@patients << p} diff --git a/lib/query_job.rb b/lib/query_job.rb index 6437656..2376d27 100644 --- a/lib/query_job.rb +++ b/lib/query_job.rb @@ -1,4 +1,4 @@ -require 'mongo' +#require 'mongo' class QueryJob < Struct.new(:format, :map, :reduce,:functions, :filter, :query_id) @@ -47,7 +47,8 @@ def self.submit(format, map, reduce, functions, filter = {}, query_id) end def self.find_job(job_id) - Delayed::Job.find(BSON::ObjectId.from_string(job_id)) + #Delayed::Job.find(Moped::BSON::ObjectId.from_string(job_id)) + Delayed::Job.find(Moped::BSON::ObjectId(job_id)) end def self.cancel_job(job_id) diff --git a/lib/query_utilities.rb b/lib/query_utilities.rb index 20b71a6..964a142 100644 --- a/lib/query_utilities.rb +++ b/lib/query_utilities.rb @@ -4,7 +4,7 @@ module QueryUtilities require 'tilt' def self.stringify_key(key) - if (key.is_a? BSON::OrderedHash) + if (key.is_a? Moped::BSON) #::OrderedHash) key = (key.map {|val| stringify_key(val)}).join('_') end if (key.is_a? Array) diff --git a/prerelease_specs.4.8 b/prerelease_specs.4.8 new file mode 100644 index 0000000000000000000000000000000000000000..0ba94359df472e358cfe3fa92192fc82832db5b6 GIT binary patch literal 4 LcmZSKh-Lr)0O9~> literal 0 HcmV?d00001 diff --git a/prerelease_specs.4.8.gz b/prerelease_specs.4.8.gz new file mode 100644 index 0000000000000000000000000000000000000000..a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8 GIT binary patch literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ literal 0 HcmV?d00001 diff --git a/specs.4.8 b/specs.4.8 new file mode 100644 index 0000000000000000000000000000000000000000..0ba94359df472e358cfe3fa92192fc82832db5b6 GIT binary patch literal 4 LcmZSKh-Lr)0O9~> literal 0 HcmV?d00001 diff --git a/specs.4.8.gz b/specs.4.8.gz new file mode 100644 index 0000000000000000000000000000000000000000..a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8 GIT binary patch literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ literal 0 HcmV?d00001 diff --git a/test/functional/pmn_controller_test.rb b/test/functional/pmn_controller_test.rb index 49f8f02..01c1aa5 100644 --- a/test/functional/pmn_controller_test.rb +++ b/test/functional/pmn_controller_test.rb @@ -28,7 +28,8 @@ def parse_response_body assert_equal '1', doc.xpath('//pmn:DesiredDocuments/ms:string[1]').inner_text request_id = doc.at_xpath('//pmn:RequestResult').inner_text assert request_id - r = PMNRequest.first(:conditions => {:doc_id => '1'}) + #r = PMNRequest.first(:conditions => {:doc_id => '1'}) + r = PMNRequest.where(doc_id: '1').first assert r assert_equal "multipart/form-data; boundary=-----------RubyMultipartPost", r.mime_type assert_equal nil, r.content diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index 70b92bd..341428b 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -10,7 +10,9 @@ class RecordsControllerTest < ActionController::TestCase c32 = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'TobaccoUser0028.xml'), 'application/xml') post :create, {:content => c32} assert_response 201 - r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) + db = Mongoid.default_session + #r = Mongoid.master['records'].find_one({:first => 'Unit', :last => 'Test'}) + r = db['records'].where({:first => 'Unit', :last => 'Test'}).first assert r assert_equal -773020800, r['birthdate'] end @@ -19,7 +21,9 @@ class RecordsControllerTest < ActionController::TestCase e2e = Rack::Test::UploadedFile.new(File.join(Rails.root, 'test', 'fixtures', 'JOHN_CLEESE_1_25091940.xml'), 'application/xml') post :create, {:content => e2e} assert_response 201 - r = Mongoid.master['records'].find_one({:first => 'JOHN', :last => 'CLEESE'}) + db = Mongoid.default_session + #r = Mongoid.master['records'].find_one({:first => 'JOHN', :last => 'CLEESE'}) + r = db['records'].where({:first => 'JOHN', :last => 'CLEESE'}).first assert r assert_equal -923616000, r['birthdate'] end diff --git a/test/test_helper.rb b/test/test_helper.rb index aea8798..c97aa48 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,7 +19,9 @@ def setup pi = HealthDataStandards::Import::C32::PatientImporter.instance patient = pi.parse_c32(doc) patient.save! - patient_json = Mongoid.master['records'].find_one(patient.id).to_json + db = Mongoid.default_session + #patient_json = Mongoid.master['records'].find_one(patient.id).to_json + patient_json = db['records'].find.select(patient: 0).first.to_json patient_api = QueryUtilities.patient_api_javascript.to_s initialize_patient = 'var patient = new hQuery.Patient(barry);' date = Time.new(2010,1,1) @@ -29,17 +31,23 @@ def setup end def dump_database - db = Mongoid.master + #db = Mongoid.master + db = Mongoid.default_session - db.collection('job_logs').remove({}) if db['job_log_events'] - db.collection('results').remove({}) if db['results'] - db.collection('queries').remove({}) if db['queries'] - db.collection('pmn_requests').remove({}) if db['pmn_requests'] + #db.collection('job_logs').remove({}) if db['job_log_events'] + #db.collection('results').remove({}) if db['results'] + #db.collection('queries').remove({}) if db['queries'] + #db.collection('pmn_requests').remove({}) if db['pmn_requests'] + db['job_logs'].drop if db['job_log_events'] + db['results'].drop if db['results'] + db['queries'].drop if db['queries'] + db['pmn_requests'].drop if db['pmn_requests'] end def load_scoop_database # Deletes any existing records and loads in scoop records - `mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/scoop-records.json` + #`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/scoop-records.json` + `mongoimport -d query_gateway_test --drop -c records test/fixtures/scoop-records.json` end def dump_jobs diff --git a/test/unit/query_executor_test.rb b/test/unit/query_executor_test.rb index e553b6d..a00566d 100644 --- a/test/unit/query_executor_test.rb +++ b/test/unit/query_executor_test.rb @@ -3,7 +3,10 @@ class QueryExecutorTest < ActiveSupport::TestCase def setup - Mongoid.master.drop_collection('query_results') + #Mongoid.master.drop_collection('query_results') + db = Mongoid.default_session + #db.drop_collection('query_results') + db[:query_results].drop if defined?(QueryExecutor.test_setup) QueryExecutor.test_setup end diff --git a/test/unit/query_job_test.rb b/test/unit/query_job_test.rb index dbce282..4bf08b6 100644 --- a/test/unit/query_job_test.rb +++ b/test/unit/query_job_test.rb @@ -12,8 +12,11 @@ class QueryJobTest < ActiveSupport::TestCase Delayed::Worker.delay_jobs=true query = create_query query.job - assert_equal 1, Mongoid.master['queries'].find({}).count - assert_equal :queued, Mongoid.master['queries'].find({}).first['status'] + #assert_equal 1, Mongoid.master['queries'].find({}).count + #assert_equal :queued, Mongoid.master['queries'].find({}).first['status'] + db = Mongoid.default_session + assert_equal 1, db['queries'].find({}).count + assert_equal :queued, db['queries'].find({}).first['status'] end @@ -31,7 +34,8 @@ class QueryJobTest < ActiveSupport::TestCase payload.failure(job) assert_equal Query.find(query.id).status, :failed - Result.collection.save({_id: job.id, value: {}}) + #Result.collection.save({_id: job.id, value: {}}) + Result.collection.insert({_id: job.id, value: {}}) assert_equal Query.find(query.id).status, :failed payload.success(job) diff --git a/test/unit/query_utilities_test.rb b/test/unit/query_utilities_test.rb index 0bfa018..1402f66 100644 --- a/test/unit/query_utilities_test.rb +++ b/test/unit/query_utilities_test.rb @@ -3,7 +3,7 @@ class QueryUtilitesTest < ActiveSupport::TestCase test "Stringification" do - key = BSON::OrderedHash.new + key = Moped::BSON #::OrderedHash.new key['a'] = 'b' key['c'] = 'd' str = QueryUtilities.stringify_key(key) From c25d408fc364cd74fb26c33f38c55c45c7f4b0aa Mon Sep 17 00:00:00 2001 From: drusk Date: Sat, 6 Jul 2013 14:08:06 -0700 Subject: [PATCH 046/205] Using Moped-level API for executing map_reduce on a collection for which we don't have a Mongoid model. --- lib/mongo_query_executor.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/mongo_query_executor.rb b/lib/mongo_query_executor.rb index 4fbdf0f..93a2bf2 100644 --- a/lib/mongo_query_executor.rb +++ b/lib/mongo_query_executor.rb @@ -23,7 +23,19 @@ def execute exts = [] exts << @functions_js #results = db[PATIENTS_COLLECTION].map_reduce(build_map_function(exts), build_reduce_function(), :query => @filter, raw: true, out: {inline: 1}) - results = Result.where(@filter).map_reduce(build_map_function(exts), build_reduce_function()).out(inline: true).raw() + + # An example of using Moped to execute a map_reduce command on a session + # can be found at http://mongoid.org/en/moped/docs/driver.html under + # Session#command + results = db.command( + mapreduce: PATIENTS_COLLECTION, + map: build_map_function(exts), + reduce: build_reduce_function(), + query: @filter, + raw: true, + out: {inline: 1} + ) + result = {} results['results'].each do |rv| key = QueryUtilities.stringify_key(rv['_id']) From bf0aa8281e4c5132bade1b4ac14cdd22a61faa04 Mon Sep 17 00:00:00 2001 From: drusk Date: Sat, 6 Jul 2013 15:14:38 -0700 Subject: [PATCH 047/205] Using Moped::BSON::Document object for query stringification. --- lib/query_utilities.rb | 2 +- test/unit/query_utilities_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/query_utilities.rb b/lib/query_utilities.rb index 964a142..c579282 100644 --- a/lib/query_utilities.rb +++ b/lib/query_utilities.rb @@ -4,7 +4,7 @@ module QueryUtilities require 'tilt' def self.stringify_key(key) - if (key.is_a? Moped::BSON) #::OrderedHash) + if (key.is_a? Moped::BSON::Document) #::OrderedHash) key = (key.map {|val| stringify_key(val)}).join('_') end if (key.is_a? Array) diff --git a/test/unit/query_utilities_test.rb b/test/unit/query_utilities_test.rb index 1402f66..07baed9 100644 --- a/test/unit/query_utilities_test.rb +++ b/test/unit/query_utilities_test.rb @@ -3,7 +3,7 @@ class QueryUtilitesTest < ActiveSupport::TestCase test "Stringification" do - key = Moped::BSON #::OrderedHash.new + key = Moped::BSON::Document.new key['a'] = 'b' key['c'] = 'd' str = QueryUtilities.stringify_key(key) From d4e01ef4f870c6b6abb1032e4b9198276277e323 Mon Sep 17 00:00:00 2001 From: drusk Date: Sat, 6 Jul 2013 16:19:27 -0700 Subject: [PATCH 048/205] Only add result_url field to query if results are not nil. --- app/controllers/queries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index cda91a5..39e120e 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -48,7 +48,7 @@ def show if stale?(:last_modified => @query.updated_at.utc) @qh = @query.attributes @qh.delete('delayed_job_id') - if @query.status == :complete + if @query.status == :complete and @query.result != nil @qh['result_url'] = result_url(@query.result) end respond_to do |format| From 5bd8b607364b9b06926fe2c4bd61afdd38fdcfe6 Mon Sep 17 00:00:00 2001 From: drusk Date: Sat, 6 Jul 2013 21:43:41 -0700 Subject: [PATCH 049/205] Tweeked syntax for getting patient data from database in ImporterApiTest setup. --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index c97aa48..da1bf30 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -21,7 +21,7 @@ def setup patient.save! db = Mongoid.default_session #patient_json = Mongoid.master['records'].find_one(patient.id).to_json - patient_json = db['records'].find.select(patient: 0).first.to_json + patient_json = db['records'].find(_id: patient.id).first.to_json patient_api = QueryUtilities.patient_api_javascript.to_s initialize_patient = 'var patient = new hQuery.Patient(barry);' date = Time.new(2010,1,1) From 8bf7e3f16fe03afdb0e0df801ea0e18e1ecdf403 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 8 Jul 2013 13:41:05 -0700 Subject: [PATCH 050/205] Point mongoimport to default database --- db/seeds.rb | 4 +++- test/test_helper.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index bbf45d6..1b592d2 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,4 +6,6 @@ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) #`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/records.json` -`mongoimport -d query_gateway_development --drop --collection records --file test/fixtures/records.json` \ No newline at end of file + +#puts "#{Mongoid.default_session.inspect}" +`mongoimport -d #{Mongoid.default_session.options[:database]} --drop --collection records --file test/fixtures/records.json` \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index da1bf30..205fab1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -47,7 +47,9 @@ def dump_database def load_scoop_database # Deletes any existing records and loads in scoop records #`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/scoop-records.json` - `mongoimport -d query_gateway_test --drop -c records test/fixtures/scoop-records.json` + + #puts "#{Mongoid.default_session.inspect}" + `mongoimport -d #{Mongoid.default_session.options[:database]} --drop -c records test/fixtures/scoop-records.json` end def dump_jobs From 8c704878f03ef355cbd1e4c1bc7df35ea8343e87 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 8 Jul 2013 13:47:32 -0700 Subject: [PATCH 051/205] Remove extraneous files --- Gemfile.lock.bckup | 253 ---------------- Marshal.4.8 | Bin 45 -> 0 bytes Marshal.4.8.Z | Bin 53 -> 0 bytes Procfile | 2 - error.txt | 630 ---------------------------------------- latest_specs.4.8 | Bin 4 -> 0 bytes latest_specs.4.8.gz | Bin 24 -> 0 bytes prerelease_specs.4.8 | Bin 4 -> 0 bytes prerelease_specs.4.8.gz | Bin 24 -> 0 bytes specs.4.8 | Bin 4 -> 0 bytes specs.4.8.gz | Bin 24 -> 0 bytes 11 files changed, 885 deletions(-) delete mode 100644 Gemfile.lock.bckup delete mode 100644 Marshal.4.8 delete mode 100644 Marshal.4.8.Z delete mode 100644 Procfile delete mode 100644 error.txt delete mode 100644 latest_specs.4.8 delete mode 100644 latest_specs.4.8.gz delete mode 100644 prerelease_specs.4.8 delete mode 100644 prerelease_specs.4.8.gz delete mode 100644 specs.4.8 delete mode 100644 specs.4.8.gz diff --git a/Gemfile.lock.bckup b/Gemfile.lock.bckup deleted file mode 100644 index f8d49d5..0000000 --- a/Gemfile.lock.bckup +++ /dev/null @@ -1,253 +0,0 @@ -GIT - remote: http://github.com/hquery/hqmf2js.git - revision: cc1936810085fa43542c351e92765677976cfd1f - tag: V0.3 - specs: - hqmf2js (0.1.0) - coffee-script (~> 2.2.0) - nokogiri (~> 1.5.2) - sprockets (~> 2.1.2) - tilt (~> 1.3.3) - -GIT - remote: http://github.com/projectcypress/health-data-standards.git - revision: fda23ee8678cfda314412e3e18815653bbcffb63 - tag: fda23ee8678cfda314412e3e18815653bbcffb63 - specs: - health-data-standards (2.0.0) - builder (~> 3.0.0) - erubis (~> 2.7.0) - mongoid (~> 3.0.6) - nokogiri (~> 1.5.5) - uuid (~> 2.3.5) - -GIT - remote: http://github.com/scoophealth/hqmf-parser.git - revision: ef279cb3f14823ca89316877b0c62a8817cc857c - branch: scoop-develop - specs: - hqmf-parser (1.1.0) - google-spreadsheet-ruby (= 0.1.8) - roo (= 1.10.1) - rubyzip - spreadsheet (= 0.6.8) - -GIT - remote: http://github.com/scoophealth/patientapi.git - revision: 779b4d707fb7b325c81be2a9713ee073f7d84375 - tag: v1.0.0 - specs: - hquery-patient-api (1.0.0) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.2) - actionpack (= 3.2.2) - mail (~> 2.4.0) - actionpack (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.1) - rack (~> 1.4.0) - rack-cache (~> 1.1) - rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - activerecord (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) - i18n (~> 0.6) - multi_json (~> 1.0) - ansi (1.4.3) - arel (3.0.2) - awesome_print (1.0.2) - builder (3.0.4) - choice (0.1.6) - coderay (1.0.9) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.6.2) - configatron (2.13.0) - yamler (>= 0.1.0) - cover_me (1.2.0) - configatron - hashie - daemons (1.1.9) - delayed_job (3.0.5) - activesupport (~> 3.0) - delayed_job_mongoid (2.0.0) - delayed_job (~> 3.0) - mongoid (~> 3.0) - erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - factory_girl (4.2.0) - activesupport (>= 3.0.0) - faraday (0.8.7) - multipart-post (~> 1.1) - google-spreadsheet-ruby (0.1.8) - nokogiri (>= 1.4.3.1) - oauth (>= 0.3.6) - oauth2 (>= 0.5.0) - hashie (2.0.5) - hike (1.2.3) - httpauth (0.2.0) - i18n (0.6.4) - journey (1.0.4) - jquery-rails (3.0.1) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.0) - jwt (0.1.8) - multi_json (>= 1.5) - kramdown (1.0.2) - libv8 (3.11.8.17) - log4r (1.1.10) - macaddr (1.6.1) - systemu (~> 2.5.0) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.1) - method_source (0.8.1) - mime-types (1.23) - minitest (4.7.5) - mocha (0.14.0) - metaclass (~> 0.0.1) - mongoid (3.0.23) - activemodel (~> 3.1) - moped (~> 1.2) - origin (~> 1.0) - tzinfo (~> 0.3.22) - moped (1.5.0) - multi_json (1.7.7) - multi_xml (0.5.4) - multipart-post (1.2.0) - nokogiri (1.5.10) - oauth (0.4.7) - oauth2 (0.9.2) - faraday (~> 0.8) - httpauth (~> 0.2) - jwt (~> 0.1.4) - multi_json (~> 1.0) - multi_xml (~> 0.5) - rack (~> 1.2) - origin (1.1.0) - polyglot (0.3.3) - pry (0.9.8.2) - coderay (~> 1.0.5) - method_source (~> 0.7) - slop (>= 2.4.4) - rack (1.4.1) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) - rack (>= 1.0) - rails (3.2.2) - actionmailer (= 3.2.2) - actionpack (= 3.2.2) - activerecord (= 3.2.2) - activeresource (= 3.2.2) - activesupport (= 3.2.2) - bundler (~> 1.0) - railties (= 3.2.2) - railties (3.2.2) - actionpack (= 3.2.2) - activesupport (= 3.2.2) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.1.0) - rdoc (3.12.2) - json (~> 1.4) - ref (1.0.5) - roo (1.10.1) - choice (>= 0.1.4) - google-spreadsheet-ruby (>= 0.1.5) - nokogiri (>= 1.5.0) - rubyzip (>= 0.9.4) - spreadsheet (> 0.6.4) - todonotes (>= 0.1.0) - ruby-ole (1.2.11.7) - rubyzip (0.9.9) - sass (3.2.9) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - slop (3.4.5) - spreadsheet (0.6.8) - ruby-ole (>= 1.0) - sprockets (2.1.3) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - systemu (2.5.2) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) - ref - thor (0.18.1) - tilt (1.3.7) - todonotes (0.1.1) - log4r - treetop (1.4.14) - polyglot - polyglot (>= 0.3.1) - turn (0.9.6) - ansi - tzinfo (0.3.37) - uglifier (2.1.1) - execjs (>= 0.3.0) - multi_json (>= 1.0.2) - uuid (2.3.7) - macaddr (~> 1.0) - yamler (0.1.0) - -PLATFORMS - ruby - -DEPENDENCIES - awesome_print - coderay - coffee-rails - cover_me (>= 1.0.0.rc6) - daemons - delayed_job - delayed_job_mongoid - factory_girl - health-data-standards! - hqmf-parser! - hqmf2js! - hquery-patient-api! - jquery-rails - jruby-openssl - kramdown - minitest (< 5.0.0) - mocha - mongoid - pry - rails (~> 3.2.1) - sass-rails - therubyracer - therubyrhino - turn - uglifier diff --git a/Marshal.4.8 b/Marshal.4.8 deleted file mode 100644 index 2e720c5e968cb2588d50f3ae7ccc72edb9d95f61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45 zcmZSK$hQ)8PtCQm3eGPrN>266OG&L@x8ib0Pt7f^X0YOSC@x4%j!(%fDvo9V05w+* A6951J diff --git a/Marshal.4.8.Z b/Marshal.4.8.Z deleted file mode 100644 index 9e4dfa76df90b41bb19ac7e2e5075f74bfd1f3e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53 zcmV-50LuS(oMYk0w-R+v&9$-$&Mz%WPW8-7Nv&YF;&Mn&%`L8Gu;O expected but was - <0>. - @ test/unit/query_executor_test.rb:23:in `test_execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4281320697472554873__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - FAIL (0:00:01.646) handwritten hqmf execute - <269> expected but was - <0>. - @ test/unit/query_executor_test.rb:36:in `test_handwritten_hqmf_execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4281320697472554873__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -QueryJobTest - ERROR (0:00:01.865) Job executes correctly - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n emit(patient.gender(), 1);\n};\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(gender, counts) {\n var sum = 0;\n while(counts.hasNext()){\n sum += counts.next();\n }\n return sum;\n};\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/query_job_test.rb:91:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3438448412012551206__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - ERROR (0:00:02.084) Job executes correctly with function - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n function sum(values) {\n result = 0;\n values.forEach(function(value) {\n result += value;\n });\n return result;\n}\n function map(patient) {\n sum([1,1,1]);\n emit(patient.gender(), 1);\n};\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(gender, counts) {\n var sum = 0;\n while(counts.hasNext()){\n sum += counts.next();\n }\n return sum;\n};\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/query_job_test.rb:105:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3438448412012551206__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - PASS (0:00:02.306) before logs running event properly - PASS (0:00:02.448) error logs event properly - PASS (0:00:02.610) failure logs event properly - PASS (0:00:02.806) job status should report property - PASS (0:00:02.946) job submission should execute properly - PASS (0:00:03.093) success logs event properly - PASS (0:00:03.245) cancel job - -QueryTest - PASS (0:00:03.402) Can convert a JSON string into a hash - PASS (0:00:04.541) Can see if they have been updated - PASS (0:00:04.681) Still get last query update before any queries are added - -QueryUtilitesTest - ERROR (0:00:04.816) Stringification - undefined method `[]=' for Moped::BSON:Module - @ test/unit/query_utilities_test.rb:7:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1701913134296835570__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -ScoopJobTest - ERROR (0:00:05.071) iteration 0 query works properly - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var time = new Date(2013, 5, 1);\n if (patient.gender() == \"M\") {\n var age = Math.floor(patient.age(time));\n if(age >= 65) {\n emit(\"male_>65\", 1);\n }\n }\n};\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/scoop_job_test.rb:18:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - ERROR (0:00:05.323) iteration 1 query works properly - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var ageLimit = 65;\n var drugLimit = 5;\n var time = new Date(2013, 2, 10);\n\n var drugList = patient.medications();\n var currentDrugs = findCurrentDrugs(drugList, time);\n\n emit('total_population', 1);\n if (patient.age(time) > ageLimit) {\n emit('sampled_number', 1);\n\n // Adds patient to count if over ageLimit & over drugLimit\n if (currentDrugs > drugLimit) {\n emit('polypharmacy_number', 1);\n }\n }\n}\n\n// Returns count of \"active\" drugs that are between start & end date\n// Also checks for the same \"active\" drug and doesn't overcount\nfunction findCurrentDrugs(drugs, time) {\n var now = time.getTime();\n var count = 0;\n var seenDrugs = [];\n\n for(var i = 0; i < drugs.length; i++) {\n var repeat = false;\n var drugStart = drugs[i].indicateMedicationStart().getTime();\n var drugEnd = drugs[i].indicateMedicationStop().getTime();\n\n // Check if drug is within the right time\n if(drugEnd >= now && drugStart <= now) {\n // Check if this entry is a repeat of same drug (codesystem agnostic)\n var codes = drugs[i].medicationInformation().codedProduct();\n\n for (var j = 0; j < codes.length; j++) {\n var code = codes[j].code();\n\n if(seenDrugs.indexOf(code) == -1) {\n seenDrugs.push(code);\n }\n else {\n repeat = true;\n }\n }\n\n // Increment count if not a repeat\n if(!repeat) {\n count++;\n }\n }\n }\n\n return count;\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/scoop_job_test.rb:30:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - ERROR (0:00:05.530) iteration 2 query works properly - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var atcLevel = 4; // Level definition based on definition found on Wikipedia\n\n var drugClasses = findATCDrugClasses(patient.medications(), atcLevel);\n\n for(var i = 0; i < drugClasses.length; i++) {\n emit(drugClasses[i], 1);\n }\n}\n\n// Returns list of all ATC medication codes\nfunction findATCDrugClasses(drugs, level) {\n var list = [];\n var cutoff;\n\n // Define ATC cutoff levels\n switch(level) {\n case 1:\n cutoff = 1;\n break;\n case 2:\n cutoff = 3;\n break;\n case 3:\n cutoff = 4;\n break;\n case 4:\n cutoff = 5;\n break;\n /* Prevent data leakage - only want classes, not specific substance\n case 5:\n cutoff = 7;\n break;\n */\n default:\n return list;\n }\n\n for(var i = 0; i < drugs.length; i++) {\n // Get all represented codes for each drug\n var codes = drugs[i].medicationInformation().codedProduct();\n\n // Filter out only ATC codes\n for(var j = 0; j < codes.length; j++) {\n if(codes[j].codeSystemName() == \"whoATC\") {\n // Truncate to appropriate level length\n list.push(codes[j].code().substring(0, cutoff));\n }\n }\n }\n\n return list;\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/scoop_job_test.rb:44:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - ERROR (0:00:05.791) iteration 4 query works properly - The operation: #"results", :map=>"function() {\n this.hQuery || (this.hQuery = {});\n this.Specifics || (this.Specifics = {});\n var hQuery = this.hQuery;\n var Specifics = this.Specifics;\n /**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nConverts a a number in UTC Seconds since the epoch to a date.\n@param {number} utcSeconds seconds since the epoch in UTC\n@returns {Date}\n@function\n@exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds\n*/\n\n\nhQuery.dateFromUtcSeconds = function(utcSeconds) {\n return new Date(utcSeconds * 1000);\n};\n\n/**\n@class Scalar - a representation of a unit and value\n@exports Scalar as hQuery.Scalar\n*/\n\n\nhQuery.Scalar = (function() {\n function Scalar(json) {\n this.json = json;\n }\n\n Scalar.prototype.unit = function() {\n return this.json['unit'];\n };\n\n Scalar.prototype.value = function() {\n return this.json['value'];\n };\n\n return Scalar;\n\n})();\n\n/**\n@class PhysicalQuantity - a representation of a physical quantity\n@exports PhysicalQuantity as hQuery.PhysicalQuantity\n*/\n\n\nhQuery.PhysicalQuantity = (function() {\n function PhysicalQuantity(json) {\n this.json = json;\n }\n\n PhysicalQuantity.prototype.units = function() {\n return this.json['units'];\n };\n\n PhysicalQuantity.prototype.scalar = function() {\n return parseFloat(this.json['scalar']);\n };\n\n return PhysicalQuantity;\n\n})();\n\n/**\n@class A code with its corresponding code system\n@exports CodedValue as hQuery.CodedValue\n*/\n\n\nhQuery.CodedValue = (function() {\n /**\n @param {String} c value of the code\n @param {String} csn name of the code system that the code belongs to\n @constructs\n */\n function CodedValue(c, csn) {\n this.c = c;\n this.csn = csn;\n }\n\n /**\n @returns {String} the code\n */\n\n\n CodedValue.prototype.code = function() {\n return this.c;\n };\n\n /**\n @returns {String} the code system name\n */\n\n\n CodedValue.prototype.codeSystemName = function() {\n return this.csn;\n };\n\n CodedValue.normalize = function(val) {\n return String(val).toLowerCase();\n };\n\n /**\n Returns true if the contained code and codeSystemName match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedValue.prototype.includedIn = function(codeSet) {\n var c1, c2, code, codeSystemName, codes, _i, _len;\n\n for (codeSystemName in codeSet) {\n codes = codeSet[codeSystemName];\n if (this.csn === codeSystemName) {\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n c1 = hQuery.CodedValue.normalize(code);\n c2 = hQuery.CodedValue.normalize(this.c);\n if (c1 === c2) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n return CodedValue;\n\n})();\n\n/**\nStatus as defined by value set 2.16.840.1.113883.5.14,\nthe ActStatus vocabulary maintained by HL7\n\n@class Status\n@augments hQuery.CodedEntry\n@exports Status as hQuery.Status\n*/\n\n\nhQuery.Status = (function(_super) {\n var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;\n\n __extends(Status, _super);\n\n function Status() {\n _ref = Status.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n NORMAL = \"normal\";\n\n ABORTED = \"aborted\";\n\n ACTIVE = \"active\";\n\n CANCELLED = \"cancelled\";\n\n COMPLETED = \"completed\";\n\n HELD = \"held\";\n\n NEW = \"new\";\n\n SUSPENDED = \"suspended\";\n\n NULLIFIED = \"nullified\";\n\n OBSOLETE = \"obsolete\";\n\n Status.prototype.isNormal = function() {\n return this.c === NORMAL;\n };\n\n Status.prototype.isAborted = function() {\n return this.c === ABORTED;\n };\n\n Status.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n Status.prototype.isCancelled = function() {\n return this.c === CANCELLED;\n };\n\n Status.prototype.isCompleted = function() {\n return this.c === COMPLETED;\n };\n\n Status.prototype.isHeld = function() {\n return this.c === HELD;\n };\n\n Status.prototype.isNew = function() {\n return this.c === NEW;\n };\n\n Status.prototype.isSuspended = function() {\n return this.c === SUSPENDED;\n };\n\n Status.prototype.isNullified = function() {\n return this.c === NULLIFIED;\n };\n\n Status.prototype.isObsolete = function() {\n return this.c === OBSOLETE;\n };\n\n return Status;\n\n})(hQuery.CodedValue);\n\n/**\n@class an Address for a person or organization\n@exports Address as hQuery.Address\n*/\n\n\nhQuery.Address = (function() {\n function Address(json) {\n this.json = json;\n }\n\n /**\n @returns {Array[String]} the street addresses\n */\n\n\n Address.prototype.street = function() {\n return this.json['street'];\n };\n\n /**\n @returns {String} the city\n */\n\n\n Address.prototype.city = function() {\n return this.json['city'];\n };\n\n /**\n @returns {String} the State\n */\n\n\n Address.prototype.state = function() {\n return this.json['state'];\n };\n\n /**\n @returns {String} the postal code\n */\n\n\n Address.prototype.postalCode = function() {\n return this.json['zip'];\n };\n\n return Address;\n\n})();\n\n/**\n@class An object that describes a means to contact an entity. This is used to represent\nphone numbers, email addresses, instant messaging accounts etc.\n@exports Telecom as hQuery.Telecom\n*/\n\n\nhQuery.Telecom = (function() {\n function Telecom(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the type of telecom entry, phone, sms, email ....\n */\n\n\n Telecom.prototype.type = function() {\n return this.json['type'];\n };\n\n /**\n @returns {String} the value of the entry - the actual phone number , email address , ....\n */\n\n\n Telecom.prototype.value = function() {\n return this.json['value'];\n };\n\n /**\n @returns {String} the use of the entry. Is it a home, office, .... type of contact\n */\n\n\n Telecom.prototype.use = function() {\n return this.json['use'];\n };\n\n /**\n @returns {Boolean} is this a preferred form of contact\n */\n\n\n Telecom.prototype.preferred = function() {\n return this.json['preferred'];\n };\n\n return Telecom;\n\n})();\n\n/**\n@class an object that describes a person. includes a persons name, addresses, and contact information\n@exports Person as hQuery.Person\n*/\n\n\nhQuery.Person = (function() {\n function Person(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the given name of the person\n */\n\n\n Person.prototype.given = function() {\n return this.json['first'];\n };\n\n /**\n @returns {String} the last/family name of the person\n */\n\n\n Person.prototype.last = function() {\n return this.json['last'];\n };\n\n /**\n @returns {String} the display name of the person\n */\n\n\n Person.prototype.name = function() {\n if (this.json['name']) {\n return this.json['name'];\n } else {\n return this.json['first'] + ' ' + this.json['last'];\n }\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the patient\n */\n\n\n Person.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person\n */\n\n\n Person.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Person;\n\n})();\n\n/**\n@class an actor is either a person or an organization\n@exports Actor as hQuery.Actor\n*/\n\n\nhQuery.Actor = (function() {\n function Actor(json) {\n this.json = json;\n }\n\n Actor.prototype.person = function() {\n if (this.json['person']) {\n return new hQuery.Person(this.json['person']);\n }\n };\n\n Actor.prototype.organization = function() {\n if (this.json['organization']) {\n return new hQuery.Organization(this.json['organization']);\n }\n };\n\n return Actor;\n\n})();\n\n/**\n@class an Organization\n@exports Organization as hQuery.Organization\n*/\n\n\nhQuery.Organization = (function() {\n function Organization(json) {\n this.json = json;\n }\n\n /**\n @returns {String} the id for the organization\n */\n\n\n Organization.prototype.organizationId = function() {\n return this.json['organizationId'];\n };\n\n /**\n @returns {String} the name of the organization\n */\n\n\n Organization.prototype.organizationName = function() {\n return this.json['name'];\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the organization\n */\n\n\n Organization.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization\n */\n\n\n Organization.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Organization;\n\n})();\n\n/**\n@class a Facility\n@exports Organization as hQuery.Facility\n*/\n\n\nhQuery.Facility = (function(_super) {\n __extends(Facility, _super);\n\n function Facility(json) {\n this.json = json;\n if (this.json['code'] != null) {\n Facility.__super__.constructor.call(this, this.json['code']['code'], this.json['code']['codeSystem']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n }\n\n /**\n @returns {String} the name of the facility\n */\n\n\n Facility.prototype.name = function() {\n return this.json['name'];\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n Facility.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n Facility.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Address} objects associated with the facility\n */\n\n\n Facility.prototype.addresses = function() {\n var address, list, _i, _len, _ref1;\n\n list = [];\n if (this.json['addresses']) {\n _ref1 = this.json['addresses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n address = _ref1[_i];\n list.push(new hQuery.Address(address));\n }\n }\n return list;\n };\n\n /**\n @returns {Array} an array of {@link hQuery.Telecom} objects associated with the facility\n */\n\n\n Facility.prototype.telecoms = function() {\n var tel, _i, _len, _ref1, _results;\n\n _ref1 = this.json['telecoms'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n tel = _ref1[_i];\n _results.push(new hQuery.Telecom(tel));\n }\n return _results;\n };\n\n return Facility;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a DateRange in the form of hi and low date values.\n@exports DateRange as hQuery.DateRange\n*/\n\n\nhQuery.DateRange = (function() {\n function DateRange(json) {\n this.json = json;\n }\n\n DateRange.prototype.hi = function() {\n if (this.json['hi']) {\n return hQuery.dateFromUtcSeconds(this.json['hi']);\n }\n };\n\n DateRange.prototype.low = function() {\n return hQuery.dateFromUtcSeconds(this.json['low']);\n };\n\n return DateRange;\n\n})();\n\n/**\n@class Class used to describe an entity that is providing some form of information. This does not mean that they are\nproviding any treatment just that they are providing information.\n@exports Informant as hQuery.Informant\n*/\n\n\nhQuery.Informant = (function() {\n function Informant(json) {\n this.json = json;\n }\n\n /**\n an array of hQuery.Person objects as points of contact\n @returns {Array}\n */\n\n\n Informant.prototype.contacts = function() {\n var contact, _i, _len, _ref1, _results;\n\n _ref1 = this.json['contacts'];\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n contact = _ref1[_i];\n _results.push(new hQuery.Person(contact));\n }\n return _results;\n };\n\n /**\n @returns {hQuery.Organization} the organization providing the information\n */\n\n\n Informant.prototype.organization = function() {\n return new hQuery.Organization(this.json['organization']);\n };\n\n return Informant;\n\n})();\n\n/**\n@class\n@exports CodedEntry as hQuery.CodedEntry\n*/\n\n\nhQuery.CodedEntry = (function() {\n function CodedEntry(json) {\n this.json = json;\n if (this.json['time']) {\n this._date = hQuery.dateFromUtcSeconds(this.json['time']);\n }\n if (this.json['start_time']) {\n this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);\n }\n if (this.json['end_time']) {\n this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);\n }\n this._type = hQuery.createCodedValues(this.json['codes']);\n this._statusCode = this.json['status_code'];\n this.id = this.json['_id'];\n this.source_id = this.json['id'];\n this._freeTextType = this.json['description'];\n }\n\n /**\n Adjust the start and end times of this event to the supplied timestamp\n */\n\n\n CodedEntry.prototype.setTimestamp = function(timestamp) {\n return this._date = this._startDate = this._endDate = timestamp;\n };\n\n /**\n Date and time at which the coded entry took place\n @returns {Date}\n */\n\n\n CodedEntry.prototype.date = function() {\n return this._date;\n };\n\n /**\n Date and time at which the coded entry started\n @returns {Date}\n */\n\n\n CodedEntry.prototype.startDate = function() {\n return this._startDate;\n };\n\n /**\n Date and time at which the coded entry ended\n @returns {Date}\n */\n\n\n CodedEntry.prototype.endDate = function() {\n return this._endDate;\n };\n\n /**\n Tries to find a single point in time for this entry. Will first return date if it is present,\n then fall back to startDate and finally endDate\n @returns {Date}\n */\n\n\n CodedEntry.prototype.timeStamp = function() {\n return this._date || this._startDate || this._endDate;\n };\n\n /**\n Determines whether the entry specifies a time range or not\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isTimeRange = function() {\n return (this._startDate != null) && (this._endDate != null);\n };\n\n /**\n Determines whether a coded entry contains sufficient information (code and at least \n one time stamp) to be usable\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.isUsable = function() {\n return this._type.length > 0 && (this._date || this._startDate || this._endDate);\n };\n\n /**\n An Array of CodedValues which describe what kind of coded entry took place\n @returns {Array}\n */\n\n\n CodedEntry.prototype.type = function() {\n return this._type;\n };\n\n /**\n A free text description of the type of coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.freeTextType = function() {\n return this._freeTextType;\n };\n\n /**\n Status for this coded entry\n @returns {String}\n */\n\n\n CodedEntry.prototype.status = function() {\n if (this._statusCode != null) {\n if (this._statusCode['HL7 ActStatus'] != null) {\n return this._statusCode['HL7 ActStatus'][0];\n } else if (this._statusCode['SNOMED-CT'] != null) {\n switch (this._statusCode['SNOMED-CT'][0]) {\n case '55561003':\n return 'active';\n case '73425007':\n return 'inactive';\n case '413322009':\n return 'resolved';\n }\n }\n }\n };\n\n /**\n Status for this coded entry\n @returns {Hash} keys are code systems, values are arrays of codes\n */\n\n\n CodedEntry.prototype.statusCode = function() {\n return this._statusCode;\n };\n\n /**\n Returns true if any of this entry codes match a code in the supplied codeSet.\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @returns {boolean}\n */\n\n\n CodedEntry.prototype.includesCodeFrom = function(codeSet) {\n var codedValue, _i, _len, _ref1;\n\n _ref1 = this._type;\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n codedValue = _ref1[_i];\n if (codedValue.includedIn(codeSet)) {\n return true;\n }\n }\n return false;\n };\n\n /**\n @returns {Boolean} whether the entry was negated\n */\n\n\n CodedEntry.prototype.negationInd = function() {\n return this.json['negationInd'] || false;\n };\n\n /**\n Returns the values of the result. This will return an array that contains\n PhysicalQuantity or CodedValue objects depending on the result type.\n @returns {Array} containing either PhysicalQuantity and/or CodedValues\n */\n\n\n CodedEntry.prototype.values = function() {\n var value, values, _i, _len, _ref1;\n\n values = [];\n if (this.json['values']) {\n _ref1 = this.json['values'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n value = _ref1[_i];\n if (value['scalar'] != null) {\n values.push(new hQuery.PhysicalQuantity(value));\n } else {\n values = values.concat(hQuery.createCodedValues(value.codes));\n }\n }\n }\n return values;\n };\n\n /**\n Indicates the reason an entry was negated.\n @returns {hQuery.CodedValue} Used to indicate reason an immunization was not administered.\n */\n\n\n CodedEntry.prototype.negationReason = function() {\n return hQuery.createCodedValue(this.json['negationReason']);\n };\n\n /**\n Explains the reason for an entry.\n @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.\n */\n\n\n CodedEntry.prototype.reason = function() {\n return hQuery.createCodedValue(this.json['reason']);\n };\n\n return CodedEntry;\n\n})();\n\n/**\n@class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching\nentries based on codes and date ranges\n@exports CodedEntryList as hQuery.CodedEntryList\n*/\n\n\nhQuery.CodedEntryList = (function(_super) {\n __extends(CodedEntryList, _super);\n\n function CodedEntryList() {\n this.push.apply(this, arguments);\n }\n\n /**\n Push the supplied entry onto this list if it is usable\n @param {CodedEntry} a coded entry that should be added to the list if it is usable\n */\n\n\n CodedEntryList.prototype.pushIfUsable = function(entry) {\n if (entry.isUsable()) {\n return this.push(entry);\n }\n };\n\n /**\n Return the number of entries that match the\n supplied code set where those entries occur between the supplied time bounds\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @param {Date} start the start of the period during which the entry must occur, a null value will match all times\n @param {Date} end the end of the period during which the entry must occur, a null value will match all times\n @param {boolean} includeNegated whether the returned list of entries should include those that have been negated\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.match = function(codeSet, start, end, includeNegated) {\n var afterStart, beforeEnd, cloned, entry, matchesCode, _i, _len;\n\n if (includeNegated == null) {\n includeNegated = false;\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n afterStart = !start || entry.timeStamp() >= start;\n beforeEnd = !end || entry.timeStamp() <= end;\n matchesCode = codeSet === null || entry.includesCodeFrom(codeSet);\n if (afterStart && beforeEnd && matchesCode && (includeNegated || !entry.negationInd())) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Return a new list of entries that is the result of concatenating the passed in entries with this list\n @return {CodedEntryList} the set of concatenated entries\n */\n\n\n CodedEntryList.prototype.concat = function(otherEntries) {\n var cloned, entry, _i, _j, _len, _len1;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n cloned.push(entry);\n }\n for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {\n entry = otherEntries[_j];\n cloned.push(entry);\n }\n return cloned;\n };\n\n /**\n Match entries with the specified statuses\n @return {CodedEntryList} the matching entries\n */\n\n\n CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {\n var cloned, entry, _i, _len, _ref1;\n\n if (includeUndefined == null) {\n includeUndefined = true;\n }\n if (includeUndefined) {\n statuses = statuses.concat([void 0, null]);\n }\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (_ref1 = entry.status(), __indexOf.call(statuses, _ref1) >= 0) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @param {Object} codeSet a hash with code system names as keys and an array of codes as values\n @return {CodedEntryList} negated entries\n */\n\n\n CodedEntryList.prototype.withNegation = function(codeSet) {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (entry.negationInd() && (!codeSet || (entry.negationReason() && entry.negationReason().includedIn(codeSet)))) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n /**\n Filter entries based on negation\n @return {CodedEntryList} non-negated entries\n */\n\n\n CodedEntryList.prototype.withoutNegation = function() {\n var cloned, entry, _i, _len;\n\n cloned = new hQuery.CodedEntryList();\n for (_i = 0, _len = this.length; _i < _len; _i++) {\n entry = this[_i];\n if (!entry.negationInd()) {\n cloned.push(entry);\n }\n }\n return cloned;\n };\n\n return CodedEntryList;\n\n})(Array);\n\n/**\n@private\n@function\n*/\n\n\nhQuery.createCodedValues = function(jsonCodes) {\n var code, codeSystem, codedValues, codes, _i, _len;\n\n codedValues = [];\n for (codeSystem in jsonCodes) {\n codes = jsonCodes[codeSystem];\n for (_i = 0, _len = codes.length; _i < _len; _i++) {\n code = codes[_i];\n codedValues.push(new hQuery.CodedValue(code, codeSystem));\n }\n }\n return codedValues;\n};\n\nhQuery.createCodedValue = function(json) {\n if (json != null) {\n return new hQuery.CodedValue(json['code'], json['codeSystem']);\n }\n};\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref, _ref1,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class MedicationInformation\n@exports MedicationInformation as hQuery.MedicationInformation\n*/\n\n\nhQuery.MedicationInformation = (function() {\n function MedicationInformation(json) {\n this.json = json;\n }\n\n /**\n An array of hQuery.CodedValue describing the medication\n @returns {Array}\n */\n\n\n MedicationInformation.prototype.codedProduct = function() {\n return hQuery.createCodedValues(this.json['codes']);\n };\n\n MedicationInformation.prototype.freeTextProductName = function() {\n return this.json['description'];\n };\n\n MedicationInformation.prototype.codedBrandName = function() {\n return this.json['codedBrandName'];\n };\n\n MedicationInformation.prototype.freeTextBrandName = function() {\n return this.json['brandName'];\n };\n\n MedicationInformation.prototype.drugManufacturer = function() {\n if (this.json['drugManufacturer']) {\n return new hQuery.Organization(this.json['drugManufacturer']);\n }\n };\n\n return MedicationInformation;\n\n})();\n\n/**\n@class AdministrationTiming - the\n@exports AdministrationTiming as hQuery.AdministrationTiming\n*/\n\n\nhQuery.AdministrationTiming = (function() {\n function AdministrationTiming(json) {\n this.json = json;\n }\n\n /**\n Provides the period of medication administration as a Scalar. An example\n Scalar that would be returned would be with value = 8 and units = hours. This would\n mean that the medication should be taken every 8 hours.\n @returns {hQuery.Scalar}\n */\n\n\n AdministrationTiming.prototype.period = function() {\n if (this.json['period']) {\n return new hQuery.Scalar(this.json['period']);\n }\n };\n\n /**\n Indicates whether it is the interval (time between dosing), or frequency \n (number of doses in a time period) that is important. If instititutionSpecified is not \n present or is set to false, then the time between dosing is important (every 8 hours). \n If true, then the frequency of administration is important (e.g., 3 times per day).\n @returns {Boolean}\n */\n\n\n AdministrationTiming.prototype.institutionSpecified = function() {\n return this.json['institutionSpecified'];\n };\n\n return AdministrationTiming;\n\n})();\n\n/**\n@class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose\n@exports DoseRestriction as hQuery.DoseRestriction\n*/\n\n\nhQuery.DoseRestriction = (function() {\n function DoseRestriction(json) {\n this.json = json;\n }\n\n DoseRestriction.prototype.numerator = function() {\n if (this.json['numerator']) {\n return new hQuery.Scalar(this.json['numerator']);\n }\n };\n\n DoseRestriction.prototype.denominator = function() {\n if (this.json['denominator']) {\n return new hQuery.Scalar(this.json['denominator']);\n }\n };\n\n return DoseRestriction;\n\n})();\n\n/**\n@class Fulfillment - information about when and who fulfilled an order for the medication\n@exports Fulfillment as hQuery.Fullfilement\n*/\n\n\nhQuery.Fulfillment = (function() {\n function Fulfillment(json) {\n this.json = json;\n }\n\n Fulfillment.prototype.dispenseDate = function() {\n return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);\n };\n\n Fulfillment.prototype.dispensingPharmacyLocation = function() {\n if (this.json['dispensingPharmacyLocation']) {\n return new hQuery.Address(this.json['dispensingPharmacyLocation']);\n }\n };\n\n Fulfillment.prototype.quantityDispensed = function() {\n if (this.json['quantityDispensed']) {\n return new hQuery.Scalar(this.json['quantityDispensed']);\n }\n };\n\n Fulfillment.prototype.prescriptionNumber = function() {\n return this.json['prescriptionNumber'];\n };\n\n Fulfillment.prototype.fillNumber = function() {\n return this.json['fillNumber'];\n };\n\n Fulfillment.prototype.fillStatus = function() {\n if (this.json['fillStatus']) {\n return new hQuery.Status(this.json['fillStatus']);\n }\n };\n\n return Fulfillment;\n\n})();\n\n/**\n@class OrderInformation - information abour an order for a medication\n@exports OrderInformation as hQuery.OrderInformation\n*/\n\n\nhQuery.OrderInformation = (function() {\n function OrderInformation(json) {\n this.json = json;\n }\n\n OrderInformation.prototype.orderNumber = function() {\n return this.json['orderNumber'];\n };\n\n OrderInformation.prototype.fills = function() {\n return this.json['fills'];\n };\n\n OrderInformation.prototype.quantityOrdered = function() {\n if (this.json['quantityOrdered']) {\n return new hQuery.Scalar(this.json['quantityOrdered']);\n }\n };\n\n OrderInformation.prototype.orderExpirationDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);\n };\n\n OrderInformation.prototype.orderDateTime = function() {\n return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);\n };\n\n return OrderInformation;\n\n})();\n\n/**\nTypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19\nwhich pulls two values from SNOMED to describe whether a medication is\nprescription or over the counter\n\n@class TypeOfMedication - describes whether a medication is prescription or\n over the counter\n@augments hQuery.CodedEntry\n@exports TypeOfMedication as hQuery.TypeOfMedication\n*/\n\n\nhQuery.TypeOfMedication = (function(_super) {\n var OTC, PRESECRIPTION;\n\n __extends(TypeOfMedication, _super);\n\n function TypeOfMedication() {\n _ref = TypeOfMedication.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n PRESECRIPTION = \"73639000\";\n\n OTC = \"329505003\";\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isPrescription = function() {\n return this.c === PRESECRIPTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n TypeOfMedication.prototype.isOverTheCounter = function() {\n return this.c === OTC;\n };\n\n return TypeOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\nStatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7\nThe terms come from SNOMED and are managed by HL7\n\n@class StatusOfMedication - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports StatusOfMedication as hQuery.StatusOfMedication\n*/\n\n\nhQuery.StatusOfMedication = (function(_super) {\n var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;\n\n __extends(StatusOfMedication, _super);\n\n function StatusOfMedication() {\n _ref1 = StatusOfMedication.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n ON_HOLD = \"392521001\";\n\n NO_LONGER_ACTIVE = \"421139008\";\n\n ACTIVE = \"55561003\";\n\n PRIOR_HISTORY = \"73425007\";\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isOnHold = function() {\n return this.c === ON_HOLD;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isNoLongerActive = function() {\n return this.c === NO_LONGER_ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isActive = function() {\n return this.c === ACTIVE;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n StatusOfMedication.prototype.isPriorHistory = function() {\n return this.c === PRIOR_HISTORY;\n };\n\n return StatusOfMedication;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a medication entry for a patient.\n@augments hQuery.CodedEntry\n@exports Medication as hQuery.Medication\n*/\n\n\nhQuery.Medication = (function(_super) {\n __extends(Medication, _super);\n\n function Medication(json) {\n this.json = json;\n Medication.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.freeTextSig = function() {\n return this.json['freeTextSig'];\n };\n\n /**\n The actual or intended start of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication stop\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStart = function() {\n return hQuery.dateFromUtcSeconds(this.json['start_time']);\n };\n\n /**\n The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since\n it combines this with medication start\n @returns {Date}\n */\n\n\n Medication.prototype.indicateMedicationStop = function() {\n return hQuery.dateFromUtcSeconds(this.json['end_time']);\n };\n\n Medication.prototype.administrationTiming = function() {\n if (this.json['administrationTiming']) {\n return new hQuery.AdministrationTiming(this.json['administrationTiming']);\n }\n };\n\n /**\n @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.\n Route code shall have a a value drawn from FDA route of adminstration,\n and indicates how the medication is received by the patient.\n See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829\n The administration unit code shall have a value drawn from the FDA\n dosage form, source NCI thesaurus and represents the physical form of the\n product as presented to the patient.\n See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm\n */\n\n\n Medication.prototype.route = function() {\n return hQuery.createCodedValue(this.json['route']);\n };\n\n /**\n @returns {hQuery.Scalar} the dose\n */\n\n\n Medication.prototype.dose = function() {\n if (this.json['dose']) {\n return new hQuery.Scalar(this.json['dose']);\n }\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.site = function() {\n if (this.json['site']) {\n return hQuery.createCodedValue(this.json['site']);\n }\n };\n\n /**\n @returns {hQuery.DoseRestriction}\n */\n\n\n Medication.prototype.doseRestriction = function() {\n if (this.json['doseRestriction']) {\n return new hQuery.DoseRestriction(this.json['doseRestriction']);\n }\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.doseIndicator = function() {\n return this.json['doseIndicator'];\n };\n\n /**\n @returns {String}\n */\n\n\n Medication.prototype.fulfillmentInstructions = function() {\n return this.json['fulfillmentInstructions'];\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.indication = function() {\n return hQuery.createCodedValue(this.json['indication']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.productForm = function() {\n return hQuery.createCodedValue(this.json['productForm']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.vehicle = function() {\n return hQuery.createCodedValue(this.json['vehicle']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Medication.prototype.deliveryMethod = function() {\n return hQuery.createCodedValue(this.json['deliveryMethod']);\n };\n\n /**\n @returns {hQuery.MedicationInformation}\n */\n\n\n Medication.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication\n */\n\n\n Medication.prototype.typeOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.TypeOfMedication((_ref2 = this.json['typeOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['typeOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status\n Values may be: On Hold, No Longer Active, Active, Prior History\n @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.\n */\n\n\n Medication.prototype.statusOfMedication = function() {\n var _ref2, _ref3;\n\n return new hQuery.StatusOfMedication((_ref2 = this.json['statusOfMedication']) != null ? _ref2['code'] : void 0, (_ref3 = this.json['statusOfMedication']) != null ? _ref3['codeSystem'] : void 0);\n };\n\n /**\n @returns {String} free text instructions to the patient\n */\n\n\n Medication.prototype.patientInstructions = function() {\n return this.json['patientInstructions'];\n };\n\n /**\n The duration over which this medication has been active. For example, 5 days.\n @returns {Hash} with two keys: unit and scalar\n */\n\n\n Medication.prototype.cumulativeMedicationDuration = function() {\n return this.json['cumulativeMedicationDuration'];\n };\n\n /**\n @returns {Array} an array of {@link FulFillment} objects\n */\n\n\n Medication.prototype.fulfillmentHistory = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['fulfillmentHistory'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.Fulfillment(order));\n }\n return _results;\n };\n\n /**\n @returns {Array} an array of {@link OrderInformation} objects\n */\n\n\n Medication.prototype.orderInformation = function() {\n var order, _i, _len, _ref2, _results;\n\n _ref2 = this.json['orderInformation'];\n _results = [];\n for (_i = 0, _len = _ref2.length; _i < _len; _i++) {\n order = _ref2[_i];\n _results.push(new hQuery.OrderInformation(order));\n }\n return _results;\n };\n\n return Medication;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class CauseOfDeath\n@exports CauseOfDeath as hQuery.CauseOfDeath\n*/\n\n\nhQuery.CauseOfDeath = (function() {\n function CauseOfDeath(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Date}\n */\n\n\n CauseOfDeath.prototype.timeOfDeath = function() {\n return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);\n };\n\n /**\n @returns {int}\n */\n\n\n CauseOfDeath.prototype.ageAtDeath = function() {\n return this.json['ageAtDeath'];\n };\n\n return CauseOfDeath;\n\n})();\n\n/**\n@class hQuery.Condition\n\nThis section is used to describe a patients problems/conditions. The types of conditions\ndescribed have been constrained to the SNOMED CT Problem Type code set. An unbounded\nnumber of treating providers for the particular condition can be supplied.\n@exports Condition as hQuery.Condition \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Condition = (function(_super) {\n __extends(Condition, _super);\n\n function Condition(json) {\n this.json = json;\n Condition.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {Array, hQuery.Provider} an array of providers for the condition\n */\n\n\n Condition.prototype.providers = function() {\n var provider, _i, _len, _ref, _results;\n\n _ref = this.json['treatingProviders'];\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n provider = _ref[_i];\n _results.push(new Provider(provider));\n }\n return _results;\n };\n\n /**\n Diagnosis Priority\n @returns {int}\n */\n\n\n Condition.prototype.diagnosisPriority = function() {\n return this.json['priority'];\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Condition.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n /**\n age at onset\n @returns {int}\n */\n\n\n Condition.prototype.ageAtOnset = function() {\n return this.json['ageAtOnset'];\n };\n\n /**\n cause of death\n @returns {hQuery.CauseOfDeath}\n */\n\n\n Condition.prototype.causeOfDeath = function() {\n if (this.json['causeOfDeath']) {\n return new hQuery.CauseOfDeath(this.json['causeOfDeath']);\n }\n };\n\n /**\n problem status\n @returns {hQuery.CodedValue}\n */\n\n\n Condition.prototype.problemStatus = function() {\n return hQuery.createCodedValue(this.json['problemStatus']);\n };\n\n /**\n comment\n @returns {String}\n */\n\n\n Condition.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n This is a description of the level of the severity of the condition.\n @returns {CodedValue}\n */\n\n\n Condition.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n return Condition;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nAn Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner who is vested with primary responsibility for diagnosing, evaluating,\nor treating the patients condition. It may include visits, appointments, as well\nas non face-to-face interactions. It is also a contact between a patient and a\npractitioner who has primary responsibility for assessing and treating the\npatient at a given contact, exercising independent judgment.\n@class An Encounter is an interaction, regardless of the setting, between a patient and a\npractitioner\n@augments hQuery.CodedEntry\n@exports Encounter as hQuery.Encounter\n*/\n\n\nhQuery.Encounter = (function(_super) {\n __extends(Encounter, _super);\n\n function Encounter(json) {\n this.json = json;\n Encounter.__super__.constructor.call(this, this.json);\n if (this.json['admitTime']) {\n this._admitTime = hQuery.dateFromUtcSeconds(this.json['admitTime']);\n }\n if (this.json['dischargeTime']) {\n this._dischargeTime = hQuery.dateFromUtcSeconds(this.json['dischargeTime']);\n }\n if (this.json['facility']) {\n this._facility = new hQuery.Facility(this.json['facility']);\n }\n }\n\n /**\n @returns {String}\n */\n\n\n Encounter.prototype.dischargeDisposition = function() {\n return this.json['dischargeDisposition'];\n };\n\n /**\n A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from\n National Uniform Billing Committee (NUBC)\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.admitType = function() {\n return hQuery.createCodedValue(this.json['admitType']);\n };\n\n /**\n Date and time at which the patient was admitted for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.admitTime = function() {\n return this._admitTime;\n };\n\n /**\n Date and time at which the patient was discharged for the encounter\n @returns {Date}\n */\n\n\n Encounter.prototype.dischargeTime = function() {\n return this._dischargeTime;\n };\n\n /**\n @returns {hQuery.Actor}\n */\n\n\n Encounter.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Encounter.prototype.facility = function() {\n return this._facility;\n };\n\n Encounter.prototype.facilityArrival = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.startDate() : void 0;\n };\n\n Encounter.prototype.facilityDeparture = function() {\n var _ref;\n\n return (_ref = this._facility) != null ? _ref.endDate() : void 0;\n };\n\n /**\n @returns {hQuery.CodedEntry}\n */\n\n\n Encounter.prototype.reasonForVisit = function() {\n if (this.json['reason']) {\n return new hQuery.CodedEntry(this.json['reason']);\n }\n };\n\n /**\n @returns {Integer}\n */\n\n\n Encounter.prototype.lengthOfStay = function() {\n if (!((this.startDate() != null) && (this.endDate() != null))) {\n return 0;\n }\n return Math.floor((this.endDate() - this.startDate()) / (1000 * 60 * 60 * 24));\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferTo = function() {\n return hQuery.createCodedValue(this.json['transferTo']);\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Encounter.prototype.transferFrom = function() {\n return hQuery.createCodedValue(this.json['transferFrom']);\n };\n\n return Encounter;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis represents all interventional, surgical, diagnostic, or therapeutic procedures or \ntreatments pertinent to the patient.\n@class\n@augments hQuery.CodedEntry\n@exports Procedure as hQuery.Procedure\n*/\n\n\nhQuery.Procedure = (function(_super) {\n __extends(Procedure, _super);\n\n function Procedure(json) {\n this.json = json;\n Procedure.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.Actor} The provider that performed the procedure\n */\n\n\n Procedure.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the \n procedure was performed\n */\n\n\n Procedure.prototype.site = function() {\n var _ref, _ref1;\n\n return new hQuery.CodedValue((_ref = this.json['site']) != null ? _ref['code'] : void 0, (_ref1 = this.json['site']) != null ? _ref1['codeSystem'] : void 0);\n };\n\n /**\n @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.\n */\n\n\n Procedure.prototype.source = function() {\n return hQuery.createCodedValue(this.json['source']);\n };\n\n /**\n @returns {Date} The actual or intended start of an incision.\n */\n\n\n Procedure.prototype.incisionTime = function() {\n if (this.json['incisionTime']) {\n return hQuery.dateFromUtcSeconds(this.json['incisionTime']);\n }\n };\n\n /**\n Ordinality\n @returns {CodedValue}\n */\n\n\n Procedure.prototype.ordinality = function() {\n return hQuery.createCodedValue(this.json['ordinality']);\n };\n\n return Procedure;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nObservations generated by laboratories, imaging procedures, and other procedures. The scope\nincludes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,\nultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure\nobservations.\n@class\n@augments hQuery.CodedEntry\n@exports Result as hQuery.Result\n*/\n\n\nhQuery.Result = (function(_super) {\n __extends(Result, _super);\n\n function Result(json) {\n this.json = json;\n Result.__super__.constructor.call(this, this.json);\n }\n\n /**\n ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3\n Summary of CCD value sets), used to categorize a result into one of several commonly accepted values\n (e.g. Hematology, Chemistry, Nuclear Medicine).\n @returns {CodedValue}\n */\n\n\n Result.prototype.resultType = function() {\n return this.type();\n };\n\n /**\n @returns {CodedValue}\n */\n\n\n Result.prototype.interpretation = function() {\n return hQuery.createCodedValue(this.json['interpretation']);\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.referenceRange = function() {\n return this.json['referenceRange'];\n };\n\n /**\n @returns {String}\n */\n\n\n Result.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Result;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nNoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\nThe terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\nIt indicates the reason an immunization was not administered.\n\n@class NoImmunization - describes the status of the medication\n@augments hQuery.CodedEntry\n@exports NoImmunization as hQuery.NoImmunization\n*/\n\n\nhQuery.NoImmunization = (function(_super) {\n var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;\n\n __extends(NoImmunization, _super);\n\n function NoImmunization() {\n _ref = NoImmunization.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n IMMUNITY = \"IMMUNE\";\n\n MED_PRECAUTION = \"MEDPREC\";\n\n OUT_OF_STOCK = \"OSTOCK\";\n\n PAT_OBJ = \"PATOBJ\";\n\n PHIL_OBJ = \"PHILISOP\";\n\n REL_OBJ = \"RELIG\";\n\n VAC_EFF = \"VACEFF\";\n\n VAC_SAFETY = \"VACSAF\";\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isImmune = function() {\n return this.c === IMMUNITY;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isMedPrec = function() {\n return this.c === MED_PRECAUTION;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isOstock = function() {\n return this.c === OUT_OF_STOCK;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPatObj = function() {\n return this.c === PAT_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isPhilisop = function() {\n return this.c === PHIL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isRelig = function() {\n return this.c === REL_OBJ;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacEff = function() {\n return this.c === VAC_EFF;\n };\n\n /**\n @returns {Boolean}\n */\n\n\n NoImmunization.prototype.isVacSaf = function() {\n return this.c === VAC_SAFETY;\n };\n\n return NoImmunization;\n\n})(hQuery.CodedValue);\n\n/**\n@class represents a immunization entry for a patient.\n@augments hQuery.CodedEntry\n@exports Immunization as hQuery.Immunization\n*/\n\n\nhQuery.Immunization = (function(_super) {\n __extends(Immunization, _super);\n\n function Immunization(json) {\n this.json = json;\n Immunization.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns{hQuery.Scalar}\n */\n\n\n Immunization.prototype.medicationSeriesNumber = function() {\n if (this.json['medicationSeriesNumber']) {\n return new hQuery.Scalar(this.json['medicationSeriesNumber']);\n }\n };\n\n /**\n @returns{hQuery.MedicationInformation}\n */\n\n\n Immunization.prototype.medicationInformation = function() {\n return new hQuery.MedicationInformation(this.json);\n };\n\n /**\n @returns{Date} Date immunization was administered\n */\n\n\n Immunization.prototype.administeredDate = function() {\n return dateFromUtcSeconds(this.json['administeredDate']);\n };\n\n /**\n @returns{hQuery.Actor} Performer of immunization\n */\n\n\n Immunization.prototype.performer = function() {\n if (this.json['performer']) {\n return new hQuery.Actor(this.json['performer']);\n }\n };\n\n /**\n @returns {comment} human readable description of event\n */\n\n\n Immunization.prototype.comment = function() {\n return this.json['comment'];\n };\n\n /**\n @returns {Boolean} whether the immunization has been refused by the patient.\n */\n\n\n Immunization.prototype.refusalInd = function() {\n return this.json['negationInd'];\n };\n\n /**\n NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717\n The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7\n It indicates the reason an immunization was not administered.\n @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.\n */\n\n\n Immunization.prototype.refusalReason = function() {\n var _ref1, _ref2;\n\n return new hQuery.NoImmunization((_ref1 = this.json['negationReason']) != null ? _ref1['code'] : void 0, (_ref2 = this.json['negationReason']) != null ? _ref2['codeSystem'] : void 0);\n };\n\n return Immunization;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Allergy as hQuery.Allergy\n*/\n\n\nhQuery.Allergy = (function(_super) {\n __extends(Allergy, _super);\n\n function Allergy(json) {\n this.json = json;\n Allergy.__super__.constructor.call(this, this.json);\n }\n\n /**\n Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA\n http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm\n \n Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types \n of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or \n Chemical Structure - N0000000002. NUI will be used as the concept code. \n For more information, please see the Web Site \n http://www.cancer.gov/cancertopics/terminologyresources/page5\n \n Allergies to a specific medication shall use RxNorm for the values. \n @returns {CodedValue}\n */\n\n\n Allergy.prototype.product = function() {\n return this.type();\n };\n\n /**\n Date of allergy or adverse event\n @returns{Date}\n */\n\n\n Allergy.prototype.adverseEventDate = function() {\n return dateFromUtcSeconds(this.json['adverseEventDate']);\n };\n\n /**\n Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.adverseEventType = function() {\n return hQuery.createCodedValue(this.json['type']);\n };\n\n /**\n This indicates the reaction that may be caused by the product or agent. \n It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.\n 420134006 Propensity to adverse reactions (disorder)\n 418038007 Propensity to adverse reactions to substance (disorder)\n 419511003 Propensity to adverse reactions to drug (disorder)\n 418471000 Propensity to adverse reactions to food (disorder)\n 419199007 Allergy to substance (disorder)\n 416098002 Drug allergy (disorder)\n 414285001 Food allergy (disorder)\n 59037007 Drug intolerance (disorder)\n 235719002 Food intolerance (disorder)\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.reaction = function() {\n return hQuery.createCodedValue(this.json['reaction']);\n };\n\n /**\n This is a description of the level of the severity of the allergy or intolerance.\n Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8\n 255604002 Mild\n 371923003 Mild to Moderate\n 6736007 Moderate\n 371924009 Moderate to Severe\n 24484000 Severe\n 399166001 Fatal\n @returns {CodedValue}\n */\n\n\n Allergy.prototype.severity = function() {\n return hQuery.createCodedValue(this.json['severity']);\n };\n\n /**\n Additional comment or textual information\n @returns {String}\n */\n\n\n Allergy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Allergy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n\n@exports Provider as hQuery.Provider\n*/\n\n\nhQuery.Provider = (function() {\n function Provider(json) {\n this.json = json;\n }\n\n /**\n @returns {hQuery.Person}\n */\n\n\n Provider.prototype.providerEntity = function() {\n if (this.json['providerEntity']) {\n return new hQuery.Person(this.json['providerEntity']);\n }\n };\n\n /**\n @returns {hQuery.DateRange}\n */\n\n\n Provider.prototype.careProvisionDateRange = function() {\n if (this.json['careProvisionDateRange']) {\n return new hQuery.DateRange(this.json['careProvisionDateRange']);\n }\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.role = function() {\n return hQuery.createCodedValue(this.json['role']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.patientID = function() {\n return this.json['patientID'];\n };\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Provider.prototype.providerType = function() {\n return hQuery.createCodedValue(this.json['providerType']);\n };\n\n /**\n @returns {String}\n */\n\n\n Provider.prototype.providerID = function() {\n return this.json['providerID'];\n };\n\n /**\n @returns {hQuery.Organization}\n */\n\n\n Provider.prototype.organizationName = function() {\n return new hQuery.Organization(this.json);\n };\n\n return Provider;\n\n})();\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class \n@augments hQuery.CodedEntry\n@exports Language as hQuery.Language\n*/\n\n\nhQuery.Language = (function(_super) {\n __extends(Language, _super);\n\n function Language(json) {\n this.json = json;\n Language.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {hQuery.CodedValue}\n */\n\n\n Language.prototype.modeCode = function() {\n return hQuery.createCodedValue(this.json['modeCode']);\n };\n\n /**\n @returns {String}\n */\n\n\n Language.prototype.preferenceIndicator = function() {\n return this.json['preferenceIndicator'];\n };\n\n return Language;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis includes information about the patients current and past pregnancy status\nThe Coded Entry code system should be SNOMED-CT\n@class\n@augments hQuery.CodedEntry\n@exports Pregnancy as hQuery.Pregnancy\n*/\n\n\nhQuery.Pregnancy = (function(_super) {\n __extends(Pregnancy, _super);\n\n function Pregnancy(json) {\n this.json = json;\n Pregnancy.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {String}\n */\n\n\n Pregnancy.prototype.comment = function() {\n return this.json['comment'];\n };\n\n return Pregnancy;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle), \nsocial, and environmental history and health risk factors, as well as administrative data such as \nmarital status, race, ethnicity and religious affiliation. The types of conditions\ndescribed have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:\n229819007 Tobacco use and exposure\n256235009 Exercise\n160573003 Alcohol Intake\n364393001 Nutritional observable\n364703007 Employment detail\n425400000 Toxic exposure status\n363908000 Details of drug misuse behavior\n228272008 Health-related behavior\n105421008 Educational achievement\n\nnote: Social History is not part of the existing green c32.\n@exports Socialhistory as hQuery.Socialhistory \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.Socialhistory = (function(_super) {\n __extends(Socialhistory, _super);\n\n function Socialhistory(json) {\n this.json = json;\n Socialhistory.__super__.constructor.call(this, this.json);\n }\n\n /**\n Value returns the value of the result. This will return an object. The properties of this\n object are dependent on the type of result.\n */\n\n\n Socialhistory.prototype.value = function() {\n return this.json['value'];\n };\n\n return Socialhistory;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.\n\n@exports CareGoal as hQuery.CareGoal \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.CareGoal = (function(_super) {\n __extends(CareGoal, _super);\n\n function CareGoal(json) {\n this.json = json;\n CareGoal.__super__.constructor.call(this, this.json);\n }\n\n return CareGoal;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n\nThe Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.\n\nThe template identifier for this section is 2.16.840.1.113883.3.88.11.83.128\n\nC83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.\nC83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5\n\n@exports MedicalEquipment as hQuery.MedicalEquipment \n@augments hQuery.CodedEntry\n*/\n\n\nhQuery.MedicalEquipment = (function(_super) {\n __extends(MedicalEquipment, _super);\n\n function MedicalEquipment(json) {\n this.json = json;\n MedicalEquipment.__super__.constructor.call(this, this.json);\n }\n\n /**\n @returns {CodedValue}\n */\n\n\n MedicalEquipment.prototype.anatomicalStructure = function() {\n return hQuery.createCodedValue(this.json['anatomicalStructure']);\n };\n\n /**\n @returns {Date} The actual or intended removal time of the device.\n */\n\n\n MedicalEquipment.prototype.removalTime = function() {\n if (this.json['removalTime']) {\n return hQuery.dateFromUtcSeconds(this.json['removalTime']);\n }\n };\n\n return MedicalEquipment;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\nThis class can be used to represnt a functional status for a patient. Currently,\nit is not a very close representation of functional status as it is represented\nin the HL7 CCD, HITSP C32 or Consolidated CDA.\n\nIn the previously mentioned specifications, functional status may represented\nusing either a condition or result. Having \"mixed\" types of entries in a section\nis currently not well supported in the existing Record class\n\nAdditionally, there is a mismatch between the data needed to calculate Stage 2\nMeaningful Use Quailty Measures and the data contained in patient summary\nstandards. The CQMs are checking to see if a functional status represented by\na result was patient supplied. Right now, results do not have a source, and\neven if we were to use Provider as a source, it would need to be extended\nto support patients.\n\nTo avoid this, the patient sumamry style functional status has been \"flattened\"\ninto this class. This model supports the information needed to calculate\nStage 2 MU CQMs. If importers are created from C32 or CCDA, the information\ncan be stored here, but it will be a lossy transformation.\n@class\n@augments hQuery.CodedEntry\n@exports FunctionalStatus as hQuery.FunctionalStatus\n*/\n\n\nhQuery.FunctionalStatus = (function(_super) {\n __extends(FunctionalStatus, _super);\n\n function FunctionalStatus(json) {\n this.json = json;\n FunctionalStatus.__super__.constructor.call(this, this.json);\n }\n\n /**\n Either \"condition\" or \"result\"\n @returns {String}\n */\n\n\n FunctionalStatus.prototype.type = function() {\n return this.json[\"type\"];\n };\n\n /**\n A coded value. Like a code for patient supplied.\n @returns {hQuery.CodedValue}\n */\n\n\n FunctionalStatus.prototype.source = function() {\n return hQuery.createCodedValue(this.json[\"source\"]);\n };\n\n return FunctionalStatus;\n\n})(hQuery.CodedEntry);\n/**\n@namespace scoping into the hquery namespace\n*/\n\nvar _ref,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\nthis.hQuery || (this.hQuery = {});\n\n/**\n@class Supports\n@exports Supports as hQuery.Supports\n*/\n\n\nhQuery.Supports = (function() {\n function Supports(json) {\n this.json = json;\n }\n\n /**\n @returns {DateRange}\n */\n\n\n Supports.prototype.supportDate = function() {\n return new hQuery.DateRange(this.json['supportDate']);\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.guardian = function() {\n return new hQuery.Person(this.json['guardian']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.guardianSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n /**\n @returns {Person}\n */\n\n\n Supports.prototype.contact = function() {\n return new hQuery.Person(this.json['contact']);\n };\n\n /**\n @returns {String}\n */\n\n\n Supports.prototype.contactSupportType = function() {\n return this.json['guardianSupportType'];\n };\n\n return Supports;\n\n})();\n\n/**\n@class Representation of a patient\n@augments hQuery.Person\n@exports Patient as hQuery.Patient\n*/\n\n\nhQuery.Patient = (function(_super) {\n __extends(Patient, _super);\n\n function Patient() {\n _ref = Patient.__super__.constructor.apply(this, arguments);\n return _ref;\n }\n\n /**\n @returns {String} containing M or F representing the gender of the patient\n */\n\n\n Patient.prototype.gender = function() {\n return this.json['gender'];\n };\n\n /**\n @returns {Date} containing the patients birthdate\n */\n\n\n Patient.prototype.birthtime = function() {\n return hQuery.dateFromUtcSeconds(this.json['birthdate']);\n };\n\n /**\n @param (Date) date the date at which the patient age is calculated, defaults to now.\n @returns {number} the patient age in years\n */\n\n\n Patient.prototype.age = function(date) {\n var oneDay, oneYear;\n\n if (date == null) {\n date = new Date();\n }\n oneDay = 24 * 60 * 60 * 1000;\n oneYear = 365 * oneDay;\n return (date.getTime() - this.birthtime().getTime()) / oneYear;\n };\n\n /**\n @returns {CodedValue} the domestic partnership status of the patient\n The following HL7 codeset is used:\n A Annulled\n D Divorced\n I Interlocutory\n L Legally separated\n M Married\n P Polygamous\n S Never Married\n T Domestic Partner\n W Widowed\n */\n\n\n Patient.prototype.maritalStatus = function() {\n if (this.json['maritalStatus']) {\n return hQuery.createCodedValue(this.json['maritalStatus']);\n }\n };\n\n /**\n @returns {CodedValue} of the spiritual faith affiliation of the patient\n It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008\n */\n\n\n Patient.prototype.religiousAffiliation = function() {\n if (this.json['religiousAffiliation']) {\n return hQuery.createCodedValue(this.json['religiousAffiliation']);\n }\n };\n\n /**\n @returns {CodedValue} of the race of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.race = function() {\n if (this.json['race']) {\n return hQuery.createCodedValue(this.json['race']);\n }\n };\n\n /**\n @returns {CodedValue} of the ethnicity of the patient\n CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9\n */\n\n\n Patient.prototype.ethnicity = function() {\n if (this.json['ethnicity']) {\n return hQuery.createCodedValue(this.json['ethnicity']);\n }\n };\n\n /**\n @returns {CodedValue} This is the code specifying the level of confidentiality of the document.\n HL7 Confidentiality Code (2.16.840.1.113883.5.25)\n */\n\n\n Patient.prototype.confidentiality = function() {\n if (this.json['confidentiality']) {\n return hQuery.createCodedValue(this.json['confidentiality']);\n }\n };\n\n /**\n @returns {Address} of the location where the patient was born\n */\n\n\n Patient.prototype.birthPlace = function() {\n return new hQuery.Address(this.json['birthPlace']);\n };\n\n /**\n @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin\n */\n\n\n Patient.prototype.supports = function() {\n return new hQuery.Supports(this.json['supports']);\n };\n\n /**\n @returns {Organization}\n */\n\n\n Patient.prototype.custodian = function() {\n return new hQuery.Organization(this.json['custodian']);\n };\n\n /**\n @returns {Provider} the providers associated with the patient\n */\n\n\n Patient.prototype.provider = function() {\n return new hQuery.Provider(this.json['provider']);\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects\n Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language\n */\n\n\n Patient.prototype.languages = function() {\n var language, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['languages']) {\n _ref1 = this.json['languages'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n language = _ref1[_i];\n list.push(new hQuery.Language(language));\n }\n }\n return list;\n };\n\n /**\n @returns {Boolean} returns true if the patient has died\n */\n\n\n Patient.prototype.expired = function() {\n return this.json['expired'];\n };\n\n /**\n @returns {Boolean} returns true if the patient participated in a clinical trial\n */\n\n\n Patient.prototype.clinicalTrialParticipant = function() {\n return this.json['clinicalTrialParticipant'];\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects\n */\n\n\n Patient.prototype.encounters = function() {\n var encounter, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['encounters']) {\n _ref1 = this.json['encounters'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n encounter = _ref1[_i];\n list.pushIfUsable(new hQuery.Encounter(encounter));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Medication} objects\n */\n\n\n Patient.prototype.medications = function() {\n var list, medication, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medications']) {\n _ref1 = this.json['medications'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n medication = _ref1[_i];\n list.pushIfUsable(new hQuery.Medication(medication));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Condition} objects\n */\n\n\n Patient.prototype.conditions = function() {\n var condition, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['conditions']) {\n _ref1 = this.json['conditions'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n condition = _ref1[_i];\n list.pushIfUsable(new hQuery.Condition(condition));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects\n */\n\n\n Patient.prototype.procedures = function() {\n var list, procedure, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['procedures']) {\n _ref1 = this.json['procedures'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n procedure = _ref1[_i];\n list.pushIfUsable(new hQuery.Procedure(procedure));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.results = function() {\n var list, result, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['results']) {\n _ref1 = this.json['results'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n result = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(result));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Result} objects\n */\n\n\n Patient.prototype.vitalSigns = function() {\n var list, vital, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['vital_signs']) {\n _ref1 = this.json['vital_signs'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n vital = _ref1[_i];\n list.pushIfUsable(new hQuery.Result(vital));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects\n */\n\n\n Patient.prototype.immunizations = function() {\n var immunization, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['immunizations']) {\n _ref1 = this.json['immunizations'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n immunization = _ref1[_i];\n list.pushIfUsable(new hQuery.Immunization(immunization));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects\n */\n\n\n Patient.prototype.allergies = function() {\n var allergy, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['allergies']) {\n _ref1 = this.json['allergies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n allergy = _ref1[_i];\n list.pushIfUsable(new hQuery.Allergy(allergy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects\n */\n\n\n Patient.prototype.pregnancies = function() {\n var list, pregnancy, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['pregnancies']) {\n _ref1 = this.json['pregnancies'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n pregnancy = _ref1[_i];\n list.pushIfUsable(new hQuery.Pregnancy(pregnancy));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects\n */\n\n\n Patient.prototype.socialHistories = function() {\n var list, socialhistory, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['socialhistories']) {\n _ref1 = this.json['socialhistories'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n socialhistory = _ref1[_i];\n list.pushIfUsable(new hQuery.Socialhistory(socialhistory));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects\n */\n\n\n Patient.prototype.careGoals = function() {\n var caregoal, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['care_goals']) {\n _ref1 = this.json['care_goals'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n caregoal = _ref1[_i];\n list.pushIfUsable(new hQuery.CareGoal(caregoal));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects\n */\n\n\n Patient.prototype.medicalEquipment = function() {\n var equipment, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['medical_equipment']) {\n _ref1 = this.json['medical_equipment'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n equipment = _ref1[_i];\n list.pushIfUsable(new hQuery.MedicalEquipment(equipment));\n }\n }\n return list;\n };\n\n /**\n @returns {hQuery.CodedEntryList} A list of {@link FunctionalStatus} objects\n */\n\n\n Patient.prototype.functionalStatuses = function() {\n var fs, list, _i, _len, _ref1;\n\n list = new hQuery.CodedEntryList;\n if (this.json['functional_statuses']) {\n _ref1 = this.json['functional_statuses'];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n fs = _ref1[_i];\n list.pushIfUsable(new hQuery.FunctionalStatus(fs));\n }\n }\n return list;\n };\n\n return Patient;\n\n})(hQuery.Person);\n\n \n function map(patient) {\n var targetMedicationCodes = {\n \"whoATC\": [\"C01AA05\"],\n \"HC-DIN\": [\"02281236\", \"02281228\", \"02281201\", \"02245428\", \"02245427\",\n \"02245426\", \"02048264\", \"02048272\", \"0021415\", \"00698296\", \"00647470\"]\n };\n\n var targetLabCodes = {\n \"LOINC\": [\"45066-8\", \"2160-0\", \"33914-3\", \"50044-7\", \"48642-3\", \"48643-1\"]\n };\n\n var ageLimit = 65;\n\n var drugList = patient.medications();\n var resultList = patient.results();\n\n var now = new Date(2013, 5, 12);\n var start = new Date(2000, 6, 1);\n var end = addDate(now, 0, 1, 0);\n\n function addDate(date, y, m, d) {\n var n = new Date(date);\n n.setFullYear(date.getFullYear() + (y || 0));\n n.setMonth(date.getMonth() + (m || 0));\n n.setDate(date.getDate() + (d || 0));\n return n;\n }\n\n // Checks if patient is older than ageLimit\n function population(patient) {\n return (patient.age(now) >= ageLimit);\n }\n\n // Checks for Creatinine labs performed within the last year\n function hasLabCode(patient) {\n return resultList.match(targetLabCodes, addDate(now, -1, 0, 0), end).length;\n }\n\n // Checks for existence of Digoxin\n function hasMedication(patient) {\n return drugList.match(targetMedicationCodes, start, end).length;\n }\n\n function hasCurrentMedication(patient) {\n for (var i = 0; i < drugList.length; i++) {\n var tmpArray = new hQuery.CodedEntryList();\n tmpArray[0] = drugList[i];\n if (tmpArray.match(targetMedicationCodes)) {\n var drugStart = drugList[i].indicateMedicationStart().getTime();\n var drugEnd = drugList[i].indicateMedicationStop().getTime();\n\n // Check if drug is within the right time\n if (drugEnd >= now && drugStart <= now) {\n return true;\n }\n }\n }\n return false;\n }\n\n emit('total_pop', 1);\n\n if (population(patient)) {\n //emit(\"senior_pop: \" + patient.given() + \" \" + patient.last(), 1);\n emit(\"senior_pop\", 1);\n if (hasLabCode(patient)) {\n if (hasMedication(patient) && hasCurrentMedication(patient)) {\n //emit(\"Digoxin: \" + patient.given() + \" \" + patient.last(), 1);\n //emit(\"Creatinine: \" + patient.given() + \" \" + patient.last(), 1);\n var c = patient.results();\n for (var i = 0; i < c.length; i++) {\n if (c[i].interpretation().code() == \"A\") {\n //emit(\"Abnormal Creatinine: \" + patient.given() + \" \" + patient.last(), 1);\n emit(\"senior_pop_digoxin_creatinine_abnormal\", 1);\n }\n }\n }\n }\n }\n}\n\n var patient = new hQuery.Patient(this);\n if (Specifics.initialize) {\n Specifics.initialize();\n }\n map(patient);\n };", :reduce=>"function(k,v){\n \n var iter = function(x){\n this.index = 0;\n this.arr = (x==null)? [] : x;\n \n this.hasNext = function(){\n return this.index < this.arr.length;\n };\n \n this.next = function(){\n return this.arr[this.index++];\n }\n };\n \n function reduce(key, values) {\n var result = 0;\n\n while (values.hasNext()) {\n result += values.next();\n }\n\n return result;\n}\n\n return reduce(k,new iter(v));\n }", :query=>{}, :out=>{:inline=>true}} - @fields=nil> - failed with error "ns doesn't exist" - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:99:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `[]' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:587:in `block (3 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `map' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:586:in `block (2 levels) in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:150:in `ensure_connected' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:582:in `block in flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:597:in `logging' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:581:in `flush' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:570:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:92:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:51:in `block in command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:109:in `block in with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:209:in `block in with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/node.rb:195:in `ensure_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/cluster.rb:208:in `with_primary' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:108:in `with_node' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session/context.rb:50:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/database.rb:76:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/moped-1.5.0/lib/moped/session.rb:78:in `command' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:289:in `results' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/mongoid-3.0.23/lib/mongoid/contextual/map_reduce.rb:162:in `raw' - lib/mongo_query_executor.rb:26:in `execute' - lib/query_job.rb:8:in `perform' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `block in initialize' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in `execute' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in `invoke_job' - test/unit/scoop_job_test.rb:72:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in `_run__3391881074828016485__setup__3910212107482292106__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -Finished in 5.794980 seconds. - -19 tests, 10 passed, 2 failures, 7 errors, 0 skips, 24 assertions - -WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 - SECURITY WARNING: No secret option provided to Rack::Session::Cookie. - This poses a security threat. It is strongly recommended that you - provide a secret to prevent exploits that may be possible from crafted - cookies. This will not be supported in future versions of Rack, and - future versions will even invalidate your existing user cookies. - - Called from: /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. - -Rack::File headers parameter replaces cache_control after Rack 1.5. - -*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`. - -Loaded Suite test,test/factories,test/functional,test/integration/importer,test/performance,test/unit/helpers,test/unit - -Started at 2013-07-04 16:22:50 -0700 w/ seed 50754. - -HdataControllerTest - PASS (0:00:00.222) should get and atom feed at index, if desired - PASS (0:00:00.375) should get index - PASS (0:00:00.528) should get root - -PmnControllerTest - PASS (0:00:00.899) should create a new PMN request with native JS - -QueriesControllerTest - PASS (0:00:02.315) HQMF form upload processing - PASS (0:00:03.284) POST should add a new job from HQMF - PASS (0:00:03.463) POST should add a new job with filter and functions - - PASS (0:00:03.612) POST should add a new job without filter or functions - PASS (0:00:03.753) should get a form at new - PASS (0:00:03.906) should get an atom feed at index - PASS (0:00:04.104) should reject jobs without a reduce function - ERROR (0:00:04.245) should show JSON for a successful job - No route matches {:action=>"show", :controller=>"results", :id=>nil} - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:532:in `raise_routing_error' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:528:in `rescue in generate' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:520:in `generate' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:561:in `generate' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:586:in `url_for' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/url_for.rb:148:in `url_for' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:213:in `result_url' - app/controllers/queries_controller.rb:52:in `show' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1211291760765731366__process_action__2935680412871421367__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:469:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:49:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:386:in `get' - test/functional/queries_controller_test.rb:62:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:458:in `_run__982015856664391190__setup__1198230082574878696__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -RecordsControllerTest - PASS (0:00:04.451) should POST a C32 to create - ERROR (0:00:04.585) should POST a E2E to create - uninitialized constant HealthDataStandards::Import::E2E - @ app/controllers/records_controller.rb:13:in `create' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__274140934617978993__process_action__2119836349403840075__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:469:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:49:in `process' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_controller/test_case.rb:391:in `post' - test/functional/records_controller_test.rb:22:in `block in ' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:458:in `_run__1920726951506855142__setup__1198230082574878696__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -ResultsControllerTest - PASS (0:00:04.791) should get an atom feed at index - PASS (0:00:05.043) should get an individual result - -Finished in 5.043800 seconds. - -16 tests, 14 passed, 0 failures, 2 errors, 0 skips, 72 assertions - -WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.1 - SECURITY WARNING: No secret option provided to Rack::Session::Cookie. - This poses a security threat. It is strongly recommended that you - provide a secret to prevent exploits that may be possible from crafted - cookies. This will not be supported in future versions of Rack, and - future versions will even invalidate your existing user cookies. - - Called from: /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. - -Rack::File headers parameter replaces cache_control after Rack 1.5. - -*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`. - -Loaded Suite test,test/factories,test/functional,test/integration/importer,test/performance,test/unit/helpers,test/unit - -Started at 2013-07-04 16:23:00 -0700 w/ seed 32834. - -DemographicsImporterApiTest - FAIL (0:00:00.411) demographics importing - <"FirstName"> expected but was - <"ELIZABETH">. - @ test/integration/importer/demographics_importer_api_test.rb:5:in `test_demographics_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__431334645960705777__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -EncounterImporterApiTest - FAIL (0:00:00.797) encounter importing - <1> expected but was - <0>. - @ test/integration/importer/encounter_importer_api_test.rb:5:in `test_encounter_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__4579578112627754533__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -ImmunizationsImporterApiTest - FAIL (0:00:01.165) imunizations importing - <4> expected but was - <0>. - @ test/integration/importer/immunizations_importer_api_test.rb:5:in `test_imunizations_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__3679144445520351986__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -MedicationsImporterApiTest - FAIL (0:00:01.515) medications importing - Failed assertion, no message given. - @ test/integration/importer/medications_importer_api_test.rb:5:in `test_medications_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__3685490420293127251__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -ProcedureImporterApiTest - ERROR (0:00:01.861) procedure importing - TypeError: Cannot call method 'type' of undefined - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:34:in `rescue in block in eval' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:28:in `block in eval' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `Locker' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `lock' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:27:in `eval' - test/integration/importer/procedure_importer_api_test.rb:5:in `test_procedure_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1825310941018774747__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -ResultsImporterApiTest - ERROR (0:00:02.229) results importing - TypeError: Cannot call method 'type' of undefined - @ /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:34:in `rescue in block in eval' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:28:in `block in eval' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `call' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `Locker' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `lock' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:27:in `eval' - test/integration/importer/results_importer_api_test.rb:5:in `test_results_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__1113957463528310751__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -VitalsImporterApiTest - FAIL (0:00:02.578) vitals importing - Failed assertion, no message given. - @ test/integration/importer/vitals_importer_api_test.rb:5:in `test_vitals_importing' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in `_run__485554421318113745__setup__469520946808616379__callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' - /Users/rrusk/.rvm/gems/ruby-1.9.3-p429@scoop/gems/activesupport-3.2.8/lib/active_support/testing/setup_and_teardown.rb:35:in `run' - - -Finished in 2.579911 seconds. - -7 tests, 0 passed, 5 failures, 2 errors, 0 skips, 5 assertions - -Errors running test:units! # -Errors running test:functionals! # -Errors running test:integration! # diff --git a/latest_specs.4.8 b/latest_specs.4.8 deleted file mode 100644 index 0ba94359df472e358cfe3fa92192fc82832db5b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4 LcmZSKh-Lr)0O9~> diff --git a/latest_specs.4.8.gz b/latest_specs.4.8.gz deleted file mode 100644 index a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ diff --git a/prerelease_specs.4.8 b/prerelease_specs.4.8 deleted file mode 100644 index 0ba94359df472e358cfe3fa92192fc82832db5b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4 LcmZSKh-Lr)0O9~> diff --git a/prerelease_specs.4.8.gz b/prerelease_specs.4.8.gz deleted file mode 100644 index a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ diff --git a/specs.4.8 b/specs.4.8 deleted file mode 100644 index 0ba94359df472e358cfe3fa92192fc82832db5b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4 LcmZSKh-Lr)0O9~> diff --git a/specs.4.8.gz b/specs.4.8.gz deleted file mode 100644 index a7d9cd513e19545e3a2ee6920eb2b26da75cc5a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 fcmb2|=3v;e>1rSYbMnKEGzNy8xm7<|7#J7;YX}GQ From 8829ca314ae9b993b5602195835922f348ff26ef Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 8 Jul 2013 14:21:16 -0700 Subject: [PATCH 052/205] Use health-data-standards v2.1.4 --- Gemfile | 2 +- Gemfile.lock | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index a62565e..4fe9546 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'delayed_job' gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' -gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :tag => 'fda23ee8678cfda314412e3e18815653bbcffb63' #, :branch => 'develop-preMongoid3' +gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :tag => 'v2.1.4' #, :branch => 'develop-preMongoid3' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index 8b4e4b8..2863f46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,14 +11,15 @@ GIT GIT remote: http://github.com/projectcypress/health-data-standards.git - revision: fda23ee8678cfda314412e3e18815653bbcffb63 - tag: fda23ee8678cfda314412e3e18815653bbcffb63 + revision: 7911c1f386b765d87c15361488614afa58cf8814 + tag: v2.1.4 specs: - health-data-standards (2.0.0) + health-data-standards (2.1.4) builder (~> 3.0.0) erubis (~> 2.7.0) mongoid (~> 3.0.6) nokogiri (~> 1.5.5) + rest-client (~> 1.6.7) uuid (~> 2.3.5) GIT @@ -180,6 +181,8 @@ GEM rdoc (3.12.2) json (~> 1.4) ref (1.0.5) + rest-client (1.6.7) + mime-types (>= 1.16) roo (1.10.1) choice (>= 0.1.4) google-spreadsheet-ruby (>= 0.1.5) From a9999c13b151d0aebc5a2a0e6844dd4713e4a259 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 8 Jul 2013 15:05:38 -0700 Subject: [PATCH 053/205] Added IT4B query Test Case Signed-off-by: Jeremy Ho --- test/fixtures/scoop/scoop_it4b_map.js | 110 ++++++++++++++++++++++++++ test/unit/scoop_job_test.rb | 14 ++++ 2 files changed, 124 insertions(+) create mode 100644 test/fixtures/scoop/scoop_it4b_map.js diff --git a/test/fixtures/scoop/scoop_it4b_map.js b/test/fixtures/scoop/scoop_it4b_map.js new file mode 100644 index 0000000..68c396d --- /dev/null +++ b/test/fixtures/scoop/scoop_it4b_map.js @@ -0,0 +1,110 @@ +function map(patient) { + var targetMedicationCodes = { + "whoATC": ["C01AA05"], + "HC-DIN": ["02281236", "02281228", "02281201", "02245428", "02245427", + "02245426", "02048264", "02048272", "0021415", "00698296", "00647470"] + }; + + var targetLabCodes = { + "LOINC": ["45066-8", "2160-0", "33914-3", "50044-7", "48642-3", "48643-1"] + }; + + var ageLimit = 65; + var creatinineLimit = 150; // Measured in umol/L + var digoxinLimit = .125; // Measured in MG + + var drugList = patient.medications(); + var resultList = patient.results(); + + var now = new Date(2013, 5, 12); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + // Checks for Creatinine labs performed within the last year + function hasLabCode() { + return resultList.match(targetLabCodes, addDate(now, -1, 0, 0), end).length; + } + + // Checks for existence of Digoxin + function hasMedication() { + return drugList.match(targetMedicationCodes, start, end).length; + } + + // Checks if Creatinine meets parameters + function hasMatchingLabValue() { + for (var i = 0; i < resultList.length; i++) { + if (resultList[i].values()[0].units() == "umol/L") { + if (resultList[i].values()[0].scalar() > creatinineLimit) { + //emit("Abnormal Creatinine: " + patient.given() + " " + patient.last(), 1); + return true; + } + ; + } + } + return false; + } + + // Checks if existing Digoxin is current + function hasCurrentMedication() { + for (var i = 0; i < drugList.length; i++) { + var tmpArray = new hQuery.CodedEntryList(); + tmpArray[0] = drugList[i]; + if (tmpArray.match(targetMedicationCodes)) { + var drugStart = drugList[i].indicateMedicationStart().getTime(); + var drugEnd = drugList[i].indicateMedicationStop().getTime(); + + // Check if drug is within the right time + if (drugEnd >= now && drugStart <= now) { + return true; + } + } + } + return false; + } + + // Checks if Digoxin meets dosage parameters + function hasMatchingMedicationDose() { + for (var i = 0; i < drugList.length; i++) { + var codes = drugList[i].medicationInformation().codedProduct(); + + // If Digoxin, check for dose parameter + for (var j = 0; j < codes.length; j++) { + if (codes[j].includedIn(targetMedicationCodes)) { + if (drugList[i].values()[0].units() == "MG") { + if (drugList[i].values()[0].scalar() > digoxinLimit) { + return true; + } + } + } + } + } + } + + emit('total_pop', 1); + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit("senior_pop", 1); + if (hasLabCode() && hasMedication()) { + //emit("Digoxin: " + patient.given() + " " + patient.last(), 1); + //emit("Creatinine: " + patient.given() + " " + patient.last(), 1); + if (hasMatchingLabValue() && hasCurrentMedication() && hasMatchingMedicationDose()) { + emit("senior_pop_digoxin_creatinine", 1); + } + } + } +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index bfaea41..c030f0c 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -76,4 +76,18 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["senior_pop_digoxin_creatinine_abnormal"].to_i, 2 assert_equal results["total_pop"].to_i, 9 end + + test "iteration 4b query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it4b_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["senior_pop"].to_i, 7 + assert_equal results["senior_pop_digoxin_creatinine"].to_i, 2 + assert_equal results["total_pop"].to_i, 9 + end end From f66b5baf22ac1d9cf01d90c041cd695e6c891c3c Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 8 Jul 2013 15:48:28 -0700 Subject: [PATCH 054/205] Cleanup SCOOP Map functions and .gitkeep maintenance Signed-off-by: Jeremy Ho --- app/models/.gitkeep | 0 lib/tasks/.gitkeep | 0 test/fixtures/.gitkeep | 0 test/fixtures/scoop/scoop_it0_map.js | 2 +- test/fixtures/scoop/scoop_it4_map.js | 10 +++++----- test/fixtures/scoop/scoop_it4b_map.js | 2 +- test/functional/.gitkeep | 0 test/integration/.gitkeep | 0 test/unit/.gitkeep | 0 9 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 app/models/.gitkeep delete mode 100644 lib/tasks/.gitkeep delete mode 100644 test/fixtures/.gitkeep delete mode 100644 test/functional/.gitkeep delete mode 100644 test/integration/.gitkeep delete mode 100644 test/unit/.gitkeep diff --git a/app/models/.gitkeep b/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/scoop/scoop_it0_map.js b/test/fixtures/scoop/scoop_it0_map.js index 71128da..6b658be 100644 --- a/test/fixtures/scoop/scoop_it0_map.js +++ b/test/fixtures/scoop/scoop_it0_map.js @@ -6,4 +6,4 @@ function map(patient) { emit("male_>65", 1); } } -}; +} diff --git a/test/fixtures/scoop/scoop_it4_map.js b/test/fixtures/scoop/scoop_it4_map.js index de864a4..9bf5a91 100644 --- a/test/fixtures/scoop/scoop_it4_map.js +++ b/test/fixtures/scoop/scoop_it4_map.js @@ -32,16 +32,16 @@ function map(patient) { } // Checks for Creatinine labs performed within the last year - function hasLabCode(patient) { + function hasLabCode() { return resultList.match(targetLabCodes, addDate(now, -1, 0, 0), end).length; } // Checks for existence of Digoxin - function hasMedication(patient) { + function hasMedication() { return drugList.match(targetMedicationCodes, start, end).length; } - function hasCurrentMedication(patient) { + function hasCurrentMedication() { for (var i = 0; i < drugList.length; i++) { var tmpArray = new hQuery.CodedEntryList(); tmpArray[0] = drugList[i]; @@ -63,8 +63,8 @@ function map(patient) { if (population(patient)) { //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); emit("senior_pop", 1); - if (hasLabCode(patient)) { - if (hasMedication(patient) && hasCurrentMedication(patient)) { + if (hasLabCode()) { + if (hasMedication() && hasCurrentMedication()) { //emit("Digoxin: " + patient.given() + " " + patient.last(), 1); //emit("Creatinine: " + patient.given() + " " + patient.last(), 1); var c = patient.results(); diff --git a/test/fixtures/scoop/scoop_it4b_map.js b/test/fixtures/scoop/scoop_it4b_map.js index 68c396d..28ad08f 100644 --- a/test/fixtures/scoop/scoop_it4b_map.js +++ b/test/fixtures/scoop/scoop_it4b_map.js @@ -52,7 +52,6 @@ function map(patient) { //emit("Abnormal Creatinine: " + patient.given() + " " + patient.last(), 1); return true; } - ; } } return false; @@ -92,6 +91,7 @@ function map(patient) { } } } + return false; } emit('total_pop', 1); diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep deleted file mode 100644 index e69de29..0000000 From 161e1bde7fdd012a71a8c01c9f9af4b9e30d31e7 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 9 Jul 2013 10:26:54 -0700 Subject: [PATCH 055/205] Updated version of health-data-standards --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 4fe9546..887ad03 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'delayed_job' gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' -gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :tag => 'v2.1.4' #, :branch => 'develop-preMongoid3' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'mongoid3-migration' #:tag => 'v2.1.4' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index 2863f46..caf8fad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,9 +10,9 @@ GIT tilt (~> 1.3.3) GIT - remote: http://github.com/projectcypress/health-data-standards.git - revision: 7911c1f386b765d87c15361488614afa58cf8814 - tag: v2.1.4 + remote: http://github.com/scoophealth/health-data-standards.git + revision: f78a51fec311a6585c74045d6d39816a0ed1c75f + branch: mongoid3-migration specs: health-data-standards (2.1.4) builder (~> 3.0.0) From efd6f44b390184f10f4bb1f26b0c2502262510c1 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 9 Jul 2013 11:00:02 -0700 Subject: [PATCH 056/205] Swap HDS back to scoop-develop branch Signed-off-by: Jeremy Ho --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 887ad03..4fe6d33 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'delayed_job' gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'mongoid3-migration' #:tag => 'v2.1.4' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' #:tag => 'v2.1.4' gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index caf8fad..c3311e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GIT GIT remote: http://github.com/scoophealth/health-data-standards.git revision: f78a51fec311a6585c74045d6d39816a0ed1c75f - branch: mongoid3-migration + branch: scoop-develop specs: health-data-standards (2.1.4) builder (~> 3.0.0) From ee3e4d91c2757b27ac36fe5f72a14c08c7c62471 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 9 Jul 2013 14:40:26 -0700 Subject: [PATCH 057/205] Update to more recent hqmf2js --- Gemfile | 3 ++- Gemfile.lock | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 4fe6d33..0b0837f 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,8 @@ gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' #:tag => 'v2.1.4' -gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' +#gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' +gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :tag => '356ec8e' #:tag => 'v1.1.0' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index c3311e9..705b932 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,3 @@ -GIT - remote: http://github.com/hquery/hqmf2js.git - revision: cc1936810085fa43542c351e92765677976cfd1f - tag: V0.3 - specs: - hqmf2js (0.1.0) - coffee-script (~> 2.2.0) - nokogiri (~> 1.5.2) - sprockets (~> 2.1.2) - tilt (~> 1.3.3) - GIT remote: http://github.com/scoophealth/health-data-standards.git revision: f78a51fec311a6585c74045d6d39816a0ed1c75f @@ -24,7 +13,7 @@ GIT GIT remote: http://github.com/scoophealth/hqmf-parser.git - revision: ef279cb3f14823ca89316877b0c62a8817cc857c + revision: ced7f6432c1ce8c4c79156ce47190a6b71f9e860 branch: scoop-develop specs: hqmf-parser (1.1.0) @@ -33,6 +22,17 @@ GIT rubyzip spreadsheet (= 0.6.8) +GIT + remote: http://github.com/scoophealth/hqmf2js.git + revision: 356ec8e7c5655443aafd715fde9916a44a35af3a + tag: 356ec8e + specs: + hqmf2js (0.1.0) + coffee-script (~> 2.2.0) + nokogiri (~> 1.5.2) + sprockets (~> 2.1.2) + tilt (~> 1.3.3) + GIT remote: http://github.com/scoophealth/patientapi.git revision: 779b4d707fb7b325c81be2a9713ee073f7d84375 @@ -82,7 +82,7 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.2) + coffee-script-source (1.6.3) configatron (2.13.0) yamler (>= 0.1.0) cover_me (1.2.0) @@ -110,7 +110,7 @@ GEM httpauth (0.2.0) i18n (0.6.4) journey (1.0.4) - jquery-rails (3.0.1) + jquery-rails (3.0.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.0) From fe7b5a39e3ed5cc86690910ee3f79988df91d027 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 9 Jul 2013 14:56:23 -0700 Subject: [PATCH 058/205] Repoint hqmf2js to scoop-develop branch Signed-off-by: Jeremy Ho --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0b0837f..855a6d9 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'delayed_job_mongoid' #, '~> 1.0.8' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' #:tag => 'v2.1.4' #gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' -gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :tag => '356ec8e' #:tag => 'v1.1.0' +gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop' #:tag => 'v1.1.0' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' diff --git a/Gemfile.lock b/Gemfile.lock index 705b932..798ddad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,7 +25,7 @@ GIT GIT remote: http://github.com/scoophealth/hqmf2js.git revision: 356ec8e7c5655443aafd715fde9916a44a35af3a - tag: 356ec8e + branch: scoop-develop specs: hqmf2js (0.1.0) coffee-script (~> 2.2.0) From cc5b72d1d05f4dda3e2989239242fcd382c976ee Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 10 Jul 2013 09:57:22 -0700 Subject: [PATCH 059/205] Updated hqmf2js and gem dependencies Signed-off-by: Jeremy Ho --- Gemfile | 17 ++++-------- Gemfile.lock | 78 ++++++++++++++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 51 deletions(-) diff --git a/Gemfile b/Gemfile index 855a6d9..c5b75e4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source 'https://rubygems.org' -#gem 'java-query-gateway', '0.1', :git =>"http://github.com/rdingwell/java-hquery-executor.git", :platforms => :jruby - -gem 'rails', '~> 3.2.1' +gem 'rails' gem 'jruby-openssl', :platforms => :jruby group :assets do gem 'sass-rails' @@ -13,16 +11,14 @@ end gem 'daemons' gem 'jquery-rails' -gem 'mongoid' #, '2.4.2' -#gem 'bson_ext', '~> 1.3', :platforms => :mri +gem 'mongoid' gem 'delayed_job' -gem 'delayed_job_mongoid' #, '~> 1.0.8' +gem 'delayed_job_mongoid' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' -gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' #:tag => 'v2.1.4' -#gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3' -gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop' #:tag => 'v1.1.0' +gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' +gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop' #gem 'hqmf2js', path: '../hqmf2js' gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop' @@ -31,9 +27,6 @@ gem 'coderay' gem 'kramdown' gem 'pry' -# Specific to the SCOOP staging environment -#gem 'heroku' - group :test do # Pretty printed test output diff --git a/Gemfile.lock b/Gemfile.lock index 798ddad..eff290b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: f78a51fec311a6585c74045d6d39816a0ed1c75f + revision: 12d1dfc3b9142990b6d17b1efcb3d59f8e39d2f5 branch: scoop-develop specs: health-data-standards (2.1.4) @@ -24,14 +24,14 @@ GIT GIT remote: http://github.com/scoophealth/hqmf2js.git - revision: 356ec8e7c5655443aafd715fde9916a44a35af3a + revision: 0fe2351dd04a61f39b1b05294f0a955e1a65daa5 branch: scoop-develop specs: hqmf2js (0.1.0) coffee-script (~> 2.2.0) - nokogiri (~> 1.5.2) - sprockets (~> 2.1.2) - tilt (~> 1.3.3) + nokogiri (~> 1.5.10) + sprockets (~> 2.2.2) + tilt (~> 1.4.1) GIT remote: http://github.com/scoophealth/patientapi.git @@ -43,32 +43,32 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.8) - actionpack (= 3.2.8) - mail (~> 2.4.4) - actionpack (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + actionmailer (3.2.13) + actionpack (= 3.2.13) + mail (~> 2.5.3) + actionpack (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) - rack (~> 1.4.0) + rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.3) - activemodel (3.2.8) - activesupport (= 3.2.8) + sprockets (~> 2.2.1) + activemodel (3.2.13) + activesupport (= 3.2.13) builder (~> 3.0.0) - activerecord (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) + activerecord (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.8) - activemodel (= 3.2.8) - activesupport (= 3.2.8) - activesupport (3.2.8) - i18n (~> 0.6) + activeresource (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + activesupport (3.2.13) + i18n (= 0.6.1) multi_json (~> 1.0) ansi (1.4.3) arel (3.0.2) @@ -108,7 +108,7 @@ GEM hashie (2.0.5) hike (1.2.3) httpauth (0.2.0) - i18n (0.6.4) + i18n (0.6.1) journey (1.0.4) jquery-rails (3.0.2) railties (>= 3.0, < 5.0) @@ -121,8 +121,7 @@ GEM log4r (1.1.10) macaddr (1.6.1) systemu (~> 2.5.0) - mail (2.4.4) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) metaclass (0.0.1) @@ -162,17 +161,17 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.8) - actionmailer (= 3.2.8) - actionpack (= 3.2.8) - activerecord (= 3.2.8) - activeresource (= 3.2.8) - activesupport (= 3.2.8) + rails (3.2.13) + actionmailer (= 3.2.13) + actionpack (= 3.2.13) + activerecord (= 3.2.13) + activeresource (= 3.2.13) + activesupport (= 3.2.13) bundler (~> 1.0) - railties (= 3.2.8) - railties (3.2.8) - actionpack (= 3.2.8) - activesupport (= 3.2.8) + railties (= 3.2.13) + railties (3.2.13) + actionpack (= 3.2.13) + activesupport (= 3.2.13) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -200,8 +199,9 @@ GEM slop (3.4.5) spreadsheet (0.6.8) ruby-ole (>= 1.0) - sprockets (2.1.3) + sprockets (2.2.2) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) systemu (2.5.2) @@ -209,7 +209,7 @@ GEM libv8 (~> 3.11.8.12) ref thor (0.18.1) - tilt (1.3.7) + tilt (1.4.1) todonotes (0.1.1) log4r treetop (1.4.14) @@ -248,7 +248,7 @@ DEPENDENCIES mocha mongoid pry - rails (~> 3.2.1) + rails sass-rails therubyracer therubyrhino From aa840e409ee7b6eacabc9ced35959b83bc92c1bd Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 10 Jul 2013 11:43:17 -0700 Subject: [PATCH 060/205] Gemfile.lock update Signed-off-by: Jeremy Ho --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index c5b75e4..8abea82 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem 'mongoid' gem 'delayed_job' gem 'delayed_job_mongoid' -gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :tag => 'v1.0.0' +gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :branch => 'scoop-develop' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop' #gem 'hqmf2js', path: '../hqmf2js' diff --git a/Gemfile.lock b/Gemfile.lock index eff290b..f9eacf8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GIT GIT remote: http://github.com/scoophealth/hqmf-parser.git - revision: ced7f6432c1ce8c4c79156ce47190a6b71f9e860 + revision: 7255b22df28004a00721209b8a9f3ff708c2028d branch: scoop-develop specs: hqmf-parser (1.1.0) @@ -35,8 +35,8 @@ GIT GIT remote: http://github.com/scoophealth/patientapi.git - revision: 779b4d707fb7b325c81be2a9713ee073f7d84375 - tag: v1.0.0 + revision: 2afc31e48f0480ca9ce16f27939a0a1a5efd153d + branch: scoop-develop specs: hquery-patient-api (1.0.0) From 7f5e941c561579fe97f4c311ed2f69a731586ce4 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 15 Jul 2013 12:41:18 -0700 Subject: [PATCH 061/205] Added test for Javascript generated from query-composer graphical builder --- .../graphical_builder_demographics_map.js | 579 +++++++++++++++ .../graphical_builder_demographics_reduce.js | 687 ++++++++++++++++++ .../graphical_builder_generated_functions.js | 551 ++++++++++++++ test/unit/scoop_job_test.rb | 16 + 4 files changed, 1833 insertions(+) create mode 100644 test/fixtures/scoop/graphical_builder_demographics_map.js create mode 100644 test/fixtures/scoop/graphical_builder_demographics_reduce.js create mode 100644 test/fixtures/scoop/graphical_builder_generated_functions.js diff --git a/test/fixtures/scoop/graphical_builder_demographics_map.js b/test/fixtures/scoop/graphical_builder_demographics_map.js new file mode 100644 index 0000000..d1ac2ae --- /dev/null +++ b/test/fixtures/scoop/graphical_builder_demographics_map.js @@ -0,0 +1,579 @@ +function map(patient) { + var populationValue = new reducer.Value({ 'target_pop': 0, 'filtered_pop': 0, 'unfound_pop': 0, 'total_pop': 1 }, rereduced = false); + if (find(patient)) { + populationValue.values.filtered_pop = 1; + if (filter(patient)) { + populationValue.values.target_pop = 1; + extract(patient); + } + } else { + populationValue.values.unfound_pop = 1; + } + emit({ 'type': 'population' }, populationValue); +} +function find(patient) { + var root = new queryStructure.And(null, [ new queryStructure.And('demographics', [ new queryStructure.DemographicRule({"ageRange": {"low": 10, "high": 99}, "gender": "M", "raceCode": null, "maritalStatusCode": null}) ]) ]) + return root.test(patient); +} +function filter(patient) { + var root = new queryStructure.And(null, [ ]) + return root.test(patient); +} +function extract(patient) { + var key = { 'type': 'group' }; + var value = new reducer.Value({ }, rereduced = false); + emit(key, value); +} +var queryStructure = queryStructure || {}; +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; + +this.queryStructure || (this.queryStructure = {}); +queryStructure.Query = (function () { + function Query() { + this.find = new queryStructure.And(null); + this.filter = new queryStructure.And(null); + this.extract = new queryStructure.Extraction([], []); + } + + Query.prototype.toJson = function () { + return { 'find': this.find.toJson(), 'filter': this.filter.toJson(), 'extract': this.extract.toJson() }; + }; + Query.prototype.rebuildFromJson = function (json) { + this.find = json['find'] ? this.buildFromJson(null, json['find']) : new queryStructure.And(null); + this.filter = json['filter'] ? this.buildFromJson(null, json['filter']) : new queryStructure.And(null); + return this.extract = json['extract'] ? queryStructure.Extraction.rebuildFromJson(json['extract']) : new queryStructure.Extraction([], []); + }; + Query.prototype.buildFromJson = function (parent, element) { + var child, container, newContainer, ruleType, _i, _len, _ref; + if (this.getElementType(element) === 'rule') { + ruleType = element.type; + return new queryStructure[ruleType](element.data); + } else { + container = this.getContainerType(element); + newContainer = new queryStructure[container](parent, [], element.name, element.title, element.negate); + _ref = element[container.toLowerCase()]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + newContainer.add(this.buildFromJson(newContainer, child)); + } + return newContainer; + } + }; + Query.prototype.getElementType = function (element) { + if ((element['and'] != null) || (element['or'] != null)) { + return 'container'; + } else { + return 'rule'; + } + }; + Query.prototype.getContainerType = function (element) { + if (element['and'] != null) { + return 'And'; + } else if (element['or'] != null) { + return 'Or'; + } else { + return null; + } + }; + return Query; +})(); +queryStructure.Container = (function () { + function Container(parent, children, name, title, negate) { + this.parent = parent; + this.children = children != null ? children : []; + this.name = name; + this.title = title; + this.negate = negate != null ? negate : false; + this.children || (this.children = []); + } + + Container.prototype.add = function (element, after) { + var ci, index; + index = this.children.length; + ci = this.childIndex(after); + if (ci !== -1) index = ci + 1; + this.children.splice(index, 0, element); + if (element.parent && element.parent !== this) { + element.parent.removeChild(element); + } + element.parent = this; + return element; + }; + Container.prototype.addAll = function (items, after) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = items.length; _i < _len; _i++) { + item = items[_i]; + _results.push(after = this.add(item, after)); + } + return _results; + }; + Container.prototype.remove = function () { + if (this.parent) return this.parent.removeChild(this); + }; + Container.prototype.removeChild = function (victim) { + var index; + index = this.childIndex(victim); + if (index !== -1) { + this.children.splice(index, 1); + return victim.parent = null; + } + }; + Container.prototype.replaceChild = function (child, newChild) { + var index; + index = this.childIndex(child); + if (index !== -1) { + this.children[index] = newChild; + child.parent = null; + return newChild.parent = this; + } + }; + Container.prototype.moveBefore = function (child, other) { + var i1, i2; + i1 = this.childIndex(child); + i2 = this.childIndex(other); + if (i1 !== -1 && i2 !== -1) { + child = this.children.splice(i2, 1); + this.children.splice(i1 - 1, 0, other); + return true; + } + return false; + }; + Container.prototype.childIndex = function (child) { + var index, _child, _ref; + if (child === null) return -1; + _ref = this.children; + for (index in _ref) { + _child = _ref[index]; + if (_child === child) return index; + } + return -1; + }; + Container.prototype.clear = function () { + return this.children = []; + }; + Container.prototype.childrenToJson = function () { + var child, childJson, js, _i, _len, _ref; + childJson = []; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + js = child["toJson"] ? child.toJson() : child; + childJson.push(js); + } + return childJson; + }; + return Container; +})(); +queryStructure.Or = (function () { + __extends(Or, queryStructure.Container); + function Or() { + Or.__super__.constructor.apply(this, arguments); + } + + Or.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "or": childJson, "negate": this.negate, "title": this.title }; + }; + Or.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = false; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (child.test(patient)) { + retval = true; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return Or; +})(); +queryStructure.And = (function () { + __extends(And, queryStructure.Container); + function And() { + And.__super__.constructor.apply(this, arguments); + } + + And.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "and": childJson, "negate": this.negate, "title": this.title }; + }; + And.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = true; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (!child.test(patient)) { + retval = false; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return And; +})(); +queryStructure.Field = (function () { + function Field(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Field.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack }; + }; + Field.prototype.extract = function (patient) { + return patient[callstack](); + }; + return Field; +})(); +queryStructure.Group = (function () { + __extends(Group, queryStructure.Field); + function Group(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Group.rebuildFromJson = function (json) { + return new queryStructure.Group(json['title'], json['callstack']); + }; + return Group; +})(); +queryStructure.Selection = (function () { + __extends(Selection, queryStructure.Field); + function Selection(title, callstack, aggregation) { + this.title = title; + this.callstack = callstack; + this.aggregation = aggregation; + } + + Selection.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack, 'aggregation': this.aggregation }; + }; + Selection.rebuildFromJson = function (json) { + return new queryStructure.Selection(json['title'], json['callstack'], json['aggregation']); + }; + return Selection; +})(); +queryStructure.Extraction = (function () { + function Extraction(selections, groups) { + this.selections = selections; + this.groups = groups; + } + + Extraction.prototype.toJson = function () { + var group, groupJson, selectJson, selection, _i, _j, _len, _len2, _ref, _ref2; + selectJson = []; + groupJson = []; + _ref = this.selections; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selectJson.push(selection.toJson()); + } + _ref2 = this.groups; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groupJson.push(group.toJson()); + } + return { "selections": selectJson, "groups": groupJson }; + }; + Extraction.rebuildFromJson = function (json) { + var group, groups, selection, selections, _i, _j, _len, _len2, _ref, _ref2; + selections = []; + groups = []; + _ref = json['selections']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selections.push(queryStructure.Selection.rebuildFromJson(selection)); + } + _ref2 = json['groups']; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groups.push(queryStructure.Group.rebuildFromJson(group)); + } + return new queryStructure.Extraction(selections, groups); + }; + return Extraction; +})(); + +var reducer; +reducer = this.reducer || {}; +reducer.Value = (function () { + function Value(values, rereduced) { + this.values = values; + this.rereduced = rereduced; + } + + Value.prototype.sum = function (title, element) { + if (!this.rereduced) this.values[title + '_sum'] = 0; + if (!element.rereduced) element.values[title + '_sum'] = 0; + return this.values[title + '_sum'] += element.values[title] + element.values[title + '_sum']; + }; + Value.prototype.frequency = function (title, element) { + var k, key, v, _ref, _results; + if (!this.rereduced) this.values[title + '_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_frequency'][key] = 1; + } + _ref = element.values[title + '_frequency']; + _results = []; + for (k in _ref) { + v = _ref[k]; + if (this.values[title + '_frequency'][k] != null) { + _results.push(this.values[title + '_frequency'][k] += v); + } else { + _results.push(this.values[title + '_frequency'][k] = v); + } + } + return _results; + }; + Value.prototype.mean = function (title, element) { + var count, elementTotal, previousTotal, total; + if (!this.rereduced) { + this.values[title + '_mean'] = 0; + this.values[title + '_mean_count'] = 0; + } + if (!element.rereduced) { + element.values[title + '_mean'] = element.values[title]; + element.values[title + '_mean_count'] = 1; + } + previousTotal = this.values[title + '_mean'] * this.values[title + '_mean_count']; + elementTotal = element.values[title + '_mean'] * element.values[title + '_mean_count']; + total = previousTotal + elementTotal; + count = this.values[title + '_mean_count'] + element.values[title + '_mean_count']; + this.values[title + '_mean_count'] = count; + return this.values[title + '_mean'] = total / count; + }; + Value.prototype.median = function (title, element) { + var front_value, i, leftCenter, rightCenter, value, _i, _len, _ref; + if (!this.rereduced) this.values[title + '_median_list'] = []; + if (!element.rereduced) { + element.values[title + '_median_list'] = [element.values[title]]; + } + i = 0; + while (i < this.values[title + '_median_list'].length && element.values[title + '_median_list'].length > 0) { + while (element.values[title + '_median_list'].length > 0 && element.values[title + '_median_list'][0] < this.values[title + '_median_list'][i]) { + front_value = (element.values[title + '_median_list'].splice(0, 1))[0]; + this.values[title + '_median_list'].splice(i, 0, front_value); + i++; + } + i++; + } + _ref = element.values[title + '_median_list']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + this.values[title + '_median_list'].splice(this.values[title + '_median_list'].length, 0, value); + } + if (this.values[title + '_median_list'].length % 2 === 0) { + leftCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + rightCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2) - 1]; + return this.values[title + '_median'] = (leftCenter + rightCenter) / 2; + } else { + return this.values[title + '_median'] = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + } + }; + Value.prototype.mode = function (title, element) { + var key, most_frequent_key, most_frequent_value, value, _ref, _ref2; + if (!this.rereduced) this.values[title + '_mode_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_mode_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_mode_frequency'][key] = 1; + } + _ref = element.values[title + '_mode_frequency']; + for (key in _ref) { + value = _ref[key]; + if (this.values[title + '_mode_frequency'][key] != null) { + this.values[title + '_mode_frequency'][key] += 1; + } else { + this.values[title + '_mode_frequency'][key] = 1; + } + } + most_frequent_key = []; + most_frequent_value = 0; + _ref2 = this.values[title + '_mode_frequency']; + for (key in _ref2) { + value = _ref2[key]; + if (value === most_frequent_value) { + most_frequent_key.push(key); + } else if (value > most_frequent_value) { + most_frequent_key = [key]; + most_frequent_value = value; + } + } + return this.values[title + '_mode'] = most_frequent_key; + }; + return Value; +})(); +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; +this.queryStructure || (this.queryStructure = {}); +queryStructure.Rule = (function () { + function Rule(name, data) { + this.name = name; + this.data = data; + this.type = this.constructor.name; + } + + Rule.prototype.toJson = function () { + return { "name": this.name, "type": this.type, "data": this.data }; + }; + return Rule; +})(); +queryStructure.Range = (function () { + function Range(category, title, field, start, end) { + this.category = category; + this.title = title; + this.field = field; + this.start = start; + this.end = end; + } + + return Range; +})(); +queryStructure.Comparison = (function () { + function Comparison(data) { + Comparison.__super__.constructor.call(this, "ComparisonRule", data); + } + + Comparison.prototype.test = function (patient) { + var value; + value = null; + if (this.field === 'age') { + value = patient[this.field](new Date()); + } else { + value = patient[this.field](); + } + if (this.comparator === '=') { + return value === this.value; + } else if (this.comparator === '<') { + return value < this.value; + } else { + return value > this.value; + } + }; + return Comparison; +})(); +queryStructure.CodeSetRule = (function () { + __extends(CodeSetRule, queryStructure.Rule); + function CodeSetRule(data) { + CodeSetRule.__super__.constructor.call(this, data.type, data); + this.code_set_type = data.type; + } + + CodeSetRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p[this.code_set_type]().match(this.data.code.codes); + return codes.length !== 0; + }; + return CodeSetRule; +})(); +queryStructure.VitalSignRule = (function () { + __extends(VitalSignRule, queryStructure.Rule); + function VitalSignRule(data) { + VitalSignRule.__super__.constructor.call(this, "VitalSignRule", data); + } + + VitalSignRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.vitalSigns().match(this.data.code.codes); + return codes.length !== 0; + }; + return VitalSignRule; +})(); +queryStructure.EncounterRule = (function () { + __extends(EncounterRule, queryStructure.Rule); + function EncounterRule(data) { + EncounterRule.__super__.constructor.call(this, "EncounterRule", data); + } + + EncounterRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.encounters().match(this.data.code.codes); + return codes.length !== 0; + }; + return EncounterRule; +})(); +queryStructure.DemographicRule = (function () { + __extends(DemographicRule, queryStructure.Rule); + function DemographicRule(data) { + DemographicRule.__super__.constructor.call(this, "DemographicRule", data); + } + + DemographicRule.prototype.test = function (p) { + var match, status; + match = true; + if (this.data.ageRange) { + match = p.age() >= this.data.ageRange.low && p.age() <= this.data.ageRange.high; + } + if (this.data.maritalStatusCode && match) { + status = p.maritalStatus(); + match = status && status.includesCodeFrom(this.data.maritalStatusCode.codes); + } + if (this.data.gender && match) match = p.gender() === this.data.gender; + if (this.data.raceCode && match) { + match = p.race().includesCodeFrom(this.data.raceCode.codes); + } + return match; + }; + return DemographicRule; +})(); +queryStructure.RawJavascriptRule = (function () { + __extends(RawJavascriptRule, queryStructure.Rule); + function RawJavascriptRule(data) { + RawJavascriptRule.__super__.constructor.call(this, "RawJavascriptRule", data); + } + + RawJavascriptRule.prototype.test = function (p) { + if (this.data && this.data.js) { + try { + eval("var jscript = " + this.data.js); + return jscript(p); + } catch (_error) { + } + } + }; + return RawJavascriptRule; +})(); \ No newline at end of file diff --git a/test/fixtures/scoop/graphical_builder_demographics_reduce.js b/test/fixtures/scoop/graphical_builder_demographics_reduce.js new file mode 100644 index 0000000..cd15e98 --- /dev/null +++ b/test/fixtures/scoop/graphical_builder_demographics_reduce.js @@ -0,0 +1,687 @@ +function reduce(key, values) { + var result; + if (key.type == 'population') { + result = new reducer.Value({ 'target_pop': 0, 'filtered_pop': 0, 'unfound_pop': 0, 'total_pop': 0 }, rereduced = false); + while (values.hasNext()) { + var _val = values.next(); + result.sum('target_pop', _val); + result.sum('filtered_pop', _val); + result.sum('unfound_pop', _val); + result.sum('total_pop', _val); + _val.rereduced = true; + result.rereduced = true; + } + } else if (key.type == 'group') { + result = new reducer.Value({ }, rereduced = false); + while (values.hasNext()) { + var _val = values.next(); + result.rereduced = true; + _val.rereduced = true; + } + } + return result; +} +var reducer; +reducer = this.reducer || {}; +reducer.Value = (function () { + function Value(values, rereduced) { + this.values = values; + this.rereduced = rereduced; + } + + Value.prototype.sum = function (title, element) { + if (!this.rereduced) this.values[title + '_sum'] = 0; + if (!element.rereduced) element.values[title + '_sum'] = 0; + return this.values[title + '_sum'] += element.values[title] + element.values[title + '_sum']; + }; + Value.prototype.frequency = function (title, element) { + var k, key, v, _ref, _results; + if (!this.rereduced) this.values[title + '_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_frequency'][key] = 1; + } + _ref = element.values[title + '_frequency']; + _results = []; + for (k in _ref) { + v = _ref[k]; + if (this.values[title + '_frequency'][k] != null) { + _results.push(this.values[title + '_frequency'][k] += v); + } else { + _results.push(this.values[title + '_frequency'][k] = v); + } + } + return _results; + }; + Value.prototype.mean = function (title, element) { + var count, elementTotal, previousTotal, total; + if (!this.rereduced) { + this.values[title + '_mean'] = 0; + this.values[title + '_mean_count'] = 0; + } + if (!element.rereduced) { + element.values[title + '_mean'] = element.values[title]; + element.values[title + '_mean_count'] = 1; + } + previousTotal = this.values[title + '_mean'] * this.values[title + '_mean_count']; + elementTotal = element.values[title + '_mean'] * element.values[title + '_mean_count']; + total = previousTotal + elementTotal; + count = this.values[title + '_mean_count'] + element.values[title + '_mean_count']; + this.values[title + '_mean_count'] = count; + return this.values[title + '_mean'] = total / count; + }; + Value.prototype.median = function (title, element) { + var front_value, i, leftCenter, rightCenter, value, _i, _len, _ref; + if (!this.rereduced) this.values[title + '_median_list'] = []; + if (!element.rereduced) { + element.values[title + '_median_list'] = [element.values[title]]; + } + i = 0; + while (i < this.values[title + '_median_list'].length && element.values[title + '_median_list'].length > 0) { + while (element.values[title + '_median_list'].length > 0 && element.values[title + '_median_list'][0] < this.values[title + '_median_list'][i]) { + front_value = (element.values[title + '_median_list'].splice(0, 1))[0]; + this.values[title + '_median_list'].splice(i, 0, front_value); + i++; + } + i++; + } + _ref = element.values[title + '_median_list']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + this.values[title + '_median_list'].splice(this.values[title + '_median_list'].length, 0, value); + } + if (this.values[title + '_median_list'].length % 2 === 0) { + leftCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + rightCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2) - 1]; + return this.values[title + '_median'] = (leftCenter + rightCenter) / 2; + } else { + return this.values[title + '_median'] = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + } + }; + Value.prototype.mode = function (title, element) { + var key, most_frequent_key, most_frequent_value, value, _ref, _ref2; + if (!this.rereduced) this.values[title + '_mode_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_mode_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_mode_frequency'][key] = 1; + } + _ref = element.values[title + '_mode_frequency']; + for (key in _ref) { + value = _ref[key]; + if (this.values[title + '_mode_frequency'][key] != null) { + this.values[title + '_mode_frequency'][key] += 1; + } else { + this.values[title + '_mode_frequency'][key] = 1; + } + } + most_frequent_key = []; + most_frequent_value = 0; + _ref2 = this.values[title + '_mode_frequency']; + for (key in _ref2) { + value = _ref2[key]; + if (value === most_frequent_value) { + most_frequent_key.push(key); + } else if (value > most_frequent_value) { + most_frequent_key = [key]; + most_frequent_value = value; + } + } + return this.values[title + '_mode'] = most_frequent_key; + }; + return Value; +})(); + +// utility functions called by reduce +var queryStructure = queryStructure || {}; +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; +this.queryStructure || (this.queryStructure = {}); +queryStructure.Query = (function () { + function Query() { + this.find = new queryStructure.And(null); + this.filter = new queryStructure.And(null); + this.extract = new queryStructure.Extraction([], []); + } + + Query.prototype.toJson = function () { + return { 'find': this.find.toJson(), 'filter': this.filter.toJson(), 'extract': this.extract.toJson() }; + }; + Query.prototype.rebuildFromJson = function (json) { + this.find = json['find'] ? this.buildFromJson(null, json['find']) : new queryStructure.And(null); + this.filter = json['filter'] ? this.buildFromJson(null, json['filter']) : new queryStructure.And(null); + return this.extract = json['extract'] ? queryStructure.Extraction.rebuildFromJson(json['extract']) : new queryStructure.Extraction([], []); + }; + Query.prototype.buildFromJson = function (parent, element) { + var child, container, newContainer, ruleType, _i, _len, _ref; + if (this.getElementType(element) === 'rule') { + ruleType = element.type; + return new queryStructure[ruleType](element.data); + } else { + container = this.getContainerType(element); + newContainer = new queryStructure[container](parent, [], element.name, element.title, element.negate); + _ref = element[container.toLowerCase()]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + newContainer.add(this.buildFromJson(newContainer, child)); + } + return newContainer; + } + }; + Query.prototype.getElementType = function (element) { + if ((element['and'] != null) || (element['or'] != null)) { + return 'container'; + } else { + return 'rule'; + } + }; + Query.prototype.getContainerType = function (element) { + if (element['and'] != null) { + return 'And'; + } else if (element['or'] != null) { + return 'Or'; + } else { + return null; + } + }; + return Query; +})(); +queryStructure.Container = (function () { + function Container(parent, children, name, title, negate) { + this.parent = parent; + this.children = children != null ? children : []; + this.name = name; + this.title = title; + this.negate = negate != null ? negate : false; + this.children || (this.children = []); + } + + Container.prototype.add = function (element, after) { + var ci, index; + index = this.children.length; + ci = this.childIndex(after); + if (ci !== -1) index = ci + 1; + this.children.splice(index, 0, element); + if (element.parent && element.parent !== this) { + element.parent.removeChild(element); + } + element.parent = this; + return element; + }; + Container.prototype.addAll = function (items, after) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = items.length; _i < _len; _i++) { + item = items[_i]; + _results.push(after = this.add(item, after)); + } + return _results; + }; + Container.prototype.remove = function () { + if (this.parent) return this.parent.removeChild(this); + }; + Container.prototype.removeChild = function (victim) { + var index; + index = this.childIndex(victim); + if (index !== -1) { + this.children.splice(index, 1); + return victim.parent = null; + } + }; + Container.prototype.replaceChild = function (child, newChild) { + var index; + index = this.childIndex(child); + if (index !== -1) { + this.children[index] = newChild; + child.parent = null; + return newChild.parent = this; + } + }; + Container.prototype.moveBefore = function (child, other) { + var i1, i2; + i1 = this.childIndex(child); + i2 = this.childIndex(other); + if (i1 !== -1 && i2 !== -1) { + child = this.children.splice(i2, 1); + this.children.splice(i1 - 1, 0, other); + return true; + } + return false; + }; + Container.prototype.childIndex = function (child) { + var index, _child, _ref; + if (child === null) return -1; + _ref = this.children; + for (index in _ref) { + _child = _ref[index]; + if (_child === child) return index; + } + return -1; + }; + Container.prototype.clear = function () { + return this.children = []; + }; + Container.prototype.childrenToJson = function () { + var child, childJson, js, _i, _len, _ref; + childJson = []; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + js = child["toJson"] ? child.toJson() : child; + childJson.push(js); + } + return childJson; + }; + return Container; +})(); +queryStructure.Or = (function () { + __extends(Or, queryStructure.Container); + function Or() { + Or.__super__.constructor.apply(this, arguments); + } + + Or.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "or": childJson, "negate": this.negate, "title": this.title }; + }; + Or.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = false; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (child.test(patient)) { + retval = true; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return Or; +})(); +queryStructure.And = (function () { + __extends(And, queryStructure.Container); + function And() { + And.__super__.constructor.apply(this, arguments); + } + + And.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "and": childJson, "negate": this.negate, "title": this.title }; + }; + And.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = true; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (!child.test(patient)) { + retval = false; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return And; +})(); +queryStructure.Field = (function () { + function Field(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Field.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack }; + }; + Field.prototype.extract = function (patient) { + return patient[callstack](); + }; + return Field; +})(); +queryStructure.Group = (function () { + __extends(Group, queryStructure.Field); + function Group(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Group.rebuildFromJson = function (json) { + return new queryStructure.Group(json['title'], json['callstack']); + }; + return Group; +})(); +queryStructure.Selection = (function () { + __extends(Selection, queryStructure.Field); + function Selection(title, callstack, aggregation) { + this.title = title; + this.callstack = callstack; + this.aggregation = aggregation; + } + + Selection.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack, 'aggregation': this.aggregation }; + }; + Selection.rebuildFromJson = function (json) { + return new queryStructure.Selection(json['title'], json['callstack'], json['aggregation']); + }; + return Selection; +})(); +queryStructure.Extraction = (function () { + function Extraction(selections, groups) { + this.selections = selections; + this.groups = groups; + } + + Extraction.prototype.toJson = function () { + var group, groupJson, selectJson, selection, _i, _j, _len, _len2, _ref, _ref2; + selectJson = []; + groupJson = []; + _ref = this.selections; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selectJson.push(selection.toJson()); + } + _ref2 = this.groups; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groupJson.push(group.toJson()); + } + return { "selections": selectJson, "groups": groupJson }; + }; + Extraction.rebuildFromJson = function (json) { + var group, groups, selection, selections, _i, _j, _len, _len2, _ref, _ref2; + selections = []; + groups = []; + _ref = json['selections']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selections.push(queryStructure.Selection.rebuildFromJson(selection)); + } + _ref2 = json['groups']; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groups.push(queryStructure.Group.rebuildFromJson(group)); + } + return new queryStructure.Extraction(selections, groups); + }; + return Extraction; +})(); +var reducer; +reducer = this.reducer || {}; +reducer.Value = (function () { + function Value(values, rereduced) { + this.values = values; + this.rereduced = rereduced; + } + + Value.prototype.sum = function (title, element) { + if (!this.rereduced) this.values[title + '_sum'] = 0; + if (!element.rereduced) element.values[title + '_sum'] = 0; + return this.values[title + '_sum'] += element.values[title] + element.values[title + '_sum']; + }; + Value.prototype.frequency = function (title, element) { + var k, key, v, _ref, _results; + if (!this.rereduced) this.values[title + '_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_frequency'][key] = 1; + } + _ref = element.values[title + '_frequency']; + _results = []; + for (k in _ref) { + v = _ref[k]; + if (this.values[title + '_frequency'][k] != null) { + _results.push(this.values[title + '_frequency'][k] += v); + } else { + _results.push(this.values[title + '_frequency'][k] = v); + } + } + return _results; + }; + Value.prototype.mean = function (title, element) { + var count, elementTotal, previousTotal, total; + if (!this.rereduced) { + this.values[title + '_mean'] = 0; + this.values[title + '_mean_count'] = 0; + } + if (!element.rereduced) { + element.values[title + '_mean'] = element.values[title]; + element.values[title + '_mean_count'] = 1; + } + previousTotal = this.values[title + '_mean'] * this.values[title + '_mean_count']; + elementTotal = element.values[title + '_mean'] * element.values[title + '_mean_count']; + total = previousTotal + elementTotal; + count = this.values[title + '_mean_count'] + element.values[title + '_mean_count']; + this.values[title + '_mean_count'] = count; + return this.values[title + '_mean'] = total / count; + }; + Value.prototype.median = function (title, element) { + var front_value, i, leftCenter, rightCenter, value, _i, _len, _ref; + if (!this.rereduced) this.values[title + '_median_list'] = []; + if (!element.rereduced) { + element.values[title + '_median_list'] = [element.values[title]]; + } + i = 0; + while (i < this.values[title + '_median_list'].length && element.values[title + '_median_list'].length > 0) { + while (element.values[title + '_median_list'].length > 0 && element.values[title + '_median_list'][0] < this.values[title + '_median_list'][i]) { + front_value = (element.values[title + '_median_list'].splice(0, 1))[0]; + this.values[title + '_median_list'].splice(i, 0, front_value); + i++; + } + i++; + } + _ref = element.values[title + '_median_list']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + this.values[title + '_median_list'].splice(this.values[title + '_median_list'].length, 0, value); + } + if (this.values[title + '_median_list'].length % 2 === 0) { + leftCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + rightCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2) - 1]; + return this.values[title + '_median'] = (leftCenter + rightCenter) / 2; + } else { + return this.values[title + '_median'] = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + } + }; + Value.prototype.mode = function (title, element) { + var key, most_frequent_key, most_frequent_value, value, _ref, _ref2; + if (!this.rereduced) this.values[title + '_mode_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_mode_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_mode_frequency'][key] = 1; + } + _ref = element.values[title + '_mode_frequency']; + for (key in _ref) { + value = _ref[key]; + if (this.values[title + '_mode_frequency'][key] != null) { + this.values[title + '_mode_frequency'][key] += 1; + } else { + this.values[title + '_mode_frequency'][key] = 1; + } + } + most_frequent_key = []; + most_frequent_value = 0; + _ref2 = this.values[title + '_mode_frequency']; + for (key in _ref2) { + value = _ref2[key]; + if (value === most_frequent_value) { + most_frequent_key.push(key); + } else if (value > most_frequent_value) { + most_frequent_key = [key]; + most_frequent_value = value; + } + } + return this.values[title + '_mode'] = most_frequent_key; + }; + return Value; +})(); +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; +this.queryStructure || (this.queryStructure = {}); +queryStructure.Rule = (function () { + function Rule(name, data) { + this.name = name; + this.data = data; + this.type = this.constructor.name; + } + + Rule.prototype.toJson = function () { + return { "name": this.name, "type": this.type, "data": this.data }; + }; + return Rule; +})(); +queryStructure.Range = (function () { + function Range(category, title, field, start, end) { + this.category = category; + this.title = title; + this.field = field; + this.start = start; + this.end = end; + } + + return Range; +})(); +queryStructure.Comparison = (function () { + function Comparison(data) { + Comparison.__super__.constructor.call(this, "ComparisonRule", data); + } + + Comparison.prototype.test = function (patient) { + var value; + value = null; + if (this.field === 'age') { + value = patient[this.field](new Date()); + } else { + value = patient[this.field](); + } + if (this.comparator === '=') { + return value === this.value; + } else if (this.comparator === '<') { + return value < this.value; + } else { + return value > this.value; + } + }; + return Comparison; +})(); +queryStructure.CodeSetRule = (function () { + __extends(CodeSetRule, queryStructure.Rule); + function CodeSetRule(data) { + CodeSetRule.__super__.constructor.call(this, data.type, data); + this.code_set_type = data.type; + } + + CodeSetRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p[this.code_set_type]().match(this.data.code.codes); + return codes.length !== 0; + }; + return CodeSetRule; +})(); +queryStructure.VitalSignRule = (function () { + __extends(VitalSignRule, queryStructure.Rule); + function VitalSignRule(data) { + VitalSignRule.__super__.constructor.call(this, "VitalSignRule", data); + } + + VitalSignRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.vitalSigns().match(this.data.code.codes); + return codes.length !== 0; + }; + return VitalSignRule; +})(); +queryStructure.EncounterRule = (function () { + __extends(EncounterRule, queryStructure.Rule); + function EncounterRule(data) { + EncounterRule.__super__.constructor.call(this, "EncounterRule", data); + } + + EncounterRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.encounters().match(this.data.code.codes); + return codes.length !== 0; + }; + return EncounterRule; +})(); +queryStructure.DemographicRule = (function () { + __extends(DemographicRule, queryStructure.Rule); + function DemographicRule(data) { + DemographicRule.__super__.constructor.call(this, "DemographicRule", data); + } + + DemographicRule.prototype.test = function (p) { + var match, status; + match = true; + if (this.data.ageRange) { + match = p.age() >= this.data.ageRange.low && p.age() <= this.data.ageRange.high; + } + if (this.data.maritalStatusCode && match) { + status = p.maritalStatus(); + match = status && status.includesCodeFrom(this.data.maritalStatusCode.codes); + } + if (this.data.gender && match) match = p.gender() === this.data.gender; + if (this.data.raceCode && match) { + match = p.race().includesCodeFrom(this.data.raceCode.codes); + } + return match; + }; + return DemographicRule; +})(); +queryStructure.RawJavascriptRule = (function () { + __extends(RawJavascriptRule, queryStructure.Rule); + function RawJavascriptRule(data) { + RawJavascriptRule.__super__.constructor.call(this, "RawJavascriptRule", data); + } + + RawJavascriptRule.prototype.test = function (p) { + if (this.data && this.data.js) { + try { + eval("var jscript = " + this.data.js); + return jscript(p); + } catch (_error) { + } + } + }; + return RawJavascriptRule; +})(); \ No newline at end of file diff --git a/test/fixtures/scoop/graphical_builder_generated_functions.js b/test/fixtures/scoop/graphical_builder_generated_functions.js new file mode 100644 index 0000000..74e76d1 --- /dev/null +++ b/test/fixtures/scoop/graphical_builder_generated_functions.js @@ -0,0 +1,551 @@ +var queryStructure = queryStructure || {}; +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; +this.queryStructure || (this.queryStructure = {}); +queryStructure.Query = (function () { + function Query() { + this.find = new queryStructure.And(null); + this.filter = new queryStructure.And(null); + this.extract = new queryStructure.Extraction([], []); + } + + Query.prototype.toJson = function () { + return { 'find': this.find.toJson(), 'filter': this.filter.toJson(), 'extract': this.extract.toJson() }; + }; + Query.prototype.rebuildFromJson = function (json) { + this.find = json['find'] ? this.buildFromJson(null, json['find']) : new queryStructure.And(null); + this.filter = json['filter'] ? this.buildFromJson(null, json['filter']) : new queryStructure.And(null); + return this.extract = json['extract'] ? queryStructure.Extraction.rebuildFromJson(json['extract']) : new queryStructure.Extraction([], []); + }; + Query.prototype.buildFromJson = function (parent, element) { + var child, container, newContainer, ruleType, _i, _len, _ref; + if (this.getElementType(element) === 'rule') { + ruleType = element.type; + return new queryStructure[ruleType](element.data); + } else { + container = this.getContainerType(element); + newContainer = new queryStructure[container](parent, [], element.name, element.title, element.negate); + _ref = element[container.toLowerCase()]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + newContainer.add(this.buildFromJson(newContainer, child)); + } + return newContainer; + } + }; + Query.prototype.getElementType = function (element) { + if ((element['and'] != null) || (element['or'] != null)) { + return 'container'; + } else { + return 'rule'; + } + }; + Query.prototype.getContainerType = function (element) { + if (element['and'] != null) { + return 'And'; + } else if (element['or'] != null) { + return 'Or'; + } else { + return null; + } + }; + return Query; +})(); +queryStructure.Container = (function () { + function Container(parent, children, name, title, negate) { + this.parent = parent; + this.children = children != null ? children : []; + this.name = name; + this.title = title; + this.negate = negate != null ? negate : false; + this.children || (this.children = []); + } + + Container.prototype.add = function (element, after) { + var ci, index; + index = this.children.length; + ci = this.childIndex(after); + if (ci !== -1) index = ci + 1; + this.children.splice(index, 0, element); + if (element.parent && element.parent !== this) { + element.parent.removeChild(element); + } + element.parent = this; + return element; + }; + Container.prototype.addAll = function (items, after) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = items.length; _i < _len; _i++) { + item = items[_i]; + _results.push(after = this.add(item, after)); + } + return _results; + }; + Container.prototype.remove = function () { + if (this.parent) return this.parent.removeChild(this); + }; + Container.prototype.removeChild = function (victim) { + var index; + index = this.childIndex(victim); + if (index !== -1) { + this.children.splice(index, 1); + return victim.parent = null; + } + }; + Container.prototype.replaceChild = function (child, newChild) { + var index; + index = this.childIndex(child); + if (index !== -1) { + this.children[index] = newChild; + child.parent = null; + return newChild.parent = this; + } + }; + Container.prototype.moveBefore = function (child, other) { + var i1, i2; + i1 = this.childIndex(child); + i2 = this.childIndex(other); + if (i1 !== -1 && i2 !== -1) { + child = this.children.splice(i2, 1); + this.children.splice(i1 - 1, 0, other); + return true; + } + return false; + }; + Container.prototype.childIndex = function (child) { + var index, _child, _ref; + if (child === null) return -1; + _ref = this.children; + for (index in _ref) { + _child = _ref[index]; + if (_child === child) return index; + } + return -1; + }; + Container.prototype.clear = function () { + return this.children = []; + }; + Container.prototype.childrenToJson = function () { + var child, childJson, js, _i, _len, _ref; + childJson = []; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + js = child["toJson"] ? child.toJson() : child; + childJson.push(js); + } + return childJson; + }; + return Container; +})(); +queryStructure.Or = (function () { + __extends(Or, queryStructure.Container); + function Or() { + Or.__super__.constructor.apply(this, arguments); + } + + Or.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "or": childJson, "negate": this.negate, "title": this.title }; + }; + Or.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = false; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (child.test(patient)) { + retval = true; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return Or; +})(); +queryStructure.And = (function () { + __extends(And, queryStructure.Container); + function And() { + And.__super__.constructor.apply(this, arguments); + } + + And.prototype.toJson = function () { + var childJson; + childJson = this.childrenToJson(); + return { "name": this.name, "and": childJson, "negate": this.negate, "title": this.title }; + }; + And.prototype.test = function (patient) { + var child, retval, _i, _len, _ref; + if (this.children.length === 0) return true; + retval = true; + _ref = this.children; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + if (!child.test(patient)) { + retval = false; + break; + } + } + if (this.negate) { + return !retval; + } else { + return retval; + } + }; + return And; +})(); +queryStructure.Field = (function () { + function Field(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Field.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack }; + }; + Field.prototype.extract = function (patient) { + return patient[callstack](); + }; + return Field; +})(); +queryStructure.Group = (function () { + __extends(Group, queryStructure.Field); + function Group(title, callstack) { + this.title = title; + this.callstack = callstack; + } + + Group.rebuildFromJson = function (json) { + return new queryStructure.Group(json['title'], json['callstack']); + }; + return Group; +})(); +queryStructure.Selection = (function () { + __extends(Selection, queryStructure.Field); + function Selection(title, callstack, aggregation) { + this.title = title; + this.callstack = callstack; + this.aggregation = aggregation; + } + + Selection.prototype.toJson = function () { + return { "title": this.title, "callstack": this.callstack, 'aggregation': this.aggregation }; + }; + Selection.rebuildFromJson = function (json) { + return new queryStructure.Selection(json['title'], json['callstack'], json['aggregation']); + }; + return Selection; +})(); +queryStructure.Extraction = (function () { + function Extraction(selections, groups) { + this.selections = selections; + this.groups = groups; + } + + Extraction.prototype.toJson = function () { + var group, groupJson, selectJson, selection, _i, _j, _len, _len2, _ref, _ref2; + selectJson = []; + groupJson = []; + _ref = this.selections; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selectJson.push(selection.toJson()); + } + _ref2 = this.groups; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groupJson.push(group.toJson()); + } + return { "selections": selectJson, "groups": groupJson }; + }; + Extraction.rebuildFromJson = function (json) { + var group, groups, selection, selections, _i, _j, _len, _len2, _ref, _ref2; + selections = []; + groups = []; + _ref = json['selections']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + selection = _ref[_i]; + selections.push(queryStructure.Selection.rebuildFromJson(selection)); + } + _ref2 = json['groups']; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + group = _ref2[_j]; + groups.push(queryStructure.Group.rebuildFromJson(group)); + } + return new queryStructure.Extraction(selections, groups); + }; + return Extraction; +})(); +var reducer; +reducer = this.reducer || {}; +reducer.Value = (function () { + function Value(values, rereduced) { + this.values = values; + this.rereduced = rereduced; + } + + Value.prototype.sum = function (title, element) { + if (!this.rereduced) this.values[title + '_sum'] = 0; + if (!element.rereduced) element.values[title + '_sum'] = 0; + return this.values[title + '_sum'] += element.values[title] + element.values[title + '_sum']; + }; + Value.prototype.frequency = function (title, element) { + var k, key, v, _ref, _results; + if (!this.rereduced) this.values[title + '_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_frequency'][key] = 1; + } + _ref = element.values[title + '_frequency']; + _results = []; + for (k in _ref) { + v = _ref[k]; + if (this.values[title + '_frequency'][k] != null) { + _results.push(this.values[title + '_frequency'][k] += v); + } else { + _results.push(this.values[title + '_frequency'][k] = v); + } + } + return _results; + }; + Value.prototype.mean = function (title, element) { + var count, elementTotal, previousTotal, total; + if (!this.rereduced) { + this.values[title + '_mean'] = 0; + this.values[title + '_mean_count'] = 0; + } + if (!element.rereduced) { + element.values[title + '_mean'] = element.values[title]; + element.values[title + '_mean_count'] = 1; + } + previousTotal = this.values[title + '_mean'] * this.values[title + '_mean_count']; + elementTotal = element.values[title + '_mean'] * element.values[title + '_mean_count']; + total = previousTotal + elementTotal; + count = this.values[title + '_mean_count'] + element.values[title + '_mean_count']; + this.values[title + '_mean_count'] = count; + return this.values[title + '_mean'] = total / count; + }; + Value.prototype.median = function (title, element) { + var front_value, i, leftCenter, rightCenter, value, _i, _len, _ref; + if (!this.rereduced) this.values[title + '_median_list'] = []; + if (!element.rereduced) { + element.values[title + '_median_list'] = [element.values[title]]; + } + i = 0; + while (i < this.values[title + '_median_list'].length && element.values[title + '_median_list'].length > 0) { + while (element.values[title + '_median_list'].length > 0 && element.values[title + '_median_list'][0] < this.values[title + '_median_list'][i]) { + front_value = (element.values[title + '_median_list'].splice(0, 1))[0]; + this.values[title + '_median_list'].splice(i, 0, front_value); + i++; + } + i++; + } + _ref = element.values[title + '_median_list']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + this.values[title + '_median_list'].splice(this.values[title + '_median_list'].length, 0, value); + } + if (this.values[title + '_median_list'].length % 2 === 0) { + leftCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + rightCenter = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2) - 1]; + return this.values[title + '_median'] = (leftCenter + rightCenter) / 2; + } else { + return this.values[title + '_median'] = this.values[title + '_median_list'][Math.floor(this.values[title + '_median_list'].length / 2)]; + } + }; + Value.prototype.mode = function (title, element) { + var key, most_frequent_key, most_frequent_value, value, _ref, _ref2; + if (!this.rereduced) this.values[title + '_mode_frequency'] = {}; + if (!element.rereduced) { + element.values[title + '_mode_frequency'] = {}; + key = ('' + element.values[title]).replace('.', '~'); + element.values[title + '_mode_frequency'][key] = 1; + } + _ref = element.values[title + '_mode_frequency']; + for (key in _ref) { + value = _ref[key]; + if (this.values[title + '_mode_frequency'][key] != null) { + this.values[title + '_mode_frequency'][key] += 1; + } else { + this.values[title + '_mode_frequency'][key] = 1; + } + } + most_frequent_key = []; + most_frequent_value = 0; + _ref2 = this.values[title + '_mode_frequency']; + for (key in _ref2) { + value = _ref2[key]; + if (value === most_frequent_value) { + most_frequent_key.push(key); + } else if (value > most_frequent_value) { + most_frequent_key = [key]; + most_frequent_value = value; + } + } + return this.values[title + '_mode'] = most_frequent_key; + }; + return Value; +})(); +var __hasProp = Object.prototype.hasOwnProperty, __extends = function (child, parent) { + for (var key in parent) { + if (__hasProp.call(parent, key)) child[key] = parent[key]; + } + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +}; +this.queryStructure || (this.queryStructure = {}); +queryStructure.Rule = (function () { + function Rule(name, data) { + this.name = name; + this.data = data; + this.type = this.constructor.name; + } + + Rule.prototype.toJson = function () { + return { "name": this.name, "type": this.type, "data": this.data }; + }; + return Rule; +})(); +queryStructure.Range = (function () { + function Range(category, title, field, start, end) { + this.category = category; + this.title = title; + this.field = field; + this.start = start; + this.end = end; + } + + return Range; +})(); +queryStructure.Comparison = (function () { + function Comparison(data) { + Comparison.__super__.constructor.call(this, "ComparisonRule", data); + } + + Comparison.prototype.test = function (patient) { + var value; + value = null; + if (this.field === 'age') { + value = patient[this.field](new Date()); + } else { + value = patient[this.field](); + } + if (this.comparator === '=') { + return value === this.value; + } else if (this.comparator === '<') { + return value < this.value; + } else { + return value > this.value; + } + }; + return Comparison; +})(); +queryStructure.CodeSetRule = (function () { + __extends(CodeSetRule, queryStructure.Rule); + function CodeSetRule(data) { + CodeSetRule.__super__.constructor.call(this, data.type, data); + this.code_set_type = data.type; + } + + CodeSetRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p[this.code_set_type]().match(this.data.code.codes); + return codes.length !== 0; + }; + return CodeSetRule; +})(); +queryStructure.VitalSignRule = (function () { + __extends(VitalSignRule, queryStructure.Rule); + function VitalSignRule(data) { + VitalSignRule.__super__.constructor.call(this, "VitalSignRule", data); + } + + VitalSignRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.vitalSigns().match(this.data.code.codes); + return codes.length !== 0; + }; + return VitalSignRule; +})(); +queryStructure.EncounterRule = (function () { + __extends(EncounterRule, queryStructure.Rule); + function EncounterRule(data) { + EncounterRule.__super__.constructor.call(this, "EncounterRule", data); + } + + EncounterRule.prototype.test = function (p) { + var codes; + if (this.data.code === null) return true; + codes = p.encounters().match(this.data.code.codes); + return codes.length !== 0; + }; + return EncounterRule; +})(); +queryStructure.DemographicRule = (function () { + __extends(DemographicRule, queryStructure.Rule); + function DemographicRule(data) { + DemographicRule.__super__.constructor.call(this, "DemographicRule", data); + } + + DemographicRule.prototype.test = function (p) { + var match, status; + match = true; + if (this.data.ageRange) { + match = p.age() >= this.data.ageRange.low && p.age() <= this.data.ageRange.high; + } + if (this.data.maritalStatusCode && match) { + status = p.maritalStatus(); + match = status && status.includesCodeFrom(this.data.maritalStatusCode.codes); + } + if (this.data.gender && match) match = p.gender() === this.data.gender; + if (this.data.raceCode && match) { + match = p.race().includesCodeFrom(this.data.raceCode.codes); + } + return match; + }; + return DemographicRule; +})(); +queryStructure.RawJavascriptRule = (function () { + __extends(RawJavascriptRule, queryStructure.Rule); + function RawJavascriptRule(data) { + RawJavascriptRule.__super__.constructor.call(this, "RawJavascriptRule", data); + } + + RawJavascriptRule.prototype.test = function (p) { + if (this.data && this.data.js) { + try { + eval("var jscript = " + this.data.js); + return jscript(p); + } catch (_error) { + } + } + }; + return RawJavascriptRule; +})(); \ No newline at end of file diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index c030f0c..916f755 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -90,4 +90,20 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["senior_pop_digoxin_creatinine"].to_i, 2 assert_equal results["total_pop"].to_i, 9 end + + test "iteration graphical query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/graphical_builder_demographics_map.js') + rf = File.read('test/fixtures/scoop/graphical_builder_demographics_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + #puts results.inspect + assert_not_nil results + #assert_equal results["filtered_pop_sum"].to_i, 4 + #assert_equal results["unfound_pop_sum"].to_i, 5 + #assert_equal results["total_pop_sum"].to_i, 9 + end end From b70ec78b0be861b96ea8c2dc5c4b2281339bc482 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 7 Aug 2013 13:50:53 -0700 Subject: [PATCH 062/205] Added SSL layer to config (file script/rails), and certs files Signed-off-by: Pierre Beucher --- cert/ca | 1 + cert/endpoint-cert | 7 +++++++ cert/endpoint.crt | 32 +++++++++++++++++++++++++++++ cert/endpoint.csr | 27 ++++++++++++++++++++++++ cert/endpoint.key | 51 ++++++++++++++++++++++++++++++++++++++++++++++ runme.sh | 5 +++++ script/rails | 31 ++++++++++++++++++++++++++++ 7 files changed, 154 insertions(+) create mode 120000 cert/ca create mode 100755 cert/endpoint-cert create mode 100644 cert/endpoint.crt create mode 100644 cert/endpoint.csr create mode 100644 cert/endpoint.key create mode 100755 runme.sh diff --git a/cert/ca b/cert/ca new file mode 120000 index 0000000..9f5e199 --- /dev/null +++ b/cert/ca @@ -0,0 +1 @@ +/home/pierre/scoop/ca \ No newline at end of file diff --git a/cert/endpoint-cert b/cert/endpoint-cert new file mode 100755 index 0000000..00f9f15 --- /dev/null +++ b/cert/endpoint-cert @@ -0,0 +1,7 @@ +rm ./endpoint.crt +rm ./endpoint.csr +rm ./endpoint.key +openssl genrsa -out endpoint.key 4096 +openssl req -new -key endpoint.key -out endpoint.csr +openssl x509 -req -days 300 -in endpoint.csr -CA ca/LeadLab_root_cert_TEST.pem -CAkey ca/LeadLab_root_cert_TEST.key -set_serial 4167245126451912541925481541687546 -out endpoint.crt + diff --git a/cert/endpoint.crt b/cert/endpoint.crt new file mode 100644 index 0000000..bf3f514 --- /dev/null +++ b/cert/endpoint.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFgzCCA2sCDwDNdgc4W2u1/YktPCZY+jANBgkqhkiG9w0BAQUFADCBoTELMAkG +A1UEBhMCQkMxEzARBgNVBAgTCkNhbmR5IExhbmQxETAPBgNVBAcTCFZpY3Rvcmlh +MRAwDgYDVQQKEwdMZWFkTGFiMRcwFQYDVQQLEw53d3cubGVhZGxhYi5jYTEXMBUG +A1UEAxMOUGllcnJlIEJFVUNIRVIxJjAkBgkqhkiG9w0BCQEWF2JldWNoZXIucGll +cnJlQGZha2UuY29tMB4XDTEzMDgwNjIyNTIwNloXDTE0MDYwMjIyNTIwNlowXzEL +MAkGA1UEBhMCQ0ExCzAJBgNVBAgTAkJDMQwwCgYDVQQHEwNWaWMxEDAOBgNVBAoT +B0xlYWRMYWIxDzANBgNVBAsTBk91ckxhYjESMBAGA1UEAxMJbG9jYWxob3N0MIIC +IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqCZcoOl+fZl+8zrCMVHDUXg/ +o2+aHQvVcmr5gDbIv2QzVLdH7lyiWNvuDKITmSHnLK6tzNfgiEAbK0UB9Fnda1a/ +EckRcLgs2Yhdk3j8VtlSPhxkC5aoF/rU8FPgRfhyvpyhqIkVc0zUpqJLFJOAo/IR +zLPWKzAJVhZsTvwism2FuLC4YS8BSXzoNM9NXGNP5EG/Z/ONx8Q6BU4Ac6G+OgQS +KegsxD4uN9PaPMnKiX49QiJPqQNs/lzoD8WmX2UWUsyv2fkJL/p6nhvv8HQ1iPfS +vI433ONVVKqlqSzl/QLslXT4mPQUMr1wpNtAeSWpaUNRhJdz1YBwpeuGIY6s8Qh8 +ARnRQIaUhqe7GYkRNeiWtZ6zKo9YnlDcDRGBPmBJ/vPtY7va/QVeEaNOzEvdQcea +uNbIEc4bKPmgdasSZcc+SJUMavNn4YcaZ6bSYrdIG1ImJmXdI7k0/6hkl/ekjKbK +/5X44qSzZq4EkCxaboIE49qux9ZZF/BCKAhx6x7NQogeGBeHcHmuxgV+TWqQiWTl +2LGN8tnWRkSedLuEItKuBj06uAy2Jzq+gtEirOSZJ2i2ijeDUV/AyfKvZUw9K5ae +0AOvWDDAIwT7rCsoenNs6K4mvmYljMKf5B3MgcitmGGSgk6KIuyRF9R3jhjT8tl0 +jXAEN0pltnqJ+zvZvJMCAwEAATANBgkqhkiG9w0BAQUFAAOCAgEAigCturO43e+9 +ezIArYjw+Vu5BymaDOoQ32SQKjIFp+ZvpE4f1Jce9PBZWcKEjV9MrS87SyKAVYBg +N/x8/sjjDvylDYhCnPhCM4+5cmhuNSdtsssRF7otiJVN3PRUqDPIQpSwMoRE7VWN +pYtKi1PW9oEf1idwD8Xe3Rlwc0gplQ1YN42JYk/RzodsuT0XOdv/DqGBemeAwcfz +Jxl64ZLdRCJSHiK3vocoGdL7ywWQxQqS9rB0EDXMN+c5XtB5DSWcc3h9IE/lMius +2fFnkpS3pq0akDqbSJF2QoadXqxr5UqbngI2yyM6xsslsnXAdRbiCAgYnuwvUr8M +/ItI3LYDC0oqeZbEYFOLFsiYG/CG0Ec8jnyRhQcI5wz9bk0h2IBDZqBPrN0VUZIL +HfZcx7+CifeSSEWPJ4WgdR0cJrG7Pl6wO19lQuCkOtWcGdAu1KV1Qt5ideWZtEKb +KwLzg5oG/qPdrL6ybOeQJGSqbmfbMWTNAqVb/lrKFtE/5bsV0GKl90DHywWnhV6g +nootFAYHuQM/I89bhhI9wCzZLxABVGcK88BXS51SVgMW7gCLwsKhFG6Jr/38ezJ6 +a72NOXhAt9Jl7s1yZQT4Gzed/bM21wDovR2MdraSE03yUuhNCZiJ3t+Jvvo3cLnM +DeBOLL1TARbdHAy9SZRFM842HvrX6AU= +-----END CERTIFICATE----- diff --git a/cert/endpoint.csr b/cert/endpoint.csr new file mode 100644 index 0000000..cdfb784 --- /dev/null +++ b/cert/endpoint.csr @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIEpDCCAowCAQAwXzELMAkGA1UEBhMCQ0ExCzAJBgNVBAgTAkJDMQwwCgYDVQQH +EwNWaWMxEDAOBgNVBAoTB0xlYWRMYWIxDzANBgNVBAsTBk91ckxhYjESMBAGA1UE +AxMJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqCZc +oOl+fZl+8zrCMVHDUXg/o2+aHQvVcmr5gDbIv2QzVLdH7lyiWNvuDKITmSHnLK6t +zNfgiEAbK0UB9Fnda1a/EckRcLgs2Yhdk3j8VtlSPhxkC5aoF/rU8FPgRfhyvpyh +qIkVc0zUpqJLFJOAo/IRzLPWKzAJVhZsTvwism2FuLC4YS8BSXzoNM9NXGNP5EG/ +Z/ONx8Q6BU4Ac6G+OgQSKegsxD4uN9PaPMnKiX49QiJPqQNs/lzoD8WmX2UWUsyv +2fkJL/p6nhvv8HQ1iPfSvI433ONVVKqlqSzl/QLslXT4mPQUMr1wpNtAeSWpaUNR +hJdz1YBwpeuGIY6s8Qh8ARnRQIaUhqe7GYkRNeiWtZ6zKo9YnlDcDRGBPmBJ/vPt +Y7va/QVeEaNOzEvdQceauNbIEc4bKPmgdasSZcc+SJUMavNn4YcaZ6bSYrdIG1Im +JmXdI7k0/6hkl/ekjKbK/5X44qSzZq4EkCxaboIE49qux9ZZF/BCKAhx6x7NQoge +GBeHcHmuxgV+TWqQiWTl2LGN8tnWRkSedLuEItKuBj06uAy2Jzq+gtEirOSZJ2i2 +ijeDUV/AyfKvZUw9K5ae0AOvWDDAIwT7rCsoenNs6K4mvmYljMKf5B3MgcitmGGS +gk6KIuyRF9R3jhjT8tl0jXAEN0pltnqJ+zvZvJMCAwEAAaAAMA0GCSqGSIb3DQEB +BQUAA4ICAQBOD55x/5+Q+dQ6MIc0s38YMhxjWH0D//7nAu4HCVwBwKixoE+3YYwr +Oi4mm3xujHkQbdnMf6HhkqjKYpP5icyrTO8fzcDRfS7ci4dVIWxsqj0BXYr3qUuk +mYKJqaELkcXAwO4lisg/5i7NQJfHJ3cQhlj7HBGQj7drz1xPeE0K6yr0tknp3jnN +oCn+LFFc4LidEl0GDc4kp3WYXKz7beDXTgD4nuLeOXx+rw2fTH6FFc7UomK2EhmO +JC3nAev3Fsd3cfNS+0LVBNtTuiqRXv8VLfOSyZf5/h4gbtcOl9LTuz8qQhSoVbNJ +O50ySrHBa8SnGUZ0pEWka4CE9YskdQY17YEoROBTCPMVuje0EVNEtVqEF384b4n/ +PaC8H1zjaDeN4Lqn4z+rxjxnOS/89a/IUyaUYti0StD4C1e6Y6eu5SwZnnvcNv8A +G6cWECqLvP/ht+G9IDytC4OA4u+mP9d4LC10lPFgh/7Qb6oVwC/NIl9Y3ySzy94r +vddwqjoGcKc5XtFlIeYlYndlBlGC9yNrV9cfhT9ZE/nW4kpaTlJHA5u8AzcOriS7 +so7IOgJjJczznXbvl/sVboJohLGZSY9KYtuUJqC+M9wYlG5EH0ghu+EANXz5nFmL +GZoZ4O3niAIK3ffLXd3ILUdprqbHqspVZSX/XVJGbSs3u3pSGBPmIw== +-----END CERTIFICATE REQUEST----- diff --git a/cert/endpoint.key b/cert/endpoint.key new file mode 100644 index 0000000..9b389fe --- /dev/null +++ b/cert/endpoint.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEAqCZcoOl+fZl+8zrCMVHDUXg/o2+aHQvVcmr5gDbIv2QzVLdH +7lyiWNvuDKITmSHnLK6tzNfgiEAbK0UB9Fnda1a/EckRcLgs2Yhdk3j8VtlSPhxk +C5aoF/rU8FPgRfhyvpyhqIkVc0zUpqJLFJOAo/IRzLPWKzAJVhZsTvwism2FuLC4 +YS8BSXzoNM9NXGNP5EG/Z/ONx8Q6BU4Ac6G+OgQSKegsxD4uN9PaPMnKiX49QiJP +qQNs/lzoD8WmX2UWUsyv2fkJL/p6nhvv8HQ1iPfSvI433ONVVKqlqSzl/QLslXT4 +mPQUMr1wpNtAeSWpaUNRhJdz1YBwpeuGIY6s8Qh8ARnRQIaUhqe7GYkRNeiWtZ6z +Ko9YnlDcDRGBPmBJ/vPtY7va/QVeEaNOzEvdQceauNbIEc4bKPmgdasSZcc+SJUM +avNn4YcaZ6bSYrdIG1ImJmXdI7k0/6hkl/ekjKbK/5X44qSzZq4EkCxaboIE49qu +x9ZZF/BCKAhx6x7NQogeGBeHcHmuxgV+TWqQiWTl2LGN8tnWRkSedLuEItKuBj06 +uAy2Jzq+gtEirOSZJ2i2ijeDUV/AyfKvZUw9K5ae0AOvWDDAIwT7rCsoenNs6K4m +vmYljMKf5B3MgcitmGGSgk6KIuyRF9R3jhjT8tl0jXAEN0pltnqJ+zvZvJMCAwEA +AQKCAgBr5soT/CHOaVx8qp0I1wX2VqrHrwr/TqO224ylyQIDR0JlP4OqIsmPKfpV +IwBeiNH261TeGT2dUT3eA1dgvPYINk9AE33cjmNBaG9b/gw3kxdiggd1JEVTtgNF +AR3u6KKBTLO0Gduo9ImVMJnrZ0fqbKEdcd2iMx4anyL7gHKnev6PaN+4hVhXFw9P +LCPhgF05BTPVegXmRjZRRx+lFAqk4g3h1Ho9qAUykAEAdyFAH8EhmjDyLR+ZDndf +/55motCza2QBBPzvS9W5dgX/kCL2dMlHdB/G4B7WyParXANt252Dvt70D9SSRtxs +/cEevJs80BUUd7e+LsCayEt3Zz30F+NU4K5FHPHuWiMIqmEHGNabXXBqKdYzv4Io +wYwKvhczYsSu3aL1TeBK3imjMu+6ESRLDhQTEjlQWmTYwyvPWMZgJ3LlmhIdQ8mj +bpPSRlIDbW5LVskd8JNc3H15vs+Sqywp8kBDgQOy7Fj9HpBo8lYHgQZ5VkgVeFEV +gmWjGfpsh34PpObd6OjVXGTnsIhziS/oS7oMStd9jLjNCX6MvPk3//E31cCmvoq+ +vrSh2OmG+wKB0SQERilYnAOZJao8epRzlu0S8+j2G+8T8UdSuhicUJTiTWNCNzJU +9hJmfRRgbH47zjZz4Qm9HngzUZpR9SxLKM1GYNmkPCMhoSSDiQKCAQEA1uWxPp56 +TO34vs+TzaXW8icjJ2nJXYbaQ5NqrKoLUwmw+z+MNYtIJv2f0eZMyGiE1QAl9/lx +mduxyMdHhhw7j0vOj+8EZnDP93xx1mEUtW1/wpz8spQy+Xc+cwZV8U381unCvdtX +hceYJ0COnxTDzVPB6E4AEOOzGgekbwUh0oIsCy1bAz/wg0nQLNrU+rwwqo0Z1Edi +lqBX5ipENWrQTN3IVWli6eNO299Aw4pxXJmG/x6RNcAZisI4kmh6ch4mbF3Y8DjP +xDnztfyIRLI+UqvlTnBDcydYnpZQjtrhk53rC4ZVkrD3wCGDiMeCO16x5w3dAnY0 +v1eEdCOou/QD5wKCAQEAyE+2l0mzQYb6VfiWPP6uDijis7KxGcKiqj0GOhQsfrZM +GMIwEW5KD/8azDmQJYFuFPO6A+oQ+AlSac/RLGcfiCYK1L6/1sAnQCLctxG/aYMi +mp9ViMTIDShBP7oHMhdqZrecunHdoco/fl8xJqGqqi3qnPrb6mMwOm19aWbPyhVe +5xYn++iq33vEhpxrv5DTgqIf51kUtDEQpSMXIc0xjpXglKbywohCz7Vy7M5skrKa +5nVyXvD954z7GochiEgYnv7sYN7peSr9yIDg/78qmBShp2CCsMdDLfycDDMHszbu +Sb2+nMb/YoeWJRk6wajgW3KTWTbrFpNSy0pEeQ3sdQKCAQEA1F2nHCfG2tFtOTuv +Z9IUqbctkVyEZ43FknRTPhDJIiV4pcI2EA/1nLqVPvvlM0O+yTPdUcJLlm26spzk +vM6XuVOD7U+aPJYNnxh28xF7QpPUZwF25A96lHdX2poPQmj8jXHzRmZFhuopHdk5 +WFJP8VBtVuIGRKqQqw+UWzZqJzsGxYDr6Tk9uLCwLjOPt71UJqdMODDXZ91LICTy +xQsqkFu4B1gfLN26Z6SnvtXIk2cRNnsBq2mMlEi9WUowfyf2dq8DnNm30MYoZtcJ +30F6P36qHCrrLRhcBlSrhZEezR+JURlO5alHHLLB5uCqfXtmOdzEZRNlqxWUyqUW +sa9CTwKCAQEAni8k+DABWRvokP+wVRaiCRiMfm/8n2Uu49UxF6hawu3fBiZDo2A/ +KIbCeMh0ZsnhTrZyDSlIoTdrV5f/jVsacX/pSbwg7svrsyBUwFVJnV8rcoOlHk6X +1JwXeuXDTPFk2xzgrfPBnESFA5zUybcdeSqtfa41ANG3gkx4n0XLjcB2o3LBvJMu +bTHmLo9UH4GVJjI1k5KrYOjmRiKB3/WUzw7YvUthpfHJIRIfYZZZ8zcMUDYrTYJu +X+7bVUWlW2Pj3Zteu9kM8tzacP4lsJEcZ+DTD8SNMGELUkOMT630xLf6UU2AO3qC +ryJ3lXBpEAn2swC2D9vopnlNBrDthdNTCQKCAQBQhohWkX+eP3DjGk8H06K72bTx +xi3/TS5UtvDHfYMv99x/gGxYFf5IoP42BUKBCChfWhtSKPp5mgrxlfCenElFDE/n +YTBNOmYqM7zoP5dBqB6Aik+OGyKooos1egAmEkgYxmtE4vj6xV721waY3mVWGY0m +mAIm+AB87Lwr6+ueKEx0c6ZfHm6JnzOClCq6hWRe6vf6MMw4iqFxsSoiDpgFjWKU +9iX5ot4y43TpoxXLsMmQuojI5JXtCiJZEgl4kbscPbkoLXi5IALaWqjYNIGKPMd3 +omGlrAG5r52I37Z26dc4yyGn+0TXzP0VdUXdxpPzMeokN39OJkY6rKRH/7/R +-----END RSA PRIVATE KEY----- diff --git a/runme.sh b/runme.sh new file mode 100755 index 0000000..4034fe3 --- /dev/null +++ b/runme.sh @@ -0,0 +1,5 @@ +##!/bin/bash + +bundle exec script/delayed_job start +bundle exec rails server -p 3001 +bundle exec script/delayed_job stop diff --git a/script/rails b/script/rails index f8da2cf..659b5f5 100755 --- a/script/rails +++ b/script/rails @@ -1,6 +1,37 @@ #!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. +require 'rubygems' +require 'rails/commands/server' +require 'rack' +require 'webrick' +require 'webrick/https' + +#override server defaults options to use ssl +CA_CERT_PATH = "cert/ca/LeadLab_root_cert_TEST.pem" +SERVER_CERT_PATH = "cert/endpoint.crt" +SERVER_KEY_PATH = "cert/endpoint.key" + +module Rails + class Server < ::Rack::Server + def default_options + super.merge({ + :environment => (ENV['RAILS_ENV'] || "development").dup, + :daemonize => false, + :debugger => false, + :pid => File.expand_path("tmp/pids/server.pid"), + :config => File.expand_path("config.ru"), + :SSLEnable => true, + :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT, + :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(SERVER_KEY_PATH).read), + :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(SERVER_CERT_PATH).read), + :SSLCACertificateFile => CA_CERT_PATH, + :SSLCertName => [["CN", WEBrick::Utils::getservername]], + }) + end + end +end + APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' From 9cb92dda81a31929dea2f88cd93a40f9a75db04d Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 8 Aug 2013 09:23:30 -0700 Subject: [PATCH 063/205] Update to current health-data-standards --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f9eacf8..1d81a4b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: 12d1dfc3b9142990b6d17b1efcb3d59f8e39d2f5 + revision: 7abe229c1dc62a6fc55abc9233f3c8c2b3cc2aae branch: scoop-develop specs: health-data-standards (2.1.4) From ac1ae72efcf5ba5632c834ab424d458181bb2e7d Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 9 Aug 2013 12:43:58 -0700 Subject: [PATCH 064/205] Add Travis CI support Signed-off-by: Jeremy Ho --- .travis.yml | 11 +++++++++++ README.md | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..25b5b81 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: ruby +rvm: + - 1.9.3 +branches: + only: + - master +services: + - mongodb +notifications: + email: false +script: bundle exec rake test:units test:functionals test:integration diff --git a/README.md b/README.md index b2d2070..347c725 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -hQuery +hQuery [![travis](https://secure.travis-ci.org/scoophealth/query-gateway.png)](http://travis-ci.org/scoophealth/query-gateway) ========= The query gateway is a web based application that provides the back end for executing queries. From 2f68dc72116748d1be503052d97206eeb06343ed Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 15 Aug 2013 15:20:20 -0700 Subject: [PATCH 065/205] Update Gemfile.lock for current health-data-standards scoop-develop branch --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1d81a4b..8fc1a23 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: 7abe229c1dc62a6fc55abc9233f3c8c2b3cc2aae + revision: 1a80a36b90e723ba457cbdfcb6f8441861b43c2e branch: scoop-develop specs: health-data-standards (2.1.4) From e6bf1fc81dff747795b146c1de890968ff88ee10 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 15 Aug 2013 15:30:14 -0700 Subject: [PATCH 066/205] Update HDS Library Update SCOOP test records Added Pneumococcal Query test --- Gemfile.lock | 2 +- test/fixtures/scoop-records.json | 18 ++++---- test/fixtures/scoop/scoop_it6_pneumo_map.js | 47 +++++++++++++++++++++ test/unit/scoop_job_test.rb | 13 ++++++ 4 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 test/fixtures/scoop/scoop_it6_pneumo_map.js diff --git a/Gemfile.lock b/Gemfile.lock index 1d81a4b..300f2d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: http://github.com/scoophealth/health-data-standards.git - revision: 7abe229c1dc62a6fc55abc9233f3c8c2b3cc2aae + revision: 0bcc364c6dc86e356a7083af19191f0babe686df branch: scoop-develop specs: health-data-standards (2.1.4) diff --git a/test/fixtures/scoop-records.json b/test/fixtures/scoop-records.json index cee9316..aae06f2 100644 --- a/test/fixtures/scoop-records.json +++ b/test/fixtures/scoop-records.json @@ -1,9 +1,9 @@ -{ "_id" : { "$oid" : "51cdfdc342582221e8000001" }, "effective_time" : 1370835720, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000008" }, "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000009" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000a" }, "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800000b" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000002" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000003" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000004" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000005" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000006" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000007" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc342582221e800000c" }, "effective_time" : 1370835720, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001b" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001c" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001d" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001e" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800001f" }, "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000020" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000021" }, "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000022" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000d" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800000e" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800000f" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000010" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000011" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000012" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000013" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000014" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000015" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000016" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000017" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000018" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000019" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800001a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc342582221e8000023" }, "effective_time" : 1370835720, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000056" }, "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000057" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "12227-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000024" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "WBC", "referenceRange" : "4.0...11.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000025" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "6.9", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000026" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "RBC", "referenceRange" : "4.20...5.80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000027" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "4.39", "units" : "tera/L" } ] }, { "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000028" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Hemoglobin", "referenceRange" : "135...170", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000029" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "141", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Hematocrit", "referenceRange" : "0.40...0.50", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.42", "units" : null } ] }, { "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "MCV", "referenceRange" : "82...98", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "95", "units" : "fL" } ] }, { "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800002e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "RDW", "referenceRange" : "11.0...15.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800002f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.6", "units" : "%" } ] }, { "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000030" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Platelet Count", "referenceRange" : "150...400", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000031" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "182", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000032" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Neutrophils", "referenceRange" : "2.0...8.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000033" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "3.6", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000034" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Lymphocytes", "referenceRange" : "1.2...3.5", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000035" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "2.5", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000036" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Monocytes", "referenceRange" : "0.2...1.0", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000037" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.5", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000038" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Eosinophils", "referenceRange" : "0.0...0.7", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000039" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.3", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243497, "description" : "Basophils", "referenceRange" : "0.0...0.2", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.0", "units" : "giga/L" } ] }, { "codes" : { "LOINC" : [ "2885-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243790, "description" : "Total Protein", "referenceRange" : "62...82", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "75", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800003e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Albumin", "referenceRange" : "34...50", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800003f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "39", "units" : "g/L" } ] }, { "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000040" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Total Bilirubin", "referenceRange" : "0...18", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000041" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12", "units" : "umol/L" } ] }, { "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000042" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Direct Bilirubin", "referenceRange" : "0...5", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000043" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "2", "units" : "umol/L" } ] }, { "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000044" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Alkaline Phosphatase", "referenceRange" : "30...135", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000045" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "56", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000046" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "Gamma GT", "referenceRange" : "15...80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000047" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "43", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000048" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1314243763, "description" : "ALT", "referenceRange" : "25...80", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000049" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "85", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004a" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1314243763, "description" : "AST", "referenceRange" : "10...38", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "51", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "2532-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314243763, "description" : "LD", "referenceRange" : "90...240", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "191", "units" : "U/L" } ] }, { "codes" : { "LOINC" : [ "26513-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e800004e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Neutrophils", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e800004f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "11031-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000050" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Lymphocytes", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000051" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "30437-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000052" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Monocytes + Macrophages", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000053" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] }, { "codes" : { "LOINC" : [ "28544-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc342582221e8000054" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1314238388, "description" : "Fluid Mesothelial Cells", "values" : [ { "_id" : { "$oid" : "51cdfdc342582221e8000055" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Results unavailable due to laboratory error. %", "units" : null } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e8000058" }, "effective_time" : 1370835720, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006b" }, "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006c" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006d" }, "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006e" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800006f" }, "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000070" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000059" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005b" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005c" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005d" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800005e" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800005f" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000060" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000061" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000062" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000063" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000064" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000065" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000066" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000067" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000068" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000069" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800006a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e8000071" }, "effective_time" : 1370835720, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e8" }, "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e9" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ea" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000eb" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ec" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ed" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ee" }, "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ef" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d6" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d8" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000da" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000db" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "400.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000dc" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000dd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000de" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000df" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e0" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e2" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e4" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000e6" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000e7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "31208-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000072" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304066400, "description" : "Specimen Source", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000073" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Bone Chip\nbone Lt metatarsal", "units" : null } ] }, { "codes" : { "LOINC" : [ "664-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000074" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304045349, "description" : "Gram Stain", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000075" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+3 Polymorphs \n+4 Gram negative bacilli resembling coliforms \n+4 Gram positive cocci in pairs and chains \n+2 Gram positive cocci in clusters \n+2 Yeast", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10114C" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000076" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419909, "description" : "Report Status Preliminary", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000077" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+3 Proteus mirabilis \nImipenem : Further report to follow \n+3 Escherichia coli \n+3 Klebsiella oxytoca", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000078" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419753, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000079" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Proteus mirabilis", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800007e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800007f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "145-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000080" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419753, "description" : "Cefuroxime Parenteral", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000081" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "80-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000082" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefixime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000083" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "108-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000084" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefotaxime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000085" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "141-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000086" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Ceftriaxone", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000087" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "120-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000088" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Cefpodoxime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000089" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "133-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Ceftazidime", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800008e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800008f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000090" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334518, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000091" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "496-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000092" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304419675, "description" : "Tetracycline", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000093" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000094" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000095" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Escherichia coli", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000096" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000097" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000098" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000099" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009a" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009c" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800009e" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800009f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334281, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "6463-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Culture", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Klebsiella oxytoca", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "149-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "76-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000a8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Cefazolin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000a9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000aa" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ab" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ac" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ad" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ae" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1304334269, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000af" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "5778-6" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Colour", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "YELLOW", "units" : null } ] }, { "codes" : { "LOINC" : [ "5767-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Appearance", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "CLEAR", "units" : null } ] }, { "codes" : { "LOINC" : [ "2756-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "pH", "referenceRange" : "5.0...8.5", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "7.5", "units" : null } ] }, { "codes" : { "LOINC" : [ "5811-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Specific Gravity", "referenceRange" : "1.003...1.035", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.010", "units" : null } ] }, { "codes" : { "LOINC" : [ "5804-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000b8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Protein", "referenceRange" : "...0.3", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000b9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<0.3 g/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "2349-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ba" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Glucose", "referenceRange" : "...6", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<6 mmol/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "2514-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000bc" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ketones", "referenceRange" : "...1.5", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "<1.5 mmol/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "5794-3" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000be" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Hemoglobin", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000bf" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "NEG", "units" : null } ] }, { "codes" : { "LOINC" : [ "5802-4" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Nitrite", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "NEG", "units" : null } ] }, { "codes" : { "LOINC" : [ "5799-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c2" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1312111200, "description" : "Leukocytes", "referenceRange" : "Neg", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "+2", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10114" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Report Status", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "Final", "units" : null } ] }, { "codes" : { "LOINC" : [ "X433" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c6" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Organism 1", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c7" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "ESCHERICHIA COLI\\.Zt\\OVER 100 M CFU/L", "units" : null } ] }, { "codes" : { "LOINC" : [ "28-1" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000c8" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ampicillin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000c9" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "R", "units" : null } ] }, { "codes" : { "LOINC" : [ "X10042" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ca" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Cephalothin-Cephalexin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "516-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000cc" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Trimethoprim-Sulfa", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "185-9" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000ce" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Ciprofloxacin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000cf" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "267-5" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d0" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Gentamicin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d1" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "496-0" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d2" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Tetracycline", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d3" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] }, { "codes" : { "LOINC" : [ "363-2" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000d4" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1312111200, "description" : "Nitrofurantoin", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000d5" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "S", "units" : null } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e80000f0" }, "effective_time" : 1370835720, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f7" }, "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f8" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f3" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 0 }, "denominator" : { "unit" : null, "value" : 0 } } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f4" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f5" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f6" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000f1" }, "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000f2" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "131.6", "units" : "umol/L" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e80000f9" }, "effective_time" : 1370835720, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000110" }, "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000111" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000112" }, "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000113" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000114" }, "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000115" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000116" }, "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000117" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fc" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000fd" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "500.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fe" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000ff" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "25.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000100" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000101" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "400.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000102" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000103" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "1.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000104" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000105" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "81.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000106" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000107" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.25", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000108" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000109" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010a" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010b" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "5.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010c" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010d" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "12.5", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800010e" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "completed", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800010f" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "40.0", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e80000fa" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e80000fb" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "161.2", "units" : "umol/L" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e8000118" }, "effective_time" : 1370835720, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800011d" }, "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011e" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000119" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011a" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "100.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800011b" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : "completed", "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e800011c" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "20.0", "units" : "µG" } ] } ] } -{ "_id" : { "$oid" : "51cdfdc442582221e800011f" }, "effective_time" : 1370835720, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000128" }, "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000129" }, "given_name" : "doctor", "family_name" : "doe" } ] }, { "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e800012a" }, "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : 1362441600, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "51cdfdc442582221e800012b" }, "given_name" : "doctor", "family_name" : "doe" } ] } ], "medications" : [ { "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000122" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000123" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "10.0", "units" : "MG" } ] }, { "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000124" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000125" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "112.0", "units" : "µG" } ] }, { "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000126" }, "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : "active", "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.5.1127", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000127" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "0.25", "units" : "MG" } ] } ], "results" : [ { "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_id" : { "$oid" : "51cdfdc442582221e8000120" }, "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : null }, "time" : 1370604000, "description" : "Creatinine", "referenceRange" : "150.0...", "values" : [ { "_id" : { "$oid" : "51cdfdc442582221e8000121" }, "_type" : "PhysicalQuantityResultValue", "scalar" : "158.4", "units" : "umol/L" } ] } ] } +{ "_id" : { "$oid" : "520d4dce425822f903000001" }, "effective_time" : 1376493840, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dce425822f903000002" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000003" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dce425822f903000004" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000005" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dce425822f903000006" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000007" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f903000008" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000009" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f90300000a" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f90300000b" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf4258224d0f00002f" }, "effective_time" : 1376493840, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000030" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000031" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000032" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000033" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000034" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } +{ "_id" : { "$oid" : "520d4dcf42582274e20000b4" }, "effective_time" : 1376493840, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b5" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b6" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b8" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b9" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf42582274e20000ba" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 112 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bb" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bc" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bd" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf4258227fac00000c" }, "effective_time" : 1376493840, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000d" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000e" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00000f" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000010" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000011" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000012" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000013" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000014" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000015" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf4258227fac000016" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000017" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000018" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000019" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001a" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001b" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001c" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001d" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001e" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001f" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000020" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000021" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000022" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000023" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000024" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000025" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000026" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000027" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000028" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000029" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002a" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002b" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002c" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002d" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002e" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf425822b958000051" }, "effective_time" : 1376493840, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf425822b958000052" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822b958000053" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000054" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000055" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000056" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000057" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000058" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000059" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005b" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "520d4dcf425822b95800005c" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf425822b95800005d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005e" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005f" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000060" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000061" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000062" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000063" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000064" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000065" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000066" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000067" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000068" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000069" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf425822b958000070" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000071" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000072" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000073" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000074" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000075" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000076" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000077" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000078" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000079" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007a" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007b" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007c" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007d" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007e" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007f" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000080" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000081" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000082" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000083" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000084" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000085" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000086" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000087" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000088" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000089" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008a" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008b" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008c" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008d" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008e" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008f" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000090" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000091" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000092" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000093" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000094" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000095" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000096" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000097" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000098" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000099" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009a" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009b" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009c" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009d" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009e" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009f" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a0" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a1" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a2" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a3" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a4" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a5" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a6" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a7" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a8" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "130/85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a9" }, "scalar" : "130/85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000aa" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "37", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ab" }, "scalar" : "37", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ac" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight (in kg)", "free_text" : "71", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ad" }, "scalar" : "71", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ae" }, "codes" : { "LOINC" : [ "8302-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Height (in cm)", "free_text" : "170", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000af" }, "scalar" : "170", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000b0" }, "codes" : { "LOINC" : [ "56115-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Waist (Waist Circum in cm)", "free_text" : "36", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000b1" }, "scalar" : "36", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000b2" }, "codes" : { "LOINC" : [ "8867-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Heart Rate (in bpm (nnn) Range:40-180)", "free_text" : "85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000b3" }, "scalar" : "85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf425822e5a4000035" }, "effective_time" : 1376493840, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000036" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000037" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000038" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000039" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003a" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003c" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003e" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003f" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000040" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000041" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } }, "duration" : { "width" : { "unit" : "D", "value" : 16 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000042" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000043" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000044" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000045" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000046" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000047" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000048" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000049" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004a" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004b" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004c" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004d" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004e" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004f" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000050" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd04258221c5e0000e1" }, "effective_time" : 1376493840, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e2" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e4" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e5" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd04258221c5e0000e7" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e8" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd0425822b0f60000e9" }, "effective_time" : 1376493840, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ea" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000eb" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000ec" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ed" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ee" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ef" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f0" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f1" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f2" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f3" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f4" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f5" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd0425822b79b0000be" }, "effective_time" : 1376493840, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000bf" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c0" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c1" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c2" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c4" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c5" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c6" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c8" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c9" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ca" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cb" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000cc" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cd" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ce" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cf" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d0" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d1" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d2" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d3" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d4" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d5" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d6" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d7" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d8" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d9" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000da" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000db" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dc" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dd" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000de" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000df" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "140/90", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000e0" }, "scalar" : "140/90", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } diff --git a/test/fixtures/scoop/scoop_it6_pneumo_map.js b/test/fixtures/scoop/scoop_it6_pneumo_map.js new file mode 100644 index 0000000..dced290 --- /dev/null +++ b/test/fixtures/scoop/scoop_it6_pneumo_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetImmunizationCodes = { + "whoATC": ["J07AL02"] + }; + + var ageLimit = 65; + + var immunizationList = patient.immunizations(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of Pneumovax + function hasImmunization() { + return immunizationList.match(targetImmunizationCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasImmunization()) { + emit("total_pneumovax", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit("senior_pop", 1); + if (hasImmunization()) { + emit("senior_pop_pneumovax", 1); + } + } +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 916f755..69f8447 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -91,6 +91,19 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["total_pop"].to_i, 9 end + test "iteration 6 pneumococcal query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/scoop_it6_pneumo_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["total_pneumovax"].to_i, 2 + assert_equal results["senior_pop_pneumovax"].to_i, 1 + end + test "iteration graphical query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/graphical_builder_demographics_map.js') From 43cdff59fb7279bf6d0898de42b9d1955e3dbf06 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 15 Aug 2013 16:16:23 -0700 Subject: [PATCH 067/205] Tweak Travis Readme Icon Signed-off-by: Jeremy Ho --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 347c725..d427ca1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -hQuery [![travis](https://secure.travis-ci.org/scoophealth/query-gateway.png)](http://travis-ci.org/scoophealth/query-gateway) +hQuery [![travis](https://secure.travis-ci.org/scoophealth/query-gateway.png?branch=master)](http://travis-ci.org/scoophealth/query-gateway) ========= The query gateway is a web based application that provides the back end for executing queries. From 9cdfec3993c2c841b77f96ddc16816415dcc8292 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Fri, 16 Aug 2013 14:18:23 -0700 Subject: [PATCH 068/205] Deassociate pneumococcal with IT6 in test Signed-off-by: Jeremy Ho --- ...neumo_map.js => scoop_pneumococcal_map.js} | 0 test/unit/scoop_job_test.rb | 37 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) rename test/fixtures/scoop/{scoop_it6_pneumo_map.js => scoop_pneumococcal_map.js} (100%) diff --git a/test/fixtures/scoop/scoop_it6_pneumo_map.js b/test/fixtures/scoop/scoop_pneumococcal_map.js similarity index 100% rename from test/fixtures/scoop/scoop_it6_pneumo_map.js rename to test/fixtures/scoop/scoop_pneumococcal_map.js diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 69f8447..004f9c3 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class ScoopJobTest < ActiveSupport::TestCase - + setup do dump_database dump_jobs @@ -9,6 +9,22 @@ class ScoopJobTest < ActiveSupport::TestCase load_scoop_database end + test "graphical query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/graphical_builder_demographics_map.js') + rf = File.read('test/fixtures/scoop/graphical_builder_demographics_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + #puts results.inspect + assert_not_nil results + #assert_equal results["filtered_pop_sum"].to_i, 4 + #assert_equal results["unfound_pop_sum"].to_i, 5 + #assert_equal results["total_pop_sum"].to_i, 9 + end + test "iteration 0 query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/scoop_it0_map.js') @@ -91,9 +107,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["total_pop"].to_i, 9 end - test "iteration 6 pneumococcal query works properly" do + test "pneumococcal vaccine query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it6_pneumo_map.js') + mf = File.read('test/fixtures/scoop/scoop_pneumococcal_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -104,19 +120,4 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["senior_pop_pneumovax"].to_i, 1 end - test "iteration graphical query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/graphical_builder_demographics_map.js') - rf = File.read('test/fixtures/scoop/graphical_builder_demographics_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - #puts results.inspect - assert_not_nil results - #assert_equal results["filtered_pop_sum"].to_i, 4 - #assert_equal results["unfound_pop_sum"].to_i, 5 - #assert_equal results["total_pop_sum"].to_i, 9 - end end From 96d9361e7fcf978dba4d459c0d3e5634ea10baf1 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 19 Aug 2013 11:12:01 -0700 Subject: [PATCH 069/205] Improved test for graphical query (i.e., query sent by query-composer), added relay-service.rb used to populate db --- test/unit/scoop_job_test.rb | 8 +++--- util/relay-service.rb | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 util/relay-service.rb diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 004f9c3..e25d74c 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -18,11 +18,11 @@ class ScoopJobTest < ActiveSupport::TestCase job.invoke_job query.reload results = query.result - #puts results.inspect assert_not_nil results - #assert_equal results["filtered_pop_sum"].to_i, 4 - #assert_equal results["unfound_pop_sum"].to_i, 5 - #assert_equal results["total_pop_sum"].to_i, 9 + rvalues = results["{\"type\"=>\"population\"}"]['values'] + assert_equal rvalues["filtered_pop_sum"].to_i, 4 + assert_equal rvalues["unfound_pop_sum"].to_i, 5 + assert_equal rvalues["total_pop_sum"].to_i, 9 end test "iteration 0 query works properly" do diff --git a/util/relay-service.rb b/util/relay-service.rb new file mode 100755 index 0000000..5570c72 --- /dev/null +++ b/util/relay-service.rb @@ -0,0 +1,50 @@ +#!/usr/bin/env ruby +# A simple WEBrick web server +# +require 'webrick' +require 'net/http/post/multipart' + +include WEBrick # import WEBrick namespace + +config={} +config.update(:Port => 3000) +config.update(:DocumentRoot => './') +server = HTTPServer.new(config) + +# Mount servlets +server.mount_proc('/') { |req, resp| + resp.body = 'Delete test patient records
Create test patient records' +} +server.mount_proc('/records/destroy') { |req, resp| + uri = URI.parse("http://localhost:3001/records/destroy") + http = Net::HTTP.new(uri.host, uri.port) + request = Net::HTTP::Delete.new(uri.request_uri) + response = http.request(request) + resp.body = response.body +} +class RecordRelayServlet < HTTPServlet::AbstractServlet + def do_GET(request, response) + Dir.glob('./files/*.xml') do |xml_file| + url = URI.parse('http://localhost:3001/records/create') + res = nil + File.open(xml_file) do |xml| + req = Net::HTTP::Post::Multipart.new url.path, "content" => UploadIO.new(xml, "text/xml", "temp_scoop_document.xml") + res = Net::HTTP.start(url.host, url.port) do |http| + http.request(req) + end + end + response.body = res.body + end + raise HTTPStatus::OK + end + alias :do_POST :do_GET # accept POST request +end +server.mount('/records/relay', RecordRelayServlet) + +# Trap signals to shutdown cleanly. +['INT', 'TERM'].each do |signal| + trap(signal) {server.shutdown} +end + +# Start the server +server.start From 1d13b8eb0c1e7529aed0da52ec92c8a170974276 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 19 Aug 2013 14:56:37 -0700 Subject: [PATCH 070/205] Added most AMCARE queries to tests Signed-off-by: Jeremy Ho --- test/fixtures/scoop/colon_screening_map.js | 41 ++++++++ test/fixtures/scoop/diabetes_hgba1c_map.js | 43 +++++++++ .../scoop/diabetes_hgba1c_value_map.js | 60 ++++++++++++ test/fixtures/scoop/diabetes_ldl_map.js | 60 ++++++++++++ .../fixtures/scoop/fasting_blood_sugar_map.js | 40 ++++++++ test/fixtures/scoop/pneumococcal_map.js | 32 +++++++ test/fixtures/scoop/population_map.js | 58 +++++++++++ test/fixtures/scoop/scoop_pneumococcal_map.js | 47 --------- test/unit/scoop_job_test.rb | 96 ++++++++++++++++++- 9 files changed, 429 insertions(+), 48 deletions(-) create mode 100644 test/fixtures/scoop/colon_screening_map.js create mode 100644 test/fixtures/scoop/diabetes_hgba1c_map.js create mode 100644 test/fixtures/scoop/diabetes_hgba1c_value_map.js create mode 100644 test/fixtures/scoop/diabetes_ldl_map.js create mode 100644 test/fixtures/scoop/fasting_blood_sugar_map.js create mode 100644 test/fixtures/scoop/pneumococcal_map.js create mode 100644 test/fixtures/scoop/population_map.js delete mode 100644 test/fixtures/scoop/scoop_pneumococcal_map.js diff --git a/test/fixtures/scoop/colon_screening_map.js b/test/fixtures/scoop/colon_screening_map.js new file mode 100644 index 0000000..9216c39 --- /dev/null +++ b/test/fixtures/scoop/colon_screening_map.js @@ -0,0 +1,41 @@ +// TODO: Add freetext definition search +// TODO: Add Colon screening portion of query +function map(patient) { + var targetLabCodes = { + "LOINC": ["58453-2", "14563-1", "14564-9", "14565-6"] + }; + + var ageLimitLow = 50; + var ageLimitHigh = 74; + var resultList = patient.results(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -2, 0, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is in target age range + function population(patient) { + return (patient.age(now) >= ageLimitLow && patient.age(now) <= ageLimitHigh); + } + + // Checks for Hemoccult labs performed within the last 2 years + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + if (population(patient)) { + emit("patients_50-74", 1); + if (hasLabCode()) { + emit("has_hemoccult_result", 1); + } + } +} diff --git a/test/fixtures/scoop/diabetes_hgba1c_map.js b/test/fixtures/scoop/diabetes_hgba1c_map.js new file mode 100644 index 0000000..7763936 --- /dev/null +++ b/test/fixtures/scoop/diabetes_hgba1c_map.js @@ -0,0 +1,43 @@ +// TODO: Add freetext definition search +function map(patient) { + var targetLabCodes = { + "LOINC": ["4548-4"] + }; + + var targetProblemCodes = { + "ICD9": ["250"] + }; + + var resultList = patient.results(); + var problemList = patient.conditions(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, 0, -6, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks for HGBA1C labs performed within the last 6 months + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + if (hasProblemCode()) { + emit("diabetics", 1); + if(hasLabCode()) { + emit("has_hgba1c_result", 1); + } + } +} diff --git a/test/fixtures/scoop/diabetes_hgba1c_value_map.js b/test/fixtures/scoop/diabetes_hgba1c_value_map.js new file mode 100644 index 0000000..5c8ba30 --- /dev/null +++ b/test/fixtures/scoop/diabetes_hgba1c_value_map.js @@ -0,0 +1,60 @@ +// TODO: Add freetext definition search +function map(patient) { + var targetLabCodes = { + "LOINC": ["4548-4"] + }; + + var targetProblemCodes = { + "ICD9": ["250"] + }; + + var hgba1cLimit = 7; + + var resultList = patient.results(); + var problemList = patient.conditions(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -1, 0, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks for HGBA1C labs performed within the last year + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + // Checks if HGBA1C meets parameters + function hasMatchingLabValue() { + for (var i = 0; i < resultList.length; i++) { + if (resultList[i].values()[0].units() == "%") { + if (resultList[i].values()[0].scalar() <= hgba1cLimit) { + return true; + } + } + } + return false; + } + + if (hasProblemCode()) { + emit("diabetics", 1); + if(hasLabCode()) { + emit("has_hgba1c_result", 1); + if(hasMatchingLabValue()) { + emit("has_matching_hgba1c_value", 1) + } + } + } +} diff --git a/test/fixtures/scoop/diabetes_ldl_map.js b/test/fixtures/scoop/diabetes_ldl_map.js new file mode 100644 index 0000000..97d2156 --- /dev/null +++ b/test/fixtures/scoop/diabetes_ldl_map.js @@ -0,0 +1,60 @@ +// TODO: Add freetext definition search +function map(patient) { + var targetLabCodes = { + "LOINC": ["39469-2"] + }; + + var targetProblemCodes = { + "ICD9": ["250"] + }; + + var ldlLimit = 2.5; + + var resultList = patient.results(); + var problemList = patient.conditions(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -1, 0, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks for ldl labs performed within the last year + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + // Checks if ldl meets parameters + function hasMatchingLabValue() { + for (var i = 0; i < resultList.length; i++) { + if (resultList[i].values()[0].units() == "mmol/L") { + if (resultList[i].values()[0].scalar() <= ldlLimit) { + return true; + } + } + } + return false; + } + + if (hasProblemCode()) { + emit("diabetics", 1); + if(hasLabCode()) { + emit("has_ldl_result", 1); + if(hasMatchingLabValue()) { + emit("has_matching_ldl_value", 1) + } + } + } +} diff --git a/test/fixtures/scoop/fasting_blood_sugar_map.js b/test/fixtures/scoop/fasting_blood_sugar_map.js new file mode 100644 index 0000000..e523637 --- /dev/null +++ b/test/fixtures/scoop/fasting_blood_sugar_map.js @@ -0,0 +1,40 @@ +// TODO: Add freetext definition search +function map(patient) { + var targetLabCodes = { + "LOINC": ["14771-0"] + }; + + var ageLimit = 45; + var resultList = patient.results(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -3, 0, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) > ageLimit); + } + + // Checks for Fasting Blood Sugar labs performed within the last 3 years + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit("patients_>45", 1); + if (hasLabCode()) { + emit("has_blood_sugar_result", 1); + } + } +} diff --git a/test/fixtures/scoop/pneumococcal_map.js b/test/fixtures/scoop/pneumococcal_map.js new file mode 100644 index 0000000..8b79562 --- /dev/null +++ b/test/fixtures/scoop/pneumococcal_map.js @@ -0,0 +1,32 @@ +// TODO: Add freetext definition search +function map(patient) { + var targetImmunizationCodes = { + "whoATC": ["J07AL02"], + "SNOMED-CT": ["12866006", "394678003"] + }; + + var ageLimit = 65; + var immunizationList = patient.immunizations(); + + var now = new Date(2013, 7, 19); + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + // Checks for existence of Pneumovax + function hasImmunization() { + return immunizationList.match(targetImmunizationCodes).length; + } + + if (hasImmunization()) { + emit("total_pneumovax", 1); + } + + if (population(patient)) { + if (hasImmunization()) { + emit("senior_pop_pneumovax", 1); + } + } +} diff --git a/test/fixtures/scoop/population_map.js b/test/fixtures/scoop/population_map.js new file mode 100644 index 0000000..2abef80 --- /dev/null +++ b/test/fixtures/scoop/population_map.js @@ -0,0 +1,58 @@ +// TODO: Factor in Clinical Encounters +function map(patient) { + var time = new Date(2013, 7, 19); + var age = Math.floor(patient.age(time)); + var gender; + + if (patient.gender() == "M") { + gender = "male" + emit("total_male", 1); + } + else { + gender = "female" + emit("total_female", 1) + } + + if(age <= 9) { + emit(gender + "_0-9", 1); + emit("total_0-9", 1); + } + else if(age >= 10 && age <= 19) { + emit(gender + "_10-19", 1); + emit("total_10-19", 1); + } + else if(age >= 20 && age <= 29) { + emit(gender + "_20-29", 1); + emit("total_20-29", 1); + } + else if(age >= 30 && age <= 39) { + emit(gender + "_30-39", 1); + emit("total_30-39", 1); + } + else if(age >= 40 && age <= 49) { + emit(gender + "_40-49", 1); + emit("total_40-49", 1); + } + else if(age >= 50 && age <= 59) { + emit(gender + "_50-59", 1); + emit("total_50-59", 1); + } + else if(age >= 60 && age <= 69) { + emit(gender + "_60-69", 1); + emit("total_60-69", 1); + } + else if(age >= 70 && age <= 79) { + emit(gender + "_70-79", 1); + emit("total_70-79", 1); + } + else if(age >= 80 && age <= 89) { + emit(gender + "_80-89", 1); + emit("total_80-89", 1); + } + else { + emit(gender + "_90+", 1); + emit("total_90+", 1); + } + + emit("total_population", 1); +} diff --git a/test/fixtures/scoop/scoop_pneumococcal_map.js b/test/fixtures/scoop/scoop_pneumococcal_map.js deleted file mode 100644 index dced290..0000000 --- a/test/fixtures/scoop/scoop_pneumococcal_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetImmunizationCodes = { - "whoATC": ["J07AL02"] - }; - - var ageLimit = 65; - - var immunizationList = patient.immunizations(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of Pneumovax - function hasImmunization() { - return immunizationList.match(targetImmunizationCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasImmunization()) { - emit("total_pneumovax", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit("senior_pop", 1); - if (hasImmunization()) { - emit("senior_pop_pneumovax", 1); - } - } -} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index e25d74c..782312b 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -109,7 +109,7 @@ class ScoopJobTest < ActiveSupport::TestCase test "pneumococcal vaccine query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_pneumococcal_map.js') + mf = File.read('test/fixtures/scoop/pneumococcal_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -120,4 +120,98 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["senior_pop_pneumovax"].to_i, 1 end + test "population profile query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/population_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["female_40-49"].to_i, 1 + assert_equal results["female_50-59"].to_i, 1 + assert_equal results["female_70-79"].to_i, 1 + assert_equal results["female_80-89"].to_i, 2 + assert_equal results["male_60-69"].to_i, 1 + assert_equal results["male_70-79"].to_i, 2 + assert_equal results["male_90+"].to_i, 1 + assert_equal results["total_40-49"].to_i, 1 + assert_equal results["total_50-59"].to_i, 1 + assert_equal results["total_60-69"].to_i, 1 + assert_equal results["total_70-79"].to_i, 3 + assert_equal results["total_80-89"].to_i, 2 + assert_equal results["total_90+"].to_i, 1 + assert_equal results["total_female"].to_i, 5 + assert_equal results["total_male"].to_i, 4 + assert_equal results["total_population"].to_i, 9 + end + + test "fasting blood sugar query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/fasting_blood_sugar_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["has_blood_sugar_result"].to_i, 1 + assert_equal results["patients_>45"].to_i, 8 + end + + test "colon screening query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/colon_screening_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["has_hemoccult_result"].to_i, 1 + assert_equal results["patients_50-74"].to_i, 4 + end + + test "diabetes hgba1c query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/diabetes_hgba1c_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["has_hgba1c_result"].to_i, 1 + assert_equal results["diabetics"].to_i, 3 + end + + test "diabetes hgba1c value query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/diabetes_hgba1c_value_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["has_hgba1c_result"].to_i, 1 + assert_equal results["has_matching_hgba1c_value"].to_i, 1 + assert_equal results["diabetics"].to_i, 3 + end + + test "diabetes ldl value query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/diabetes_ldl_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["has_ldl_result"].to_i, 1 + assert_equal results["has_matching_ldl_value"].to_i, 1 + assert_equal results["diabetics"].to_i, 3 + end + end From a80b6fb1a47f0da7b8cf1b1a7a48f0cbea48012b Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 19 Aug 2013 15:22:02 -0700 Subject: [PATCH 071/205] Work in progress on vital signs queries --- test/fixtures/#scoop-records.json# | 9 ++ test/fixtures/scoop/vital_sign_bp_map.js | 47 ++++++++++ .../scoop/vital_sign_heartrate_map.js | 47 ++++++++++ test/fixtures/scoop/vital_sign_height_map.js | 47 ++++++++++ .../scoop/vital_sign_overweight_map.js | 74 +++++++++++++++ test/fixtures/scoop/vital_sign_temp_map.js | 47 ++++++++++ test/fixtures/scoop/vital_sign_wc_map.js | 47 ++++++++++ test/fixtures/scoop/vital_sign_weight_map.js | 47 ++++++++++ test/unit/scoop_job_test.rb | 92 +++++++++++++++++++ 9 files changed, 457 insertions(+) create mode 100644 test/fixtures/#scoop-records.json# create mode 100644 test/fixtures/scoop/vital_sign_bp_map.js create mode 100644 test/fixtures/scoop/vital_sign_heartrate_map.js create mode 100644 test/fixtures/scoop/vital_sign_height_map.js create mode 100644 test/fixtures/scoop/vital_sign_overweight_map.js create mode 100644 test/fixtures/scoop/vital_sign_temp_map.js create mode 100644 test/fixtures/scoop/vital_sign_wc_map.js create mode 100644 test/fixtures/scoop/vital_sign_weight_map.js diff --git a/test/fixtures/#scoop-records.json# b/test/fixtures/#scoop-records.json# new file mode 100644 index 0000000..047edd2 --- /dev/null +++ b/test/fixtures/#scoop-records.json# @@ -0,0 +1,9 @@ +{ "_id" : { "$oid" : "520d4dce425822f903000001" }, "effective_time" : 1376493840, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dce425822f903000002" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000003" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dce425822f903000004" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000005" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dce425822f903000006" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000007" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f903000008" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000009" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f90300000a" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f90300000b" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf4258224d0f00002f" }, "effective_time" : 1376493840, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000030" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000031" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000032" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000033" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000034" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } +{ "_id" : { "$oid" : "520d4dcf42582274e20000b4" }, "effective_time" : 1376493840, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b5" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b6" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b8" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b9" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf42582274e20000ba" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 112 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bb" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bc" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bd" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf4258227fac00000c" }, "effective_time" : 1376493840, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000d" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000e" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00000f" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000010" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000011" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000012" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000013" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000014" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000015" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf4258227fac000016" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000017" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000018" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000019" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001a" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001b" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001c" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001d" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001e" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001f" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000020" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000021" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000022" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000023" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000024" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000025" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000026" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000027" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000028" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000029" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002a" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002b" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002c" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002d" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002e" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dcf425822b958000051" }, "effective_time" : 1376493840, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf425822b958000052" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822b958000053" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000054" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000055" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000056" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000057" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000058" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000059" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005b" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "520d4dcf425822b95800005c" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf425822b95800005d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005e" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005f" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000060" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000061" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000062" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000063" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000064" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000065" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000066" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000067" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000068" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000069" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf425822b958000070" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000071" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000072" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000073" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000074" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000075" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000076" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000077" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000078" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000079" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007a" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007b" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007c" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007d" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007e" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007f" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000080" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000081" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000082" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000083" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000084" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000085" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000086" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000087" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000088" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000089" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008a" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008b" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008c" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008d" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008e" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008f" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000090" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000091" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000092" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000093" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000094" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000095" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000096" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000097" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000098" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000099" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009a" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009b" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009c" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009d" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009e" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009f" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a0" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a1" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a2" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a3" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a4" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a5" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a6" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a7" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a8" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "130/85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a9" }, "scalar" : "130/85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000aa" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "37", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ab" }, "scalar" : "37", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ac" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight +{ "_id" : { "$oid" : "520d4dcf425822e5a4000035" }, "effective_time" : 1376493840, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000036" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000037" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000038" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000039" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003a" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003c" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003e" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003f" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000040" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000041" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } }, "duration" : { "width" : { "unit" : "D", "value" : 16 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000042" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000043" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000044" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000045" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000046" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000047" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000048" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000049" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004a" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004b" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004c" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004d" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004e" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004f" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000050" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd04258221c5e0000e1" }, "effective_time" : 1376493840, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e2" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e4" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e5" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd04258221c5e0000e7" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e8" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd0425822b0f60000e9" }, "effective_time" : 1376493840, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ea" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000eb" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000ec" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ed" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ee" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ef" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f0" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f1" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f2" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f3" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f4" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f5" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "520d4dd0425822b79b0000be" }, "effective_time" : 1376493840, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000bf" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c0" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c1" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c2" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c4" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c5" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c6" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c8" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c9" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ca" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cb" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000cc" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cd" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ce" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cf" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d0" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d1" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d2" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d3" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d4" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d5" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d6" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d7" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d8" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d9" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000da" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000db" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dc" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dd" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000de" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000df" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "140/90", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000e0" }, "scalar" : "140/90", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } diff --git a/test/fixtures/scoop/vital_sign_bp_map.js b/test/fixtures/scoop/vital_sign_bp_map.js new file mode 100644 index 0000000..9646dc9 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_bp_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["55284-4"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of blood pressure observation + function hasBP() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasBP()) { + emit("total_BP", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasBP()) { + emit(">19_pop_bp", 1); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_heartrate_map.js b/test/fixtures/scoop/vital_sign_heartrate_map.js new file mode 100644 index 0000000..4afd554 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_heartrate_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["8867-4"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of waist circumference observation + function hasHeartRate() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasHeartRate()) { + emit("total_heartrate", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasHeartRate()) { + emit(">19_pop_heartrate", 1); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_height_map.js b/test/fixtures/scoop/vital_sign_height_map.js new file mode 100644 index 0000000..83fa041 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_height_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["8302-2"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of weight observation + function hasHeight() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasHeight()) { + emit("total_height", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasHeight()) { + emit(">19_pop_height", 1); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_overweight_map.js b/test/fixtures/scoop/vital_sign_overweight_map.js new file mode 100644 index 0000000..fc14cbf --- /dev/null +++ b/test/fixtures/scoop/vital_sign_overweight_map.js @@ -0,0 +1,74 @@ +function map(patient) { + var targetWaistCircumferenceCodes = { + "LOINC": ["8302-2"] + }; + + var wcLOINC = { "LOINC" : [ "56115-9" ] } + + var targetHeightCodes = { + "LOINC": ["8302-2"] + } + + var targetWeightCodes = { + "LOINC": ["3141-9"] + } + + var ageLimit = 20; + + var wcLimit = 169; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of waist circumference observation + function hasWaistCircumference() { + return vitalSignList.match(targetWaistCircumferenceCodes, start, end).length; + } + + function hasMatchingIndicator() { + for (var i = 0; i < vitalSignList.length; i++) { + //if (vitalSignList[i].values()[0].units() == "cm") { + if (vitalSignList[i].includesCodeFrom(targetWaistCircumferenceCodes) && + vitalSignList[i].values()[0].scalar() > wcLimit) { + emit("vital sign: "+vitalSignList[i].values()[0].scalar(), 1) + return true; + } + //} + } + return false; + } + + emit('total_pop', 1); + + if (hasWaistCircumference()) { + emit("total_overweight", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasWaistCircumference() && hasMatchingIndicator()) { + emit(">19_pop_overweight", 1); + } else { + emit(">19_pop_overweight", 0); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_temp_map.js b/test/fixtures/scoop/vital_sign_temp_map.js new file mode 100644 index 0000000..4e9f3b5 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_temp_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["8310-5"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of temperature observation + function hasTemperature() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasTemperature()) { + emit("total_temperature", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasTemperature()) { + emit(">19_pop_temperature", 1); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_wc_map.js b/test/fixtures/scoop/vital_sign_wc_map.js new file mode 100644 index 0000000..3657b00 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_wc_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["8302-2"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of waist circumference observation + function hasWC() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasWC()) { + emit("total_wc", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasWC()) { + emit(">19_pop_wc", 1); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_weight_map.js b/test/fixtures/scoop/vital_sign_weight_map.js new file mode 100644 index 0000000..a3b5ad5 --- /dev/null +++ b/test/fixtures/scoop/vital_sign_weight_map.js @@ -0,0 +1,47 @@ +function map(patient) { + var targetVitalSignsCodes = { + "LOINC": ["3141-9"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of weight observation + function hasWeight() { + return vitalSignList.match(targetVitalSignsCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasWeight()) { + emit("total_weight", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasWeight()) { + emit(">19_pop_weight", 1); + } + } +} \ No newline at end of file diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 782312b..847be0d 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -214,4 +214,96 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["diabetics"].to_i, 3 end + test "bp vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_bp_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 2, results['>19_pop_bp'] + end + + test "temperature vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_temp_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_temperature'] + end + + test "weight vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_weight_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_weight'] + end + + test "height vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_height_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_height'] + end + test "waist circumference vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_wc_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_wc'] + end + + + test "heart rate signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_heartrate_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_heartrate'] + end + + + test "overweight vital signs query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_overweight'] + end + end From 72d35b55985b38673d6a22dd24b333ee5c2b631f Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 19 Aug 2013 15:38:40 -0700 Subject: [PATCH 072/205] Fix map to grab waist circumference rather than height --- test/fixtures/scoop/vital_sign_overweight_map.js | 13 +++++-------- test/unit/scoop_job_test.rb | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/test/fixtures/scoop/vital_sign_overweight_map.js b/test/fixtures/scoop/vital_sign_overweight_map.js index fc14cbf..5c4ddcd 100644 --- a/test/fixtures/scoop/vital_sign_overweight_map.js +++ b/test/fixtures/scoop/vital_sign_overweight_map.js @@ -1,10 +1,8 @@ function map(patient) { var targetWaistCircumferenceCodes = { - "LOINC": ["8302-2"] + "LOINC": ["56115-9"] }; - var wcLOINC = { "LOINC" : [ "56115-9" ] } - var targetHeightCodes = { "LOINC": ["8302-2"] } @@ -15,7 +13,7 @@ function map(patient) { var ageLimit = 20; - var wcLimit = 169; + var wcLimit = 80; var vitalSignList = patient.vitalSigns(); @@ -46,10 +44,9 @@ function map(patient) { function hasMatchingIndicator() { for (var i = 0; i < vitalSignList.length; i++) { //if (vitalSignList[i].values()[0].units() == "cm") { - if (vitalSignList[i].includesCodeFrom(targetWaistCircumferenceCodes) && - vitalSignList[i].values()[0].scalar() > wcLimit) { - emit("vital sign: "+vitalSignList[i].values()[0].scalar(), 1) - return true; + if (vitalSignList[i].includesCodeFrom(targetWaistCircumferenceCodes) && + vitalSignList[i].values()[0].scalar() > wcLimit) { + return true; } //} } diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 847be0d..df7d9f5 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -303,7 +303,7 @@ class ScoopJobTest < ActiveSupport::TestCase query.reload results = query.result assert_equal 9, results['>19_pop'] - assert_equal 1, results['>19_pop_overweight'] + assert_equal 0, results['>19_pop_overweight'] end end From 6975b7eb22eea5ef72f4c52c93e92d1e06416c54 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 19 Aug 2013 15:39:41 -0700 Subject: [PATCH 073/205] Remove extraneous file Signed-off-by: Jeremy Ho --- test/fixtures/#scoop-records.json# | 9 --------- test/unit/scoop_job_test.rb | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 test/fixtures/#scoop-records.json# diff --git a/test/fixtures/#scoop-records.json# b/test/fixtures/#scoop-records.json# deleted file mode 100644 index 047edd2..0000000 --- a/test/fixtures/#scoop-records.json# +++ /dev/null @@ -1,9 +0,0 @@ -{ "_id" : { "$oid" : "520d4dce425822f903000001" }, "effective_time" : 1376493840, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dce425822f903000002" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000003" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dce425822f903000004" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000005" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dce425822f903000006" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000007" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f903000008" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000009" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f90300000a" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f90300000b" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258224d0f00002f" }, "effective_time" : 1376493840, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000030" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000031" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000032" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000033" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000034" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } -{ "_id" : { "$oid" : "520d4dcf42582274e20000b4" }, "effective_time" : 1376493840, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b5" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b6" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b8" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b9" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf42582274e20000ba" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 112 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bb" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bc" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bd" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258227fac00000c" }, "effective_time" : 1376493840, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000d" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000e" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00000f" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000010" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000011" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000012" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000013" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000014" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000015" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf4258227fac000016" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000017" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000018" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000019" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001a" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001b" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001c" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001d" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001e" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001f" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000020" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000021" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000022" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000023" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000024" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000025" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000026" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000027" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000028" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000029" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002a" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002b" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002c" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002d" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002e" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf425822b958000051" }, "effective_time" : 1376493840, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf425822b958000052" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822b958000053" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000054" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000055" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000056" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000057" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000058" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000059" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005b" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "520d4dcf425822b95800005c" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf425822b95800005d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005e" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005f" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000060" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000061" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000062" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000063" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000064" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000065" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000066" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000067" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000068" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000069" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf425822b958000070" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000071" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000072" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000073" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000074" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000075" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000076" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000077" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000078" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000079" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007a" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007b" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007c" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007d" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007e" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007f" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000080" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000081" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000082" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000083" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000084" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000085" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000086" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000087" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000088" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000089" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008a" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008b" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008c" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008d" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008e" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008f" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000090" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000091" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000092" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000093" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000094" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000095" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000096" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000097" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000098" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000099" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009a" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009b" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009c" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009d" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009e" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009f" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a0" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a1" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a2" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a3" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a4" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a5" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a6" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a7" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a8" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "130/85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a9" }, "scalar" : "130/85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000aa" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "37", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ab" }, "scalar" : "37", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ac" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight -{ "_id" : { "$oid" : "520d4dcf425822e5a4000035" }, "effective_time" : 1376493840, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000036" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000037" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000038" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000039" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003a" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003c" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003e" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003f" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000040" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000041" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } }, "duration" : { "width" : { "unit" : "D", "value" : 16 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000042" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000043" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000044" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000045" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000046" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000047" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000048" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000049" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004a" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004b" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004c" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004d" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004e" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004f" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000050" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd04258221c5e0000e1" }, "effective_time" : 1376493840, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e2" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e4" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e5" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd04258221c5e0000e7" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e8" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b0f60000e9" }, "effective_time" : 1376493840, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ea" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000eb" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000ec" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ed" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ee" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ef" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f0" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f1" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f2" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f3" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f4" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f5" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b79b0000be" }, "effective_time" : 1376493840, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000bf" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c0" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c1" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c2" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c4" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c5" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c6" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c8" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c9" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ca" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cb" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000cc" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cd" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ce" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cf" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d0" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d1" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d2" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d3" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d4" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d5" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d6" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d7" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d8" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d9" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000da" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000db" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dc" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dd" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000de" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000df" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "140/90", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000e0" }, "scalar" : "140/90", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 847be0d..7913a92 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -265,6 +265,7 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 9, results['>19_pop'] assert_equal 1, results['>19_pop_height'] end + test "waist circumference vital signs query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_wc_map.js') @@ -292,7 +293,6 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 1, results['>19_pop_heartrate'] end - test "overweight vital signs query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') From e380fdbf4b23e0ddcd1b6090e36d5485db16bf80 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 19 Aug 2013 15:40:19 -0700 Subject: [PATCH 074/205] Removed emacs artifact --- test/fixtures/#scoop-records.json# | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 test/fixtures/#scoop-records.json# diff --git a/test/fixtures/#scoop-records.json# b/test/fixtures/#scoop-records.json# deleted file mode 100644 index 047edd2..0000000 --- a/test/fixtures/#scoop-records.json# +++ /dev/null @@ -1,9 +0,0 @@ -{ "_id" : { "$oid" : "520d4dce425822f903000001" }, "effective_time" : 1376493840, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dce425822f903000002" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000003" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dce425822f903000004" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000005" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dce425822f903000006" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000007" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f903000008" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000009" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f90300000a" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f90300000b" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258224d0f00002f" }, "effective_time" : 1376493840, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000030" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000031" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000032" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000033" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000034" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } -{ "_id" : { "$oid" : "520d4dcf42582274e20000b4" }, "effective_time" : 1376493840, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b5" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b6" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b8" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b9" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf42582274e20000ba" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 112 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bb" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bc" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bd" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258227fac00000c" }, "effective_time" : 1376493840, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000d" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000e" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00000f" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000010" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000011" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000012" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000013" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000014" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000015" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf4258227fac000016" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000017" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000018" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000019" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001a" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001b" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001c" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001d" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001e" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001f" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000020" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000021" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000022" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000023" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000024" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000025" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000026" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000027" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000028" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000029" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002a" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002b" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002c" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002d" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002e" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf425822b958000051" }, "effective_time" : 1376493840, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf425822b958000052" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822b958000053" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000054" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000055" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000056" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000057" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000058" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000059" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005b" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "520d4dcf425822b95800005c" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf425822b95800005d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005e" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005f" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000060" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000061" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000062" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000063" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000064" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000065" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000066" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000067" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000068" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000069" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf425822b958000070" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000071" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000072" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000073" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000074" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000075" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000076" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000077" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000078" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000079" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007a" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007b" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007c" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007d" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007e" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007f" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000080" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000081" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000082" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000083" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000084" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000085" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000086" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000087" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000088" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000089" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008a" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008b" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008c" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008d" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008e" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008f" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000090" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000091" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000092" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000093" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000094" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000095" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000096" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000097" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000098" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000099" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009a" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009b" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009c" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009d" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009e" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009f" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a0" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a1" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a2" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a3" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a4" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a5" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a6" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a7" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a8" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "130/85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a9" }, "scalar" : "130/85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000aa" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "37", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ab" }, "scalar" : "37", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ac" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight -{ "_id" : { "$oid" : "520d4dcf425822e5a4000035" }, "effective_time" : 1376493840, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000036" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000037" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000038" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000039" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003a" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003c" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003e" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003f" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000040" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000041" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } }, "duration" : { "width" : { "unit" : "D", "value" : 16 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000042" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000043" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000044" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000045" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000046" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000047" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000048" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000049" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004a" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004b" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004c" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004d" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004e" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004f" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000050" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd04258221c5e0000e1" }, "effective_time" : 1376493840, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e2" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e4" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e5" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd04258221c5e0000e7" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e8" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b0f60000e9" }, "effective_time" : 1376493840, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ea" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000eb" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000ec" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ed" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ee" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ef" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f0" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f1" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f2" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f3" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f4" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f5" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b79b0000be" }, "effective_time" : 1376493840, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000bf" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c0" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c1" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c2" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c4" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c5" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c6" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c8" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c9" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ca" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cb" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000cc" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cd" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ce" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cf" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d0" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d1" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d2" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d3" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d4" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d5" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d6" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d7" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d8" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d9" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000da" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000db" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dc" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dd" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000de" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000df" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "140/90", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000e0" }, "scalar" : "140/90", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } From 483268a626e59e64afadc4b875a642e30db9b534 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 19 Aug 2013 16:33:45 -0700 Subject: [PATCH 075/205] Update overweight indicator --- .../scoop/vital_sign_overweight_map.js | 63 ++++++++++++++++--- test/unit/scoop_job_test.rb | 4 +- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/test/fixtures/scoop/vital_sign_overweight_map.js b/test/fixtures/scoop/vital_sign_overweight_map.js index 5c4ddcd..03f6aba 100644 --- a/test/fixtures/scoop/vital_sign_overweight_map.js +++ b/test/fixtures/scoop/vital_sign_overweight_map.js @@ -11,15 +11,15 @@ function map(patient) { "LOINC": ["3141-9"] } - var ageLimit = 20; + var ageLimit = 19; var wcLimit = 80; var vitalSignList = patient.vitalSigns(); - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); + var now = new Date(2013, 7, 19); + var start = addDate(now, -2, 0, 0); + var end = addDate(now, 0, 0, 0); // Shifts date by year, month, and date specified function addDate(date, y, m, d) { @@ -32,7 +32,7 @@ function map(patient) { // Checks if patient is older than ageLimit function population(patient) { - return (patient.age(now) >= ageLimit); + return (patient.age(now) > ageLimit); } @@ -41,13 +41,55 @@ function map(patient) { return vitalSignList.match(targetWaistCircumferenceCodes, start, end).length; } + function hasHeight() { + return vitalSignList.match(targetHeightCodes, start, end).length; + } + + function hasWeight() { + return vitalSignList.match(targetWeightCodes, start, end).length; + } + function hasMatchingIndicator() { for (var i = 0; i < vitalSignList.length; i++) { //if (vitalSignList[i].values()[0].units() == "cm") { if (vitalSignList[i].includesCodeFrom(targetWaistCircumferenceCodes) && vitalSignList[i].values()[0].scalar() > wcLimit) { return true; - } + } + //} + } + return false; + } + + // http://en.wikipedia.org/wiki/Body_mass_index + function getBMI(height, weight, metric) { + if (metric) { + bmi = weight/(height/100.0)^2; // assume cm and kg + } else { + bmi = 703 * weight /height^2; // assume in and lb + } + return bmi; + } + + function hasHWMatchingIndicator() { + var height = 0; + var weight = 0; + var bmi = 0; + for (var i = 0; i < vitalSignList.length; i++) { + //if (vitalSignList[i].values()[0].units() == "cm") { + if (vitalSignList[i].includesCodeFrom(targetHeightCodes)) { + height = vitalSignList[i].values()[0].scalar(); + //emit("height="+height,1); + } + if (vitalSignList[i].includesCodeFrom(targetWeightCodes)) { + weight = vitalSignList[i].values()[0].scalar(); + //emit("weight="+weight,1); + } + if (height != 0 && weight != 0) { + bmi = getBMI(height,weight,true); + //emit("bmi="+bmi,1); + return bmi > 30; + } //} } return false; @@ -65,7 +107,12 @@ function map(patient) { if (hasWaistCircumference() && hasMatchingIndicator()) { emit(">19_pop_overweight", 1); } else { - emit(">19_pop_overweight", 0); - } + emit(">19_pop_overweight", 0) + }; + if (hasHWMatchingIndicator()) { + emit(">19_pop_bmi>30",1); + } else { + emit(">19_pop_bmi>30",0); + }; } } \ No newline at end of file diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index c424bdb..b9921c2 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -280,7 +280,7 @@ class ScoopJobTest < ActiveSupport::TestCase end - test "heart rate signs query works properly" do + test "heart rate vital signs query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_heartrate_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') @@ -293,6 +293,7 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 1, results['>19_pop_heartrate'] end + test "overweight vital signs query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') @@ -304,6 +305,7 @@ class ScoopJobTest < ActiveSupport::TestCase results = query.result assert_equal 9, results['>19_pop'] assert_equal 0, results['>19_pop_overweight'] + assert_equal 1, results['>19_pop_bmi>30'] end end From cf5270235dca3c6d33857dbcd9c210dfe931e3af Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 20 Aug 2013 12:39:37 -0700 Subject: [PATCH 076/205] Consolidated vital signs tests --- test/fixtures/scoop/vital_sign_bp_map.js | 47 ------- .../scoop/vital_sign_heartrate_map.js | 47 ------- test/fixtures/scoop/vital_sign_height_map.js | 47 ------- test/fixtures/scoop/vital_sign_temp_map.js | 47 ------- test/fixtures/scoop/vital_sign_wc_map.js | 47 ------- test/fixtures/scoop/vital_sign_weight_map.js | 47 ------- test/fixtures/scoop/vital_signs_map.js | 115 ++++++++++++++++++ test/unit/scoop_job_test.rb | 81 ++---------- 8 files changed, 126 insertions(+), 352 deletions(-) delete mode 100644 test/fixtures/scoop/vital_sign_bp_map.js delete mode 100644 test/fixtures/scoop/vital_sign_heartrate_map.js delete mode 100644 test/fixtures/scoop/vital_sign_height_map.js delete mode 100644 test/fixtures/scoop/vital_sign_temp_map.js delete mode 100644 test/fixtures/scoop/vital_sign_wc_map.js delete mode 100644 test/fixtures/scoop/vital_sign_weight_map.js create mode 100644 test/fixtures/scoop/vital_signs_map.js diff --git a/test/fixtures/scoop/vital_sign_bp_map.js b/test/fixtures/scoop/vital_sign_bp_map.js deleted file mode 100644 index 9646dc9..0000000 --- a/test/fixtures/scoop/vital_sign_bp_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["55284-4"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of blood pressure observation - function hasBP() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasBP()) { - emit("total_BP", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasBP()) { - emit(">19_pop_bp", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_heartrate_map.js b/test/fixtures/scoop/vital_sign_heartrate_map.js deleted file mode 100644 index 4afd554..0000000 --- a/test/fixtures/scoop/vital_sign_heartrate_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["8867-4"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of waist circumference observation - function hasHeartRate() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasHeartRate()) { - emit("total_heartrate", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasHeartRate()) { - emit(">19_pop_heartrate", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_height_map.js b/test/fixtures/scoop/vital_sign_height_map.js deleted file mode 100644 index 83fa041..0000000 --- a/test/fixtures/scoop/vital_sign_height_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["8302-2"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of weight observation - function hasHeight() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasHeight()) { - emit("total_height", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasHeight()) { - emit(">19_pop_height", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_temp_map.js b/test/fixtures/scoop/vital_sign_temp_map.js deleted file mode 100644 index 4e9f3b5..0000000 --- a/test/fixtures/scoop/vital_sign_temp_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["8310-5"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of temperature observation - function hasTemperature() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasTemperature()) { - emit("total_temperature", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasTemperature()) { - emit(">19_pop_temperature", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_wc_map.js b/test/fixtures/scoop/vital_sign_wc_map.js deleted file mode 100644 index 3657b00..0000000 --- a/test/fixtures/scoop/vital_sign_wc_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["8302-2"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of waist circumference observation - function hasWC() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasWC()) { - emit("total_wc", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasWC()) { - emit(">19_pop_wc", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_weight_map.js b/test/fixtures/scoop/vital_sign_weight_map.js deleted file mode 100644 index a3b5ad5..0000000 --- a/test/fixtures/scoop/vital_sign_weight_map.js +++ /dev/null @@ -1,47 +0,0 @@ -function map(patient) { - var targetVitalSignsCodes = { - "LOINC": ["3141-9"] - }; - - var ageLimit = 20; - - var vitalSignList = patient.vitalSigns(); - - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); - - // Shifts date by year, month, and date specified - function addDate(date, y, m, d) { - var n = new Date(date); - n.setFullYear(date.getFullYear() + (y || 0)); - n.setMonth(date.getMonth() + (m || 0)); - n.setDate(date.getDate() + (d || 0)); - return n; - } - - // Checks if patient is older than ageLimit - function population(patient) { - return (patient.age(now) >= ageLimit); - } - - - // Checks for existence of weight observation - function hasWeight() { - return vitalSignList.match(targetVitalSignsCodes, start, end).length; - } - - emit('total_pop', 1); - - if (hasWeight()) { - emit("total_weight", 1); - } - - if (population(patient)) { - //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); - emit(">19_pop", 1); - if (hasWeight()) { - emit(">19_pop_weight", 1); - } - } -} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_signs_map.js b/test/fixtures/scoop/vital_signs_map.js new file mode 100644 index 0000000..7eb3e7a --- /dev/null +++ b/test/fixtures/scoop/vital_signs_map.js @@ -0,0 +1,115 @@ +function map(patient) { + var targetHeartRateCodes = { + "LOINC": ["8867-4"] + }; + + var targetBloodPressureCodes = { + "LOINC": ["55284-4"] + }; + + var targetTemperatureCodes = { + "LOINC": ["8310-5"] + }; + + var targetHeightCodes = { + "LOINC": ["8302-2"] + }; + + var targetWeightCodes = { + "LOINC": ["3141-9"] + }; + + var targetWaistCircumferenceCodes = { + "LOINC": ["8302-2"] + }; + + var ageLimit = 20; + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 6, 20); + var start = new Date(2000, 6, 1); + var end = addDate(now, 0, 1, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + + // Checks for existence of heart rate observation + function hasHeartRate() { + return vitalSignList.match(targetHeartRateCodes, start, end).length; + } + + // Checks for existence of blood pressure observation + function hasBloodPressure() { + return vitalSignList.match(targetBloodPressureCodes, start, end).length; + } + + // Checks for existence of temperature observation + function hasTemperature() { + return vitalSignList.match(targetTemperatureCodes, start, end).length; + } + + // Checks for existence of height observation + function hasHeight() { + return vitalSignList.match(targetHeightCodes, start, end).length; + } + + // Checks for existence of weight observation + function hasWeight() { + return vitalSignList.match(targetWeightCodes, start, end).length; + } + + // Checks for existence of waist circumference observation + function hasWC() { + return vitalSignList.match(targetWaistCircumferenceCodes, start, end).length; + } + + emit('total_pop', 1); + + if (hasHeartRate()) { + emit("total_heartrate", 1); + } + + if (hasBloodPressure()) { + emit("total_bp", 1); + } + + if (hasTemperature()) { + emit("total_temperature", 1); + } + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasHeartRate()) { + emit(">19_pop_heartrate", 1); + } + if (hasBloodPressure()) { + emit(">19_pop_bp",1) + } + if (hasTemperature()) { + emit(">19_pop_temperature", 1); + } + if (hasHeight()) { + emit(">19_pop_height", 1); + } + if (hasWeight()) { + emit(">19_pop_weight", 1); + } + if (hasWC()) { + emit(">19_pop_wc", 1); + } + } +} \ No newline at end of file diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index b9921c2..4b455db 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -214,9 +214,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["diabetics"].to_i, 3 end - test "bp vital signs query works properly" do + test "overweight vital signs query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_bp_map.js') + mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -224,88 +224,29 @@ class ScoopJobTest < ActiveSupport::TestCase query.reload results = query.result assert_equal 9, results['>19_pop'] - assert_equal 2, results['>19_pop_bp'] + assert_equal 0, results['>19_pop_overweight'] + assert_equal 1, results['>19_pop_bmi>30'] end - test "temperature vital signs query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_temp_map.js') - rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - assert_equal 9, results['>19_pop'] - assert_equal 1, results['>19_pop_temperature'] - end - test "weight vital signs query works properly" do + test "vital signs query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_weight_map.js') - rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - assert_equal 9, results['>19_pop'] - assert_equal 1, results['>19_pop_weight'] - end - - test "height vital signs query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_height_map.js') + mf = File.read('test/fixtures/scoop/vital_signs_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job job.invoke_job query.reload results = query.result + assert_equal 9, results['total_pop'] assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_heartrate'] + assert_equal 2, results['>19_pop_bp'] + assert_equal 1, results['>19_pop_temperature'] assert_equal 1, results['>19_pop_height'] - end - - test "waist circumference vital signs query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_wc_map.js') - rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - assert_equal 9, results['>19_pop'] + assert_equal 1, results['>19_pop_weight'] assert_equal 1, results['>19_pop_wc'] end - test "heart rate vital signs query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_heartrate_map.js') - rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - assert_equal 9, results['>19_pop'] - assert_equal 1, results['>19_pop_heartrate'] - end - - - test "overweight vital signs query works properly" do - Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') - rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') - query = Query.create(map: mf, reduce: rf) - job = query.job - job.invoke_job - query.reload - results = query.result - assert_equal 9, results['>19_pop'] - assert_equal 0, results['>19_pop_overweight'] - assert_equal 1, results['>19_pop_bmi>30'] - end - end From da13e7064c0eeeab065f3f4b8ac42aa75a95a2c8 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 20 Aug 2013 13:17:52 -0700 Subject: [PATCH 077/205] Deassociate SCOOP iteration with map tests Added Query Title comments to maps Signed-off-by: Jeremy Ho --- .../{scoop_it0_map.js => age_gender_map.js} | 0 test/fixtures/scoop/colon_screening_map.js | 1 + ...op_it2_map.js => common_medication_map.js} | 1 + test/fixtures/scoop/diabetes_hgba1c_map.js | 1 + .../scoop/diabetes_hgba1c_value_map.js | 1 + test/fixtures/scoop/diabetes_ldl_map.js | 1 + .../fixtures/scoop/fasting_blood_sugar_map.js | 1 + test/fixtures/scoop/pneumococcal_map.js | 1 + .../{scoop_it1_map.js => polypharmacy_map.js} | 4 +- test/fixtures/scoop/population_map.js | 1 + test/fixtures/scoop/primary_statins_map.js | 65 +++++++++++++++++++ ...{scoop_it4_map.js => renal_digoxin_map.js} | 0 ...it4b_map.js => renal_digoxin_value_map.js} | 1 + test/fixtures/scoop/secondary_statins_map.js | 65 +++++++++++++++++++ test/unit/scoop_job_test.rb | 51 +++++++++++---- 15 files changed, 181 insertions(+), 13 deletions(-) rename test/fixtures/scoop/{scoop_it0_map.js => age_gender_map.js} (100%) rename test/fixtures/scoop/{scoop_it2_map.js => common_medication_map.js} (95%) rename test/fixtures/scoop/{scoop_it1_map.js => polypharmacy_map.js} (88%) create mode 100644 test/fixtures/scoop/primary_statins_map.js rename test/fixtures/scoop/{scoop_it4_map.js => renal_digoxin_map.js} (100%) rename test/fixtures/scoop/{scoop_it4b_map.js => renal_digoxin_value_map.js} (97%) create mode 100644 test/fixtures/scoop/secondary_statins_map.js diff --git a/test/fixtures/scoop/scoop_it0_map.js b/test/fixtures/scoop/age_gender_map.js similarity index 100% rename from test/fixtures/scoop/scoop_it0_map.js rename to test/fixtures/scoop/age_gender_map.js diff --git a/test/fixtures/scoop/colon_screening_map.js b/test/fixtures/scoop/colon_screening_map.js index 9216c39..5def40b 100644 --- a/test/fixtures/scoop/colon_screening_map.js +++ b/test/fixtures/scoop/colon_screening_map.js @@ -1,3 +1,4 @@ +// Query Title: Practice population profile // TODO: Add freetext definition search // TODO: Add Colon screening portion of query function map(patient) { diff --git a/test/fixtures/scoop/scoop_it2_map.js b/test/fixtures/scoop/common_medication_map.js similarity index 95% rename from test/fixtures/scoop/scoop_it2_map.js rename to test/fixtures/scoop/common_medication_map.js index 18890a7..23a77ae 100644 --- a/test/fixtures/scoop/scoop_it2_map.js +++ b/test/fixtures/scoop/common_medication_map.js @@ -1,3 +1,4 @@ +// Query Title: Most commonly prescribed medication classes function map(patient) { var atcLevel = 4; // Level definition based on definition found on Wikipedia diff --git a/test/fixtures/scoop/diabetes_hgba1c_map.js b/test/fixtures/scoop/diabetes_hgba1c_map.js index 7763936..a0ef484 100644 --- a/test/fixtures/scoop/diabetes_hgba1c_map.js +++ b/test/fixtures/scoop/diabetes_hgba1c_map.js @@ -1,3 +1,4 @@ +// Query Title: Diabetics with HGBA1C in last 6 mo // TODO: Add freetext definition search function map(patient) { var targetLabCodes = { diff --git a/test/fixtures/scoop/diabetes_hgba1c_value_map.js b/test/fixtures/scoop/diabetes_hgba1c_value_map.js index 5c8ba30..6b78aa4 100644 --- a/test/fixtures/scoop/diabetes_hgba1c_value_map.js +++ b/test/fixtures/scoop/diabetes_hgba1c_value_map.js @@ -1,3 +1,4 @@ +// Query Title: Diabetics with HGBA1C in last yr <= 7.0 // TODO: Add freetext definition search function map(patient) { var targetLabCodes = { diff --git a/test/fixtures/scoop/diabetes_ldl_map.js b/test/fixtures/scoop/diabetes_ldl_map.js index 97d2156..e590dab 100644 --- a/test/fixtures/scoop/diabetes_ldl_map.js +++ b/test/fixtures/scoop/diabetes_ldl_map.js @@ -1,3 +1,4 @@ +// Query Title: Diabetics with LDL in last yr <= 2.5 // TODO: Add freetext definition search function map(patient) { var targetLabCodes = { diff --git a/test/fixtures/scoop/fasting_blood_sugar_map.js b/test/fixtures/scoop/fasting_blood_sugar_map.js index e523637..eda8512 100644 --- a/test/fixtures/scoop/fasting_blood_sugar_map.js +++ b/test/fixtures/scoop/fasting_blood_sugar_map.js @@ -1,3 +1,4 @@ +// Query Title: Fasting blood sugar in last 3 yrs age > 45 // TODO: Add freetext definition search function map(patient) { var targetLabCodes = { diff --git a/test/fixtures/scoop/pneumococcal_map.js b/test/fixtures/scoop/pneumococcal_map.js index 8b79562..e189e5b 100644 --- a/test/fixtures/scoop/pneumococcal_map.js +++ b/test/fixtures/scoop/pneumococcal_map.js @@ -1,3 +1,4 @@ +// Query Title: Pneumococcal vaccination age 65+ // TODO: Add freetext definition search function map(patient) { var targetImmunizationCodes = { diff --git a/test/fixtures/scoop/scoop_it1_map.js b/test/fixtures/scoop/polypharmacy_map.js similarity index 88% rename from test/fixtures/scoop/scoop_it1_map.js rename to test/fixtures/scoop/polypharmacy_map.js index ead76d0..11c3b51 100644 --- a/test/fixtures/scoop/scoop_it1_map.js +++ b/test/fixtures/scoop/polypharmacy_map.js @@ -1,6 +1,8 @@ +// Query Title: Patients, 65 and older, on 5 or more medications +// Query Title: Patients, 65 and older, on 10 or more medications function map(patient) { var ageLimit = 65; - var drugLimit = 5; + var drugLimit = 5; // Change this value to number of active medications to count var time = new Date(2013, 2, 10); var drugList = patient.medications(); diff --git a/test/fixtures/scoop/population_map.js b/test/fixtures/scoop/population_map.js index 2abef80..b3c55eb 100644 --- a/test/fixtures/scoop/population_map.js +++ b/test/fixtures/scoop/population_map.js @@ -1,3 +1,4 @@ +// Query Title: Practice population profile // TODO: Factor in Clinical Encounters function map(patient) { var time = new Date(2013, 7, 19); diff --git a/test/fixtures/scoop/primary_statins_map.js b/test/fixtures/scoop/primary_statins_map.js new file mode 100644 index 0000000..560aa0d --- /dev/null +++ b/test/fixtures/scoop/primary_statins_map.js @@ -0,0 +1,65 @@ +// Query Title: Statins for primary prevention +// TODO: Add freetext definition search +function map(patient) { + var targetProblemCodes = { + "ICD9": ["410.0", "410.1", "410.2", "410.3", "410.4", "410.5", "410.6", "410.7", "410.8", "410.9", + "411.0", "411.1", "411.2", "411.3", "411.4", "411.5", "411.6", "411.7", "411.8", "411.9", + "412.0", "412.1", "412.2", "412.3", "412.4", "412.5", "412.6", "412.7", "412.8", "412.9", + "429.7,", "410", "411", "412", "V17.1", "438", + "43301", "43311", "43321", "43331", "43341", "43351", "43361", "43371", "43381", "43391", + "43401", "43411", "43421", "43431", "43441", "43451", "43461", "43471", "43481", "43491", + "438.0", "438.1", "438.2", "438.3", "438.4", "438.5", "438.6", "438.7", "438.8", "438.9"] + }; + + var targetDrugCodes = { + "whoATC": ["C10AA", "C10BX"] + }; + + var drugList = patient.medications(); + var problemList = patient.conditions(); + + var now = new Date(2013, 2, 10); + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + // Checks for active statin prescription + function hasCurrentDrugCode() { + var targetDrugList = targetDrugCodes["whoATC"]; + + for(var i = 0; i < drugList.length; i++) { + // Get all represented codes for each drug + var codes = drugList[i].medicationInformation().codedProduct(); + + // Filter out only ATC codes + for(var j = 0; j < codes.length; j++) { + if(codes[j].codeSystemName() == "whoATC") { + if(targetDrugList.indexOf(codes[j].code().substring(0, 5)) > -1) { + emit("had_statins", 1); + if(isCurrentDrug(drugList[i])) { + return true; + } + } + } + } + } + + return false; + } + + function isCurrentDrug(drug) { + var drugStart = drug.indicateMedicationStart().getTime(); + var drugEnd = drug.indicateMedicationStop().getTime(); + + return (drugEnd >= now && drugStart <= now); + } + + if (hasCurrentDrugCode()) { + emit("has_current_statin", 1); + if(!hasProblemCode()) { + emit("no_mi_or_stroke", 1); + } + } +} diff --git a/test/fixtures/scoop/scoop_it4_map.js b/test/fixtures/scoop/renal_digoxin_map.js similarity index 100% rename from test/fixtures/scoop/scoop_it4_map.js rename to test/fixtures/scoop/renal_digoxin_map.js diff --git a/test/fixtures/scoop/scoop_it4b_map.js b/test/fixtures/scoop/renal_digoxin_value_map.js similarity index 97% rename from test/fixtures/scoop/scoop_it4b_map.js rename to test/fixtures/scoop/renal_digoxin_value_map.js index 28ad08f..f611eeb 100644 --- a/test/fixtures/scoop/scoop_it4b_map.js +++ b/test/fixtures/scoop/renal_digoxin_value_map.js @@ -1,3 +1,4 @@ +// Query Title: Patients, 65 and older, with impaired renal function who are on digoxin >125 mcg/day function map(patient) { var targetMedicationCodes = { "whoATC": ["C01AA05"], diff --git a/test/fixtures/scoop/secondary_statins_map.js b/test/fixtures/scoop/secondary_statins_map.js new file mode 100644 index 0000000..4d72962 --- /dev/null +++ b/test/fixtures/scoop/secondary_statins_map.js @@ -0,0 +1,65 @@ +// Query Title: Statins for secondary prevention +// TODO: Add freetext definition search +function map(patient) { + var targetProblemCodes = { + "ICD9": ["410.0", "410.1", "410.2", "410.3", "410.4", "410.5", "410.6", "410.7", "410.8", "410.9", + "411.0", "411.1", "411.2", "411.3", "411.4", "411.5", "411.6", "411.7", "411.8", "411.9", + "412.0", "412.1", "412.2", "412.3", "412.4", "412.5", "412.6", "412.7", "412.8", "412.9", + "429.7,", "410", "411", "412", "V17.1", "438", + "43301", "43311", "43321", "43331", "43341", "43351", "43361", "43371", "43381", "43391", + "43401", "43411", "43421", "43431", "43441", "43451", "43461", "43471", "43481", "43491", + "438.0", "438.1", "438.2", "438.3", "438.4", "438.5", "438.6", "438.7", "438.8", "438.9"] + }; + + var targetDrugCodes = { + "whoATC": ["C10AA", "C10BX"] + }; + + var drugList = patient.medications(); + var problemList = patient.conditions(); + + var now = new Date(2013, 2, 10); + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + // Checks for active statin prescription + function hasCurrentDrugCode() { + var targetDrugList = targetDrugCodes["whoATC"]; + + for(var i = 0; i < drugList.length; i++) { + // Get all represented codes for each drug + var codes = drugList[i].medicationInformation().codedProduct(); + + // Filter out only ATC codes + for(var j = 0; j < codes.length; j++) { + if(codes[j].codeSystemName() == "whoATC") { + if(targetDrugList.indexOf(codes[j].code().substring(0, 5)) > -1) { + emit("had_statins", 1); + if(isCurrentDrug(drugList[i])) { + return true; + } + } + } + } + } + + return false; + } + + function isCurrentDrug(drug) { + var drugStart = drug.indicateMedicationStart().getTime(); + var drugEnd = drug.indicateMedicationStop().getTime(); + + return (drugEnd >= now && drugStart <= now); + } + + if (hasCurrentDrugCode()) { + emit("has_current_statin", 1); + if(hasProblemCode()) { + emit("mi_or_stroke", 1); + } + } +} diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 4b455db..a5bd327 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -25,9 +25,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal rvalues["total_pop_sum"].to_i, 9 end - test "iteration 0 query works properly" do + test "age gender query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it0_map.js') + mf = File.read('test/fixtures/scoop/age_gender_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -37,9 +37,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["male_>65"].to_i, 4 end - test "iteration 1 query works properly" do + test "polypharmacy query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it1_map.js') + mf = File.read('test/fixtures/scoop/polypharmacy_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -51,9 +51,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["polypharmacy_number"].to_i, 3 end - test "iteration 2 query works properly" do + test "commonly prescribed medications query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it2_map.js') + mf = File.read('test/fixtures/scoop/common_medication_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -79,9 +79,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["R03BB"].to_i, 3 end - test "iteration 4 query works properly" do + test "renal digoxin query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it4_map.js') + mf = File.read('test/fixtures/scoop/renal_digoxin_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -93,9 +93,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["total_pop"].to_i, 9 end - test "iteration 4b query works properly" do + test "renal digoxin value query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/scoop_it4b_map.js') + mf = File.read('test/fixtures/scoop/renal_digoxin_value_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job @@ -214,7 +214,35 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["diabetics"].to_i, 3 end - test "overweight vital signs query works properly" do + test "primary statins query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/primary_statins_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["had_statins"].to_i, 4 + assert_equal results["has_current_statin"].to_i, 4 + assert_equal results["no_mi_or_stroke"].to_i, 2 + end + + test "secondary statins query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/secondary_statins_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal results["had_statins"].to_i, 4 + assert_equal results["has_current_statin"].to_i, 4 + assert_equal results["mi_or_stroke"].to_i, 2 + end + + test "vital signs overweight query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') @@ -248,5 +276,4 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 1, results['>19_pop_wc'] end - end From 2c0223504d82dbc823eea161da15328d91ae4564 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 20 Aug 2013 13:29:51 -0700 Subject: [PATCH 078/205] Updated John Cleese E2E example Signed-off-by: Jeremy Ho --- test/fixtures/JOHN_CLEESE_1_25091940.xml | 7183 +++++++++++----------- 1 file changed, 3705 insertions(+), 3478 deletions(-) diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml index 199e495..4528390 100644 --- a/test/fixtures/JOHN_CLEESE_1_25091940.xml +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -1,3537 +1,3764 @@ - - - - - - PITO EMR-2-EMR Complete Instance Example - - - + + + + + + + + + + + + PITO EMR-2-EMR Record of JOHN CLEESE + + + - - - - - - - BC - - - - - - - JOHN - CLEESE - - - - - - - - - - + + + + JOHN + CLEESE + + + + + + + + + + - - - - - - - - McMaster Hospital - - - - + + + + + + + - - - + +
+ + + Advance Directives Section [without entries] + No Advance Directives +
+
+ - -
- - - Alerts [without entries] - No Alerts -
-
- - -
- - - Allergies and Intolerances (Reaction List) [with entries] - Allergies - - - - - - - - - - - - - - - - - - - PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL - - - - - - - - - - - - - - - - - - - - - -
-
- + + + + + + + + + + + + + + + + PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL + + + + + + + + + + + + + + + + + + + + + + + + Confirmed + + + + + + + + +
+ - -
- - - Clinical Measured Observations [with entries] - Clinical Measured Observations - - - - - - - - - - - - - - - - - Blood Pressure - - 130/85 (sitting position) - - - - - - - - - - - - - - - - - - - - - Temperature - - 37 (degrees celcius) - - - - - - - - - - - - - - - - - - - - - Weight - - 71 (in kg) - - - - - - - - - - - - - - - - - - - - - Height - - 170 (in cm) - - - - - - - - - - - - - - - - - - - - - Waist - - 36 (Waist Circum in cm) - - - - - - - - - - - - - - - - - - - - - Heart Rate - - 85 (in bpm (nnn) Range:40-180) - - - - -
-
- + + + + + + + + + + + + + + Blood Pressure (standing position) + + 130/85 + + + + + + + + + + + + + + + + + + + + + Temperature (degrees celcius) + + 37 + + + + + + + + + + + + + + + + + + + + + Weight (in kg) + + 71 + + + + + + + + + + + + + + + + + + + + + Height (in cm) + + 170 + + + + + + + + + + + + + + + + + + + + + Waist (Waist Circum in cm) + + 36 + + + + + + + + + + + + + + + + + + + + + Heart Rate (in bpm (nnn) Range:40-180) + + 85 + + + + + + + + +
+ + + Encounter History and Notes [without entries] + No Encounter History +
+
+ - -
- - - Family History [with entries] - Family History - - - - - - - Heart Attack - - Heart Attack - - - - - - - - - - - - - - - -
-
- + + + + Heart Attack + + + + + + + + + + + + + + + + + + + + - -
- - - Immunizations List [with entries] - Immunizations - - - - - - - - - - - - - - - Td - 1234 - - - - - - - - - - - - - - - Left Delt - - - - - - - - - - - - - - - - - - - Pneumovax - - - - - - - - - - - - - - - - - - - - - - - - Flu - - - - - - - - - - - - - - - Right Delt - - - - - -
-
- + + + + + + + + + + + + Td + 1234 + + + + + + + + + + + + + + + + Left Delt + + + + + + + + + + + + + + + + + + + Pneumovax + + + + + + + + + + + + + + + + + + + + + + + + + Flu + + + + + + + + + + + + + + + + Right Delt + + + + + + + + + +
+ + + Investigative Procedure History (without entries) + No Investigative Procedure History +
+
+ - -
- - - Laboratory Results and Reports [with entries] - Labs - - - - - - - MICRO3 - - - - - - - - - - - - - - - - - - - - Specimen Source - - - Bone Chip -bone Lt metatarsal - - - - - - - - - - - - - - - - - - - - Gram Stain - - - +3 Polymorphs -+4 Gram negative bacilli resembling coliforms -+4 Gram positive cocci in pairs and chains -+2 Gram positive cocci in clusters -+2 Yeast - - - - - - - - - - - - - - - - - - - - Report Status Preliminary - - - +3 Proteus mirabilis -Imipenem : Further report to follow -+3 Escherichia coli -+3 Klebsiella oxytoca - - - - - - - - - - - - - - - - - - - - Culture - - - Proteus mirabilis - - - - - - - - - - - - - - - - - - - - Ampicillin - - - R - - - - - - - - - - - - - - - - - - - - Cephalexin - - - R - - - - - - - - - - - - - - - - - - - - Cefazolin - - - R - - - - - - - - - - - - - - - - - - - - Cefuroxime Parenteral - - - R - - - - - - - - - - - - - - - - - - - - Cefixime - - - R - - - - - - - - - - - - - - - - - - - - Cefotaxime - - - R - - - - - - - - - - - - - - - - - - - - Ceftriaxone - - - R - - - - - - - - - - - - - - - - - - - - Cefpodoxime - - - R - - - - - - - - - - - - - - - - - - - - Ceftazidime - - - R - - - - - - - - - - - - - - - - - - - - Trimethoprim-Sulfa - - - S - - - - - - - - - - - - - - - - - - - - Ciprofloxacin - - - S - - - - - - - - - - - - - - - - - - - - Gentamicin - - - S - - - - - - - - - - - - - - - - - - - - Tetracycline - - - R - - - - - - - - - - - - - - - - - - - - Culture - - - Escherichia coli - - - - - - - - - - - - - - - - - - - - Ampicillin - - - R - - - - - - - - - - - - - - - - - - - - Cephalexin - - - S - - - - - - - - - - - - - - - - - - - - Cefazolin - - - S - - - - - - - - - - - - - - - - - - - - Trimethoprim-Sulfa - - - R - - - - - - - - - - - - - - - - - - - - Ciprofloxacin - - - S - - - - - - - - - - - - - - - - - - - - Gentamicin - - - S - - - - - - - - - - - - - - - - - - - - Culture - - - Klebsiella oxytoca - - - - - - - - - - - - - - - - - - - - Ampicillin - - - R - - - - - - - - - - - - - - - - - - - - Cephalexin - - - S - - - - - - - - - - - - - - - - - - - - Cefazolin - - - S - - - - - - - - - - - - - - - - - - - - Trimethoprim-Sulfa - - - S - - - - - - - - - - - - - - - - - - - - Ciprofloxacin - - - S - - - - - - - - - - - - - - - - - - - - Gentamicin - - - S - - - - - - - - - - - - - - - - - - - - - - - - CHEM2/MICRO3 - - - - - - - - - - - - - - - - - - - - Colour - - - YELLOW - - - - - - - - - - - - - - - - - - - - Appearance - - - CLEAR - - - - - - - - - - - - - - - - - - - - pH - - - 7.5 - - - - - - - - - - - - - - - 5.0...8.5 - 5.0...8.5 - - - - - - - - - - - Specific Gravity - - - 1.010 - - - - - - - - - - - - - - - 1.003...1.035 - 1.003...1.035 - - - - - - - - - - - Protein - - - <0.3 g/L - - - - - - - - - - - - - - - ...0.3 - ...0.3 - - - - - - - - - - - Glucose - - - <6 mmol/L - - - - - - - - - - - - - - - ...6 - ...6 - - - - - - - - - - - Ketones - - - <1.5 mmol/L - - - - - - - - - - - - - - - ...1.5 - ...1.5 - - - - - - - - - - - Hemoglobin - - - NEG - - - - - - - - - - - - - - - Neg - Neg - - - - - - - - - - - Nitrite - - - NEG - - - - - - - - - - - - - - - Neg - Neg - - - - - - - - - - - Leukocytes - - - +2 - - - - - - - - - - - - - - - Neg - Neg - - - - - - - - - - - - - - - - - - - - Report Status - - - Final - - - - - - - - - - - - - - - - - - - - Organism 1 - - - ESCHERICHIA COLI\.Zt\OVER 100 M CFU/L - - - - - - - - - - - - - - - - - - - - - Ampicillin - - - R - - - - - - - - - - - - - - - - - - - - Cephalothin-Cephalexin - - - S - - - - - - - - - - - - - - - - - - - - Trimethoprim-Sulfa - - - S - - - - - - - - - - - - - - - - - - - - Ciprofloxacin - - - S - - - - - - - - - - - - - - - - - - - - Gentamicin - - - S - - - - - - - - - - - - - - - - - - - - Tetracycline - - - S - - - - - - - - - - - - - - - - - - - - Nitrofurantoin - - - S - - - - - - - - - - - - - - - - - -
-
- + + + + HAEM1/HAEM3/CHEM4/CHEM29/REFER1 + + + + + + + + + + + + + + + + + + + + WBC + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 4.0 and 10.0 + + + + + + + + + + + + + + + RBC + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 4.20 and 5.40 + + + + + + + + + + + + + + + Hemoglobin + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 133 and 165 + + + + + + + + + + + + + + + Hematocrit + + + 0.46 + + + + + + + + + + + + + + + + + Normal Reference range is between 0.38 and 0.50 + + + + + + + + + + + + + + + MCV + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 82 and 98 + + + + + + + + + + + + + + + MCH + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 27.5 and 33.5 + + + + + + + + + + + + + + + MCHC + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 305 and 365 + + + + + + + + + + + + + + + RDW + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 11.5 and 14.5 + + + + + + + + + + + + + + + Platelet Count + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 150 and 400 + + + + + + + + + + + + + + + Neutrophils + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 2.0 and 7.5 + + + + + + + + + + + + + + + Lymphocytes + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 1.0 and 4.0 + + + + + + + + + + + + + + + Monocytes + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 0.1 and 0.8 + + + + + + + + + + + + + + + Eosinophils + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 0.0 and 0.7 + + + + + + + + + + + + + + + Basophils + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 0.0 and 0.2 + + + + + + + + + + + + + + + + + + + + + + + + INR + + + 1.0 + + + + + + + + + + + + + + + + + Normal Reference range is between 0.8 and 1.2 + + + + + + + + + + + + + + + + + + + + + + + + Glucose Random + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 3.3 and 11.0 + + + + + + + + + + + + + + + + + + + + + + + + Creatinine + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 70 and 120 + + + + + + + + + + + + + + + Estimated GFR + + + + + + + + + + + + + + + + + + + + >=60 + >=60 + + + + + + + + + + + + + + + + + + + + Uric Acid + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 234 and 529 + + + + + + + + + + + + + + + + + + + + + + + + Albumin + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 35 and 50 + + + + + + + + + + + + + + + + + + + + + + + + Total Bilirubin + + + + + + + + + + + + + + + + + + + + Normal Reference range is less than 20 + + + + + + + + + + + + + + Direct Bilirubin + + + + + + + + + + + + + + + + + + + + Normal Reference range is less than 8 + + + + + + + + + + + + + + + + + + + + + + + Alkaline Phosphatase + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 48 and 138 + + + + + + + + + + + + + + + + + + + + + + + + Gamma GT + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 10 and 58 + + + + + + + + + + + + + + + + + + + + + + + + ALT + + + + + + + + + + + + + + + + + + + + Normal Reference range is less than 60 + + + + + + + + + + + + + + + + + + + + + + + AST + + + + + + + + + + + + + + + + + + + + Normal Reference range is less than 35 + + + + + + + + + + + + + + + + + + + + + + + Lactic Acid + + + + + + + + + + + + + + + + + + + + Normal Reference range is between 0.7 and 2.1 + + + + + + + + + + + + + + + + + + + + + + + + Lipemia + + + Slight + + + + + + + + + + + + + + + + + + + + + + + +
+ + + Medical History (without entries) + No Medical History +
+
+ + +
+ + + Medical Imaging Results and Reports (without entries) + No Medical Imaging Results and Reports +
+
+ - -
- - - Medications and Prescriptions - Medication List [with entries] - - - - - - - - - - - - - - TYLENOL EXTRA STRENGTH TAB 500MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACETAMINOPHEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACETAMINOPHEN - - - - - - - - - - - PRN Indicator: true - - - - - - - - - - - - - - - - - - - - - SPIRONOLACTONE 25MG TABLET - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SPIRONOLACTONE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SPIRONOLACTONE - - - - - - - - - - - PRN Indicator: false - - - - - - - - - - - - - - - - - - - - - IBUPROFEN TAB 400MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IBUPROFEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IBUPROFEN - - - - - - - - - - - PRN Indicator: true - - - - - - - - - - - - - - - - - - - - - ATIVAN 1MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LORAZEPAM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LORAZEPAM - - - - - - - - - - - PRN Indicator: true - - - - - - - - - - - - - - - - - - - - - ASA 81 MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACETYLSALICYLIC ACID - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ACETYLSALICYLIC ACID - - - - - - - - - - - PRN Indicator: false - - - - - - - - - - - - - - - - - - - - - FUROSEMIDE 20MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FUROSEMIDE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FUROSEMIDE - - - - - - - - - - - PRN Indicator: false - - - - - - - - - - - - - - - - - - - - - AVA-RAMIPRIL 5MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RAMIPRIL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RAMIPRIL - - - - - - - - - - - PRN Indicator: false - - - - - - - - - - - - - - - - - - - - - CARVEDILOL 12.5MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CARVEDILOL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CARVEDILOL - - - - - - - - - - - PRN Indicator: false - - - - - - - - - - - - - - - - - - - - - ATORVASTATIN 40MG - - -
- - - - - - - - - - - Usual/long-term medication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ATORVASTATIN (ATORVASTATIN CALCIUM) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ATORVASTATIN (ATORVASTATIN CALCIUM) - - - - - - - - - - - PRN Indicator: false - - - - - - - -
-
- + + + + + + + + ACETAMINOPHEN + TYLENOL EXTRA STRENGTH TAB 500MG + + + + + + ACETAMINOPHEN + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + TYLENOL EXTRA STRENGTH TAB 500MG + + + + + + ACETAMINOPHEN + + + + + + + + + + + + + + + Take 1.0 to 2.0 TABLET PO QID 25 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETAMINOPHEN + TYLENOL EXTRA STRENGTH TAB 500MG + + + + + + ACETAMINOPHEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + SPIRONOLACTONE 25MG TABLET + + + + + + SPIRONOLACTONE + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + SPIRONOLACTONE 25MG TABLET + + + + + + SPIRONOLACTONE + + + + + + + + + + + + + + + Take 1.0 TABLET PO QAM 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SPIRONOLACTONE + SPIRONOLACTONE 25MG TABLET + + + + + + SPIRONOLACTONE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + IBUPROFEN TAB 400MG + + + + + + IBUPROFEN + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + IBUPROFEN TAB 400MG + + + + + + IBUPROFEN + + + + + + + + + + + + + + + Take 1.0 TABLET PO TID 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IBUPROFEN + IBUPROFEN TAB 400MG + + + + + + IBUPROFEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + ATIVAN 1MG + + + + + + LORAZEPAM + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + ATIVAN 1MG + + + + + + LORAZEPAM + + + + + + + + + + + + + + + Take 1.0 TABLET SL BID 20 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LORAZEPAM + ATIVAN 1MG + + + + + + LORAZEPAM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + ASA 81 MG + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + ASA 81 MG + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + + + + + Take 1.0 TABLET (ENTERIC-COATED) PO OD 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACETYLSALICYLIC ACID + ASA 81 MG + + + + + + ACETYLSALICYLIC ACID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + FUROSEMIDE 20MG + + + + + + FUROSEMIDE + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + FUROSEMIDE 20MG + + + + + + FUROSEMIDE + + + + + + + + + + + + + + + Take 1.0 TABLET PO QAM 56 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FUROSEMIDE + FUROSEMIDE 20MG + + + + + + FUROSEMIDE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + AVA-RAMIPRIL 5MG + + + + + + RAMIPRIL + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + AVA-RAMIPRIL 5MG + + + + + + RAMIPRIL + + + + + + + + + + + + + + + take 1.0 TABLET PO OD 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RAMIPRIL + AVA-RAMIPRIL 5MG + + + + + + RAMIPRIL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + CARVEDILOL 12.5MG + + + + + + CARVEDILOL + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + CARVEDILOL 12.5MG + + + + + + CARVEDILOL + + + + + + + + + + + + + + + Take 1.0 TABLET PO OD 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARVEDILOL + CARVEDILOL 12.5MG + + + + + + CARVEDILOL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + ATORVASTATIN 40MG + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + + Long Term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + ATORVASTATIN 40MG + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + + + + + take 1.0 TABLET PO OD 28 D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + ATORVASTATIN 40MG + + + + + + ATORVASTATIN (ATORVASTATIN CALCIUM) + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + Orders and Requests (without entries) + No Orders and Requests +
+
+ - -
- - - Problems and Conditions - Problem List [with entries] - Problems - - - - - - - - - - - - HEART FAILURE* - - - - - - - - - - - - - - - - - - - - - - - - - - ESSENTIAL HYPERTENSION* - - - - - - - - - - - - - - - - - - - - - - - - - - DIABETES MELLITUS* - - - - - - - - - - - - - - - - - - - - - - - - - - CHRONIC BRONCHITIS* - - - - - - - - - - - - - - -
-
- + + + + HEART FAILURE* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ESSENTIAL HYPERTENSION* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DIABETES MELLITUS* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CHRONIC BRONCHITIS* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Purpose [without entries] + Purpose not defined +
+
+ - -
- - - Risk Factors [without entries] - No Risk Factors -
-
- - + +
+ + + Risk Factors [without entries] + No Risk Factors +
+
+ + +
+ + + Care History [without entries] + No Care History +
+
+ + +
+ + + Treatment History [without entries] + No Treatment History +
+
+ +
From 2e31e43ea040f08e6a948115934ae24f23e39089 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 20 Aug 2013 14:29:05 -0700 Subject: [PATCH 079/205] Test code cleanup and documentation --- .../scoop/vital_sign_overweight_map.js | 43 ++++++++++--------- test/fixtures/scoop/vital_signs_map.js | 28 +++++------- test/unit/scoop_job_test.rb | 27 ++++++------ 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/test/fixtures/scoop/vital_sign_overweight_map.js b/test/fixtures/scoop/vital_sign_overweight_map.js index 03f6aba..4ad9a8a 100644 --- a/test/fixtures/scoop/vital_sign_overweight_map.js +++ b/test/fixtures/scoop/vital_sign_overweight_map.js @@ -1,3 +1,7 @@ +// Illustrates retrieval of height, weight and waist circumference values from +// clinical observations and the calculation of BMI based on this information. +// +// Extends Query Title: BMI or WC documented in last 2 yrs age > 19 function map(patient) { var targetWaistCircumferenceCodes = { "LOINC": ["56115-9"] @@ -13,7 +17,7 @@ function map(patient) { var ageLimit = 19; - var wcLimit = 80; + var wcLimit = 90; // waist circumference threshold (cm) var vitalSignList = patient.vitalSigns(); @@ -49,7 +53,17 @@ function map(patient) { return vitalSignList.match(targetWeightCodes, start, end).length; } - function hasMatchingIndicator() { + // http://en.wikipedia.org/wiki/Body_mass_index + function calculateBMI(height, weight, metric) { + if (metric) { + bmi = weight/(height/100.0)^2; // assume cm and kg + } else { + bmi = 703 * weight /height^2; // assume in and lb + } + return bmi; + } + + function hasWaistCircumferenceIndicator() { for (var i = 0; i < vitalSignList.length; i++) { //if (vitalSignList[i].values()[0].units() == "cm") { if (vitalSignList[i].includesCodeFrom(targetWaistCircumferenceCodes) && @@ -61,17 +75,8 @@ function map(patient) { return false; } - // http://en.wikipedia.org/wiki/Body_mass_index - function getBMI(height, weight, metric) { - if (metric) { - bmi = weight/(height/100.0)^2; // assume cm and kg - } else { - bmi = 703 * weight /height^2; // assume in and lb - } - return bmi; - } - function hasHWMatchingIndicator() { + function hasHeightWeightIndicators() { var height = 0; var weight = 0; var bmi = 0; @@ -86,7 +91,7 @@ function map(patient) { //emit("weight="+weight,1); } if (height != 0 && weight != 0) { - bmi = getBMI(height,weight,true); + bmi = calculateBMI(height,weight,true); //emit("bmi="+bmi,1); return bmi > 30; } @@ -97,19 +102,15 @@ function map(patient) { emit('total_pop', 1); - if (hasWaistCircumference()) { - emit("total_overweight", 1); - } - if (population(patient)) { //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); emit(">19_pop", 1); - if (hasWaistCircumference() && hasMatchingIndicator()) { - emit(">19_pop_overweight", 1); + if (hasWaistCircumference() && hasWaistCircumferenceIndicator()) { + emit(">19_pop_overweight_wc", 1); } else { - emit(">19_pop_overweight", 0) + emit(">19_pop_overweight_wc", 0) }; - if (hasHWMatchingIndicator()) { + if (hasHeightWeightIndicators()) { emit(">19_pop_bmi>30",1); } else { emit(">19_pop_bmi>30",0); diff --git a/test/fixtures/scoop/vital_signs_map.js b/test/fixtures/scoop/vital_signs_map.js index 7eb3e7a..ad8b094 100644 --- a/test/fixtures/scoop/vital_signs_map.js +++ b/test/fixtures/scoop/vital_signs_map.js @@ -1,3 +1,7 @@ +// Supports Query Title: BMI or WC documented in last 2 yrs age > 19 +// +// Also illustrates detecting the presence of vital sign information for heart +// rate, blood pressure, temperature, height, weight and waist circumference. function map(patient) { var targetHeartRateCodes = { "LOINC": ["8867-4"] @@ -20,16 +24,16 @@ function map(patient) { }; var targetWaistCircumferenceCodes = { - "LOINC": ["8302-2"] + "LOINC": ["56115-9"] }; - var ageLimit = 20; + var ageLimit = 19; var vitalSignList = patient.vitalSigns(); - var now = new Date(2013, 6, 20); - var start = new Date(2000, 6, 1); - var end = addDate(now, 0, 1, 0); + var now = new Date(2013, 7, 19); + var start = addDate(now, -2, 0, 0); + var end = addDate(now, 0, 0, 0); // Shifts date by year, month, and date specified function addDate(date, y, m, d) { @@ -42,7 +46,7 @@ function map(patient) { // Checks if patient is older than ageLimit function population(patient) { - return (patient.age(now) >= ageLimit); + return (patient.age(now) > ageLimit); } @@ -78,18 +82,6 @@ function map(patient) { emit('total_pop', 1); - if (hasHeartRate()) { - emit("total_heartrate", 1); - } - - if (hasBloodPressure()) { - emit("total_bp", 1); - } - - if (hasTemperature()) { - emit("total_temperature", 1); - } - if (population(patient)) { //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); emit(">19_pop", 1); diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index a5bd327..8a9266f 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -242,38 +242,37 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal results["mi_or_stroke"].to_i, 2 end - test "vital signs overweight query works properly" do + test "vital signs query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') + mf = File.read('test/fixtures/scoop/vital_signs_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job job.invoke_job query.reload results = query.result + assert_equal 9, results['total_pop'] assert_equal 9, results['>19_pop'] - assert_equal 0, results['>19_pop_overweight'] - assert_equal 1, results['>19_pop_bmi>30'] + assert_equal 1, results['>19_pop_heartrate'] + assert_equal 2, results['>19_pop_bp'] + assert_equal 1, results['>19_pop_temperature'] + assert_equal 1, results['>19_pop_height'] + assert_equal 1, results['>19_pop_weight'] + assert_equal 1, results['>19_pop_wc'] end - - test "vital signs query works properly" do + test "overweight query works properly" do Delayed::Worker.delay_jobs=true - mf = File.read('test/fixtures/scoop/vital_signs_map.js') + mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') query = Query.create(map: mf, reduce: rf) job = query.job job.invoke_job query.reload results = query.result - assert_equal 9, results['total_pop'] assert_equal 9, results['>19_pop'] - assert_equal 1, results['>19_pop_heartrate'] - assert_equal 2, results['>19_pop_bp'] - assert_equal 1, results['>19_pop_temperature'] - assert_equal 1, results['>19_pop_height'] - assert_equal 1, results['>19_pop_weight'] - assert_equal 1, results['>19_pop_wc'] + assert_equal 0, results['>19_pop_overweight_wc'] + assert_equal 1, results['>19_pop_bmi>30'] end end From 3211630ec5ca3c3a1209a5d1e4803655424f7bfe Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Tue, 20 Aug 2013 16:06:16 -0700 Subject: [PATCH 080/205] Work in progress on diabetes&bp<=130/80 in last yr indicator --- test/fixtures/scoop/diabetes_bp_map.js | 98 +++++++++++++++++++ .../scoop/vital_sign_overweight_map.js | 1 + test/unit/scoop_job_test.rb | 17 ++++ 3 files changed, 116 insertions(+) create mode 100644 test/fixtures/scoop/diabetes_bp_map.js diff --git a/test/fixtures/scoop/diabetes_bp_map.js b/test/fixtures/scoop/diabetes_bp_map.js new file mode 100644 index 0000000..7ab8681 --- /dev/null +++ b/test/fixtures/scoop/diabetes_bp_map.js @@ -0,0 +1,98 @@ +// Supports Query Title: Diabetes & BP <= 130/80 in last yr + +// Warning: Still work in progress. +function map(patient) { + + var targetBloodPressureCodes = { + "LOINC": ["55284-4"] + }; + + var targetLabCodes = { + "LOINC": ["4548-4"] + }; + + var targetProblemCodes = { + "ICD9": ["250"] + }; + + var ageLimit = 18; + var bpSystolicLimit = 130 + var bpDiastolicLimit = 80 + + var resultList = patient.results(); + var problemList = patient.conditions(); + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -1, 0, 0); // last 12 months + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) >= ageLimit); + } + + // Checks for existence of blood pressure observation + function hasBloodPressure() { + return vitalSignList.match(targetBloodPressureCodes, start, end).length; + } + + // Checks for HGBA1C labs performed within the last 12 months + function hasLabCode() { + return resultList.match(targetLabCodes, start, end).length; + } + + // Checks for diabetic patients + function hasProblemCode() { + return problemList.match(targetProblemCodes).length; + } + + + function hasBloodPressureMatchingIndicator() { + for (var i = 0; i < vitalSignList.length; i++) { + if (vitalSignList[i].includesCodeFrom(targetBloodPressureCodes) && + vitalSignList[i].values()[0].scalar() < bpSystolicLimit) { + //emit('systolic_dystolic['+i+']: '+vitalSignList[i].values()[0].scalar(), 1); + return true; + } else { + //emit('systolic_dystolic['+i+']: '+vitalSignList[i].values()[0].scalar(), 0); + } + } + return false; + } + + emit('total_pop', 1); + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">=18_pop", 1); + + if (hasProblemCode()) { + emit(">=18_diabetics", 1); + if(hasLabCode()) { + emit(">=18_diabetics_has_hgba1c_result", 1); + if (hasBloodPressure()) { + emit(">=18_diabetics_bp",1) + //if (hasBloodPressureMatchingIndicator()) { + // emit(">=18_diabetics_bp130",1) + //} + } else { + emit(">=18_diabetics_bp",0) + } + } else { + emit(">=18_diabetics_has_hgba1c_result", 0); + } + } else { + emit(">=18_diabetics", 0); + } + } +} \ No newline at end of file diff --git a/test/fixtures/scoop/vital_sign_overweight_map.js b/test/fixtures/scoop/vital_sign_overweight_map.js index 4ad9a8a..efa86ed 100644 --- a/test/fixtures/scoop/vital_sign_overweight_map.js +++ b/test/fixtures/scoop/vital_sign_overweight_map.js @@ -2,6 +2,7 @@ // clinical observations and the calculation of BMI based on this information. // // Extends Query Title: BMI or WC documented in last 2 yrs age > 19 +// Warning: Still a work in progress. function map(patient) { var targetWaistCircumferenceCodes = { "LOINC": ["56115-9"] diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 8a9266f..8ca9607 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -261,6 +261,23 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 1, results['>19_pop_wc'] end + + test "diabetes and bp query works properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/diabetes_bp_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + assert_equal 9, results['total_pop'] + assert_equal 9, results['>=18_pop'] + assert_equal 3, results['>=18_diabetics'] + assert_equal 1, results['>=18_diabetics_has_hgba1c_result'] + assert_equal 0, results['>=18_diabetics_bp'] + end + test "overweight query works properly" do Delayed::Worker.delay_jobs=true mf = File.read('test/fixtures/scoop/vital_sign_overweight_map.js') From a89347849d49b91fd3a530d00dcb36feadac36c9 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 21 Aug 2013 16:07:12 -0700 Subject: [PATCH 081/205] Added support of separate blood pressures Signed-off-by: Jeremy Ho --- test/fixtures/JOHN_CLEESE_1_25091940.xml | 115 ++++++++++++----------- test/fixtures/scoop-records.json | 18 ++-- test/fixtures/scoop/vital_signs_map.js | 24 +++++ test/unit/scoop_job_test.rb | 4 +- 4 files changed, 97 insertions(+), 64 deletions(-) diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml index 4528390..3699966 100644 --- a/test/fixtures/JOHN_CLEESE_1_25091940.xml +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -25,7 +25,7 @@ CDA Header PITO EMR-2-EMR Record of JOHN CLEESE - + -
@@ -313,7 +347,7 @@ Clinically Measured Observation Weight (in kg) - 71 +
@@ -346,7 +380,7 @@ Clinically Measured Observation Height (in cm) - 170 +
@@ -379,7 +413,7 @@ Clinically Measured Observation Waist (Waist Circum in cm) - 36 +
@@ -412,7 +446,7 @@ Clinically Measured Observation Heart Rate (in bpm (nnn) Range:40-180) - 85 + @@ -2185,11 +2219,8 @@ Code"/> - Take 1.0 to 2.0 TABLET PO QID 25 D - - - + 25 D @@ -2340,11 +2371,8 @@ Code"/> - Take 1.0 TABLET PO QAM 28 D - - - + 28 D @@ -2495,11 +2523,8 @@ Code"/> - Take 1.0 TABLET PO TID 28 D - - - + 28 D @@ -2650,11 +2675,8 @@ Code"/> - Take 1.0 TABLET SL BID 20 D - - - + 20 D @@ -2805,11 +2827,8 @@ Code"/> - Take 1.0 TABLET (ENTERIC-COATED) PO OD 28 D - - - + 28 D @@ -2960,11 +2979,8 @@ Code"/> - Take 1.0 TABLET PO QAM 56 D - - - + 56 D @@ -3115,11 +3131,8 @@ Code"/> - take 1.0 TABLET PO OD 28 D - - - + 28 D @@ -3270,11 +3283,8 @@ Code"/> - Take 1.0 TABLET PO OD 28 D - - - + 28 D @@ -3425,11 +3435,8 @@ Code"/> - take 1.0 TABLET PO OD 28 D - - - + 28 D @@ -3761,4 +3768,4 @@ Treatment History - + \ No newline at end of file diff --git a/test/fixtures/scoop-records.json b/test/fixtures/scoop-records.json index aae06f2..31c9178 100644 --- a/test/fixtures/scoop-records.json +++ b/test/fixtures/scoop-records.json @@ -1,9 +1,9 @@ -{ "_id" : { "$oid" : "520d4dce425822f903000001" }, "effective_time" : 1376493840, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dce425822f903000002" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000003" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dce425822f903000004" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dce425822f903000005" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dce425822f903000006" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000007" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f903000008" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f903000009" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dce425822f90300000a" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dce425822f90300000b" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258224d0f00002f" }, "effective_time" : 1376493840, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000030" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000031" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258224d0f000032" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000033" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258224d0f000034" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } -{ "_id" : { "$oid" : "520d4dcf42582274e20000b4" }, "effective_time" : 1376493840, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b5" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b6" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b8" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000b9" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf42582274e20000ba" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 112 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bb" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bc" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dcf42582274e20000bd" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf4258227fac00000c" }, "effective_time" : 1376493840, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000d" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00000e" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00000f" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000010" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000011" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000012" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000013" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000014" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000015" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf4258227fac000016" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000017" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "520d4dcf4258227fac000018" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000019" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001a" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001b" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001c" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001d" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00001e" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00001f" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000020" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000021" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000022" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000023" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000024" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000025" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000026" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000027" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac000028" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac000029" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002a" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002b" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002c" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf4258227fac00002d" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "520d4dcf4258227fac00002e" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf425822b958000051" }, "effective_time" : 1376493840, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dcf425822b958000052" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822b958000053" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000054" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000055" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000056" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000057" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b958000058" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000059" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005b" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "520d4dcf425822b95800005c" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "520d4dcf425822b95800005d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005e" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800005f" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000060" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000061" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000062" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000063" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000064" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000065" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000066" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000067" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000068" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000069" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800006e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800006f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dcf425822b958000070" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000071" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000072" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000073" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000074" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000075" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000076" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000077" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000078" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000079" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007a" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007b" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007c" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007d" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800007e" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800007f" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000080" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000081" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000082" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000083" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000084" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000085" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000086" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000087" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000088" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000089" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008a" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008b" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008c" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008d" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800008e" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800008f" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000090" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000091" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000092" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000093" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000094" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000095" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000096" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000097" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b958000098" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b958000099" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009a" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009b" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009c" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009d" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b95800009e" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b95800009f" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a0" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a1" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a2" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a3" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a4" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a5" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000a6" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a7" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a8" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "130/85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000a9" }, "scalar" : "130/85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000aa" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "37", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ab" }, "scalar" : "37", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ac" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight (in kg)", "free_text" : "71", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000ad" }, "scalar" : "71", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000ae" }, "codes" : { "LOINC" : [ "8302-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Height (in cm)", "free_text" : "170", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000af" }, "scalar" : "170", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000b0" }, "codes" : { "LOINC" : [ "56115-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Waist (Waist Circum in cm)", "free_text" : "36", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000b1" }, "scalar" : "36", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822b9580000b2" }, "codes" : { "LOINC" : [ "8867-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Heart Rate (in bpm (nnn) Range:40-180)", "free_text" : "85", "values" : [ { "_id" : { "$oid" : "520d4dcf425822b9580000b3" }, "scalar" : "85", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dcf425822e5a4000035" }, "effective_time" : 1376493840, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000036" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000037" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000038" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000039" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003a" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400003c" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003e" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400003f" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000040" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000041" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } }, "duration" : { "width" : { "unit" : "D", "value" : 16 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000042" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000043" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000044" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000045" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000046" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000047" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000048" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a4000049" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004a" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004b" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004c" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004d" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a400004e" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dcf425822e5a400004f" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dcf425822e5a4000050" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd04258221c5e0000e1" }, "effective_time" : 1376493840, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e2" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e4" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e5" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd04258221c5e0000e7" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "W", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd04258221c5e0000e8" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b0f60000e9" }, "effective_time" : 1376493840, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ea" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000eb" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000ec" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ed" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ee" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000ef" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f0" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f1" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b0f60000f2" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f3" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f4" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b0f60000f5" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } -{ "_id" : { "$oid" : "520d4dd0425822b79b0000be" }, "effective_time" : 1376493840, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000bf" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c0" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c1" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c2" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c3" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c4" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c5" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000c6" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c7" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c8" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000c9" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 25 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ca" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cb" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000cc" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cd" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000ce" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000cf" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 20 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d0" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d1" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d2" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d3" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d4" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d5" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 56 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d6" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d7" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000d8" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000d9" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000da" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "520d4dd0425822b79b0000db" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } }, "duration" : { "width" : { "unit" : "D", "value" : 28 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dc" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000dd" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000de" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000df" }, "codes" : { "LOINC" : [ "55284-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Blood Pressure (standing position)", "free_text" : "140/90", "values" : [ { "_id" : { "$oid" : "520d4dd0425822b79b0000e0" }, "scalar" : "140/90", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443a425822686b000105" }, "effective_time" : 1377099720, "first" : "JOAN", "last" : "CHARLES", "birthdate" : -452649600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443a425822686b000106" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822686b000107" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443a425822686b000108" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822686b000109" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443a425822686b00010a" }, "codes" : { "ICD9" : [ "412" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OLD MYOCARDIAL INFARCT", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822686b00010b" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443a425822686b00010c" }, "codes" : { "ICD9" : [ "733" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "OTH BONE AND CARTILAGE DIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822686b00010d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443a425822686b00010e" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1044057600, "description" : "Pneumovax" }, { "_id" : { "$oid" : "5215443a425822686b00010f" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1288310400, "description" : "Flu" }, { "_id" : { "$oid" : "5215443a425822686b000110" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1320883200, "description" : "Flu" }, { "_id" : { "$oid" : "5215443a425822686b000111" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "5215443a425822686b000112" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b000113" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000114" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b000115" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000116" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b000117" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000118" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b000119" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b00011a" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b00011b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b00011c" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b00011d" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b00011e" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822686b00011f" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "5215443a425822686b000120" }, "codes" : { "LOINC" : [ "14771-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Glucose Fasting", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.6 and 5.5", "values" : [ { "_id" : { "$oid" : "5215443a425822686b000121" }, "scalar" : "4.9", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000122" }, "codes" : { "LOINC" : [ "58453-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Occult Blood Immunochemical", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 50", "values" : [ { "_id" : { "$oid" : "5215443a425822686b000123" }, "scalar" : "35", "units" : "ng/mL", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000124" }, "codes" : { "LOINC" : [ "4548-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "Hemoglobin A1c", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.8 and 6.0", "values" : [ { "_id" : { "$oid" : "5215443a425822686b000125" }, "scalar" : "6.4", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822686b000126" }, "codes" : { "LOINC" : [ "39469-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1371734684, "description" : "LDL Cholesterol", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 3.4", "values" : [ { "_id" : { "$oid" : "5215443a425822686b000127" }, "scalar" : "2.4", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443a425822b0ba000128" }, "effective_time" : 1377099720, "first" : "CHUCK", "last" : "SMITH", "birthdate" : -1060300800, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443a425822b0ba000129" }, "codes" : { "ICD9" : [ "71616" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TRAUM ARTHROPATHY-L/LEG", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822b0ba00012a" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443a425822b0ba00012b" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1130544000, "description" : "Flu" }, { "_id" : { "$oid" : "5215443a425822b0ba00012c" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1321142400, "description" : "Flu" }, { "_id" : { "$oid" : "5215443a425822b0ba00012d" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ] } +{ "_id" : { "$oid" : "5215443a425822c5f70000fa" }, "effective_time" : 1377099720, "first" : "ELIZABETH", "last" : "SINCLAIR", "birthdate" : -841968000, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443a425822c5f70000fb" }, "codes" : { "ICD9" : [ "303" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ALCOHOL DEPENDENCE SYNDR*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822c5f70000fc" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443a425822c5f70000fd" }, "codes" : { "ICD9" : [ "3051" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "TOBACCO USE DISORDER", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443a425822c5f70000fe" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "5215443a425822c5f70000ff" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822c5f7000100" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822c5f7000101" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822c5f7000102" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443a425822c5f7000103" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443a425822c5f7000104" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b42582201760001de" }, "effective_time" : 1377099720, "first" : "MARY", "last" : "JONES", "birthdate" : -1458345600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443b42582201760001df" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b42582201760001e0" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443b42582201760001e1" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "5215443b42582201760001e2" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582201760001e3" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582201760001e4" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582201760001e5" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b42582265cc0001b9" }, "effective_time" : 1377099720, "first" : "MARK", "last" : "IVE", "birthdate" : -818208000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "5215443b42582265cc0001ba" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "SULFADIAZINE", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "Hives", "value" : null }, "severity" : { "code" : "A3", "displayName" : "Moderate", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "5215443b42582265cc0001bb" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b42582265cc0001bc" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001bd" }, "codes" : { "ICD9" : [ "234" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CA IN SITU NEC/NOS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b42582265cc0001be" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001bf" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c0" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001c1" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c2" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c3" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1331424000, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c4" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c5" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001c6" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c7" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001c8" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001c9" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001ca" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001cb" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001cc" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001cd" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001ce" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001cf" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001d0" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d1" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001d2" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d3" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001d4" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d5" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001d6" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d7" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d8" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001d9" }, "scalar" : "161.2", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "5215443b42582265cc0001da" }, "codes" : { "LOINC" : [ "8480-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Systolic Blood Pressure (standing position)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001db" }, "scalar" : "140", "units" : "mm[Hg]", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b42582265cc0001dc" }, "codes" : { "LOINC" : [ "8462-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Diastolic Blood Pressure (standing position)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b42582265cc0001dd" }, "scalar" : "90", "units" : "mm[Hg]", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b4258228c9c00012e" }, "effective_time" : 1377099720, "first" : "HARRY", "last" : "JONES", "birthdate" : -1591315200, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443b4258228c9c00012f" }, "codes" : { "ICD9" : [ "492" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "EMPHYSEMA*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b4258228c9c000130" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000131" }, "codes" : { "ICD9" : [ "272" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIS OF LIPOID METABOLISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b4258228c9c000132" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000133" }, "codes" : { "ICD9" : [ "8054" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "FX LUMBAR VERTEBRA-CLOSE", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b4258228c9c000134" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000135" }, "codes" : { "ICD9" : [ "410" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACUTE MYOCARDIAL INFARCT*", "type" : null, "time" : null, "start_time" : 1376438400, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b4258228c9c000136" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443b4258228c9c000137" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351123200, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "5215443b4258228c9c000138" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 6 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000139" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c00013a" }, "codes" : { "HC-DIN" : [ "02014203" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 4 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "MS IR TAB 5MG", "start_time" : 1362441600, "end_time" : 1365206400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c00013b" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c00013c" }, "codes" : { "HC-DIN" : [ "02014319" ], "whoATC" : [ "N02AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "h", "value" : 12 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ERTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (EXTENDED-RELEASE)" }, "description" : "MS CONTIN SRT 100MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c00013d" }, "scalar" : "100.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c00013e" }, "codes" : { "HC-DIN" : [ "02241497" ], "whoATC" : [ "R03AC02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "VENTOLIN HFA 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c00013f" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000140" }, "codes" : { "HC-DIN" : [ "02242030" ], "whoATC" : [ "R03BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "2.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "QVAR 100µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000141" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000142" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000143" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000144" }, "codes" : { "HC-DIN" : [ "02247686" ], "whoATC" : [ "R03BB01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "INH", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "INH" }, "productForm" : { "code" : "MDINHL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "METERED-DOSE AEROSOL" }, "description" : "ATROVENT HFA 20µG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000145" }, "scalar" : "20.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000146" }, "codes" : { "HC-DIN" : [ "02344157" ], "whoATC" : [ "N06AB03" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "CAP", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "CAPSULE" }, "description" : "FLUOXETINE 20MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000147" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b4258228c9c000148" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b4258228c9c000149" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b425822c21c0001af" }, "effective_time" : 1377099720, "first" : "DALE", "last" : "CHAN", "birthdate" : 97113600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b0" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PEANUT OIL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "anaphylaxis", "value" : null }, "severity" : { "code" : "A4", "displayName" : "Severe", "codeSystem" : "2.16.840.1.113883.5.1063", "codeSystemName" : "HL7 ObservationValue" } } ], "conditions" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b1" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b2" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b3" }, "codes" : { "HC-DIN" : [ "00509558" ], "whoATC" : [ "C01CA24" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : null, "denominator" : null } }, "freeTextSig" : "Use if exposed to peanuts or other allergy", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "IM", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "IM" }, "productForm" : { "code" : "SOL", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "SOLUTION" }, "description" : "EPIPEN 0.3MG/0.3ML AUTO-INJECTOR", "start_time" : 1362441600, "end_time" : 1362441600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b4" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822c21c0001b5" }, "codes" : { "HC-DIN" : [ "02172100" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 100MCG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b6" }, "scalar" : "100.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b7" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "5215443b425822c21c0001b8" }, "scalar" : "131.6", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b425822ecca00014a" }, "effective_time" : 1377099720, "first" : "JOHN", "last" : "CLEESE", "birthdate" : -923616000, "gender" : "M", "medical_record_number" : "000000000", "languages" : [ "EN" ], "allergies" : [ { "_id" : { "$oid" : "5215443b425822ecca00014b" }, "codes" : { "Unknown" : [ "NA" ] }, "mood_code" : "EVN", "_type" : "Allergy", "time" : 1362441600, "description" : "PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL", "status_code" : { "PITO AlleryClinicalStatus" : [ "C" ] }, "type" : { "code" : "MED", "displayName" : "Medication", "codeSystem" : "2.16.840.1.113883.5.4", "codeSystemName" : "HL7 ActCode" }, "reaction" : { "text" : "", "value" : null }, "severity" : null } ], "conditions" : [ { "_id" : { "$oid" : "5215443b425822ecca00014c" }, "codes" : { "ICD9" : [ "428" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "HEART FAILURE*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822ecca00014d" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b425822ecca00014e" }, "codes" : { "ICD9" : [ "401" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ESSENTIAL HYPERTENSION*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822ecca00014f" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b425822ecca000150" }, "codes" : { "ICD9" : [ "250" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "DIABETES MELLITUS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822ecca000151" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b425822ecca000152" }, "codes" : { "ICD9" : [ "491" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "CHRONIC BRONCHITIS*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822ecca000153" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "immunizations" : [ { "_id" : { "$oid" : "5215443b425822ecca000154" }, "codes" : { "whoATC" : [ "J07CA01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1346457600, "description" : "Td" }, { "_id" : { "$oid" : "5215443b425822ecca000155" }, "codes" : { "whoATC" : [ "J07AL02" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1233446400, "description" : "Pneumovax" }, { "_id" : { "$oid" : "5215443b425822ecca000156" }, "codes" : { "whoATC" : [ "J07BB01" ] }, "mood_code" : "EVN", "_type" : "Immunization", "time" : 1351641600, "description" : "Flu" } ], "medications" : [ { "_id" : { "$oid" : "5215443b425822ecca000157" }, "codes" : { "HC-DIN" : [ "00559407" ], "whoATC" : [ "N02BE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 4 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "2.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "TYLENOL EXTRA STRENGTH TAB 500MG", "start_time" : 1362441600, "end_time" : 1366761600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000158" }, "scalar" : "500.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000159" }, "codes" : { "HC-DIN" : [ "00613215" ], "whoATC" : [ "C03DA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SPIRONOLACTONE 25MG TABLET", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00015a" }, "scalar" : "25.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00015b" }, "codes" : { "HC-DIN" : [ "00636533" ], "whoATC" : [ "M01AE01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 3 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "IBUPROFEN TAB 400MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00015c" }, "scalar" : "400.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00015d" }, "codes" : { "HC-DIN" : [ "02041421" ], "whoATC" : [ "N05BA06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 2 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "SL", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "SL" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATIVAN 1MG", "start_time" : 1362441600, "end_time" : 1365897600, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00015e" }, "scalar" : "1.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00015f" }, "codes" : { "HC-DIN" : [ "02244993" ], "whoATC" : [ "B01AC06" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "ECTAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET (ENTERIC-COATED)" }, "description" : "ASA 81 MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000160" }, "scalar" : "81.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000161" }, "codes" : { "HC-DIN" : [ "02351420" ], "whoATC" : [ "C03CA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "FUROSEMIDE 20MG", "start_time" : 1362441600, "end_time" : 1372118400, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000162" }, "scalar" : "20.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000163" }, "codes" : { "HC-DIN" : [ "02363283" ], "whoATC" : [ "C09AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "AVA-RAMIPRIL 5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000164" }, "scalar" : "5.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000165" }, "codes" : { "HC-DIN" : [ "02364948" ], "whoATC" : [ "C07AG02" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "CARVEDILOL 12.5MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000166" }, "scalar" : "12.5", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000167" }, "codes" : { "HC-DIN" : [ "02387913" ], "whoATC" : [ "C10AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "ATORVASTATIN 40MG", "start_time" : 1362441600, "end_time" : 1367280000, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000168" }, "scalar" : "40.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "5215443b425822ecca000169" }, "codes" : { "LOINC" : [ "6690-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "WBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.0 and 10.0", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00016a" }, "scalar" : "8.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00016b" }, "codes" : { "LOINC" : [ "789-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RBC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 4.20 and 5.40", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00016c" }, "scalar" : "4.71", "units" : "tera/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00016d" }, "codes" : { "LOINC" : [ "718-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hemoglobin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 133 and 165", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00016e" }, "scalar" : "158", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00016f" }, "codes" : { "LOINC" : [ "4544-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Hematocrit", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.38 and 0.50", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000170" }, "scalar" : "0.46", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000171" }, "codes" : { "LOINC" : [ "787-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCV", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 82 and 98", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000172" }, "scalar" : "99", "units" : "fl", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000173" }, "codes" : { "LOINC" : [ "785-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCH", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 27.5 and 33.5", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000174" }, "scalar" : "33.5", "units" : "pg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000175" }, "codes" : { "LOINC" : [ "786-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "MCHC", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 305 and 365", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000176" }, "scalar" : "341", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000177" }, "codes" : { "LOINC" : [ "788-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "RDW", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 11.5 and 14.5", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000178" }, "scalar" : "12.6", "units" : "%", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000179" }, "codes" : { "LOINC" : [ "777-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Platelet Count", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 150 and 400", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00017a" }, "scalar" : "295", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00017b" }, "codes" : { "LOINC" : [ "751-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Neutrophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 2.0 and 7.5", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00017c" }, "scalar" : "6.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00017d" }, "codes" : { "LOINC" : [ "731-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lymphocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 1.0 and 4.0", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00017e" }, "scalar" : "1.6", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00017f" }, "codes" : { "LOINC" : [ "742-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Monocytes", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.1 and 0.8", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000180" }, "scalar" : "0.4", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000181" }, "codes" : { "LOINC" : [ "711-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Eosinophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.7", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000182" }, "scalar" : "0.1", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000183" }, "codes" : { "LOINC" : [ "704-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Basophils", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.0 and 0.2", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000184" }, "scalar" : "0.0", "units" : "giga/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000185" }, "codes" : { "LOINC" : [ "6301-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "INR", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.8 and 1.2", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000186" }, "scalar" : "1.0", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000187" }, "codes" : { "LOINC" : [ "14749-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Glucose Random", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 3.3 and 11.0", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000188" }, "scalar" : "5.2", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000189" }, "codes" : { "LOINC" : [ "14682-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 70 and 120", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00018a" }, "scalar" : "68", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00018b" }, "codes" : { "LOINC" : [ "33914-3" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Estimated GFR", "status_code" : { "value" : "final" }, "referenceRange" : ">=60", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00018c" }, "scalar" : "113", "units" : "mL/min", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00018d" }, "codes" : { "LOINC" : [ "14933-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Uric Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 234 and 529", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00018e" }, "scalar" : "317", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00018f" }, "codes" : { "LOINC" : [ "1751-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Albumin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 35 and 50", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000190" }, "scalar" : "45", "units" : "g/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000191" }, "codes" : { "LOINC" : [ "14631-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Total Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 20", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000192" }, "scalar" : "16", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000193" }, "codes" : { "LOINC" : [ "14629-0" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Direct Bilirubin", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 8", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000194" }, "scalar" : "5", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000195" }, "codes" : { "LOINC" : [ "6768-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Alkaline Phosphatase", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 48 and 138", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000196" }, "scalar" : "74", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000197" }, "codes" : { "LOINC" : [ "2324-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Gamma GT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 10 and 58", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca000198" }, "scalar" : "10", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca000199" }, "codes" : { "LOINC" : [ "1742-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "ALT", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 60", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00019a" }, "scalar" : "19", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00019b" }, "codes" : { "LOINC" : [ "1920-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "AST", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 35", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00019c" }, "scalar" : "25", "units" : "U/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00019d" }, "codes" : { "LOINC" : [ "2524-7" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "N", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lactic Acid", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is between 0.7 and 2.1", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca00019e" }, "scalar" : "1.0", "units" : "mmol/L", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca00019f" }, "codes" : { "LOINC" : [ "46425-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1369995612, "description" : "Lipemia", "status_code" : { "value" : "final" }, "referenceRange" : "unspecified", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a0" }, "scalar" : "Slight", "units" : null, "_type" : "PhysicalQuantityResultValue" } ] } ], "vital_signs" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a1" }, "codes" : { "LOINC" : [ "8480-6" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Systolic Blood Pressure (standing position)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a2" }, "scalar" : "130", "units" : "mm[Hg]", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001a3" }, "codes" : { "LOINC" : [ "8462-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Diastolic Blood Pressure (standing position)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a4" }, "scalar" : "85", "units" : "mm[Hg]", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001a5" }, "codes" : { "LOINC" : [ "8310-5" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Temperature (degrees celcius)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a6" }, "scalar" : "37", "units" : "C", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001a7" }, "codes" : { "LOINC" : [ "3141-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Weight (in kg)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001a8" }, "scalar" : "71", "units" : "kg", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001a9" }, "codes" : { "LOINC" : [ "8302-2" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Height (in cm)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001aa" }, "scalar" : "170", "units" : "cm", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001ab" }, "codes" : { "LOINC" : [ "56115-9" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Waist (Waist Circum in cm)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001ac" }, "scalar" : "36", "units" : "cm", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822ecca0001ad" }, "codes" : { "LOINC" : [ "8867-4" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : null, "time" : 1376438400, "description" : "Heart Rate (in bpm (nnn) Range:40-180)", "free_text" : "", "values" : [ { "_id" : { "$oid" : "5215443b425822ecca0001ae" }, "scalar" : "85", "units" : "beats/min", "_type" : "PhysicalQuantityResultValue" } ] } ] } +{ "_id" : { "$oid" : "5215443b425822f3460001e6" }, "effective_time" : 1377099720, "first" : "JILL", "last" : "THOMAS", "birthdate" : -1441497600, "gender" : "F", "medical_record_number" : "000000000", "languages" : [ "EN" ], "conditions" : [ { "_id" : { "$oid" : "5215443b425822f3460001e7" }, "codes" : { "ICD9" : [ "244" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ACQUIRED HYPOTHYROIDISM*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822f3460001e8" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] }, { "_id" : { "$oid" : "5215443b425822f3460001e9" }, "codes" : { "ICD9" : [ "3000" ] }, "mood_code" : "EVN", "_type" : "Condition", "description" : "ANXIETY STATES*", "type" : null, "time" : null, "start_time" : 1362441600, "status_code" : { "SNOMED-CT" : [ "55561003" ], "HL7 ActStatus" : [ "active" ] }, "treating_provider" : [ { "_id" : { "$oid" : "5215443b425822f3460001ea" }, "title" : null, "given_name" : null, "family_name" : null, "specialty" : null, "start" : null, "end" : null } ] } ], "medications" : [ { "_id" : { "$oid" : "5215443b425822f3460001eb" }, "codes" : { "HC-DIN" : [ "00013293" ], "whoATC" : [ "N05BA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "VALIUM 10 TAB", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822f3460001ec" }, "scalar" : "10.0", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822f3460001ed" }, "codes" : { "HC-DIN" : [ "02171228" ], "whoATC" : [ "H03AA01" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "completed" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "SYNTHROID - TAB 112MCG", "start_time" : 1362441600, "end_time" : 1376956800, "time" : 1362441600, "values" : [ { "_id" : { "$oid" : "5215443b425822f3460001ee" }, "scalar" : "112.0", "units" : "µG", "_type" : "PhysicalQuantityResultValue" } ] }, { "_id" : { "$oid" : "5215443b425822f3460001ef" }, "codes" : { "HC-DIN" : [ "02245428" ], "whoATC" : [ "C01AA05" ] }, "mood_code" : "EVN", "_type" : "Medication", "administrationTiming" : { "frequency" : { "numerator" : { "unit" : null, "value" : 1 }, "denominator" : { "unit" : "d", "value" : 1 } } }, "freeTextSig" : "", "dose" : { "low" : "1.0", "high" : "1.0" }, "statusOfMedication" : { "value" : "active" }, "route" : { "code" : "PO", "codeSystem" : "2.16.840.1.113883.5.112", "codeSystemName" : "RouteOfAdministration", "displayName" : "PO" }, "productForm" : { "code" : "TAB", "codeSystem" : "2.16.840.1.113883.1.11.14570", "displayName" : "TABLET" }, "description" : "PMS-DIGOXIN 0.25MG", "start_time" : 1370822400, "end_time" : 1373241600, "time" : 1370822400, "values" : [ { "_id" : { "$oid" : "5215443b425822f3460001f0" }, "scalar" : "0.25", "units" : "MG", "_type" : "PhysicalQuantityResultValue" } ] } ], "results" : [ { "_id" : { "$oid" : "5215443b425822f3460001f1" }, "codes" : { "LOINC" : [ "45066-8" ] }, "mood_code" : "EVN", "_type" : "LabResult", "interpretation" : { "code" : "A", "codeSystem" : "ObservationInterpretation" }, "time" : 1370604000, "description" : "Creatinine", "status_code" : { "value" : "final" }, "referenceRange" : "Normal Reference range is less than 150.0", "values" : [ { "_id" : { "$oid" : "5215443b425822f3460001f2" }, "scalar" : "158.4", "units" : "umol/L", "_type" : "PhysicalQuantityResultValue" } ] } ] } \ No newline at end of file diff --git a/test/fixtures/scoop/vital_signs_map.js b/test/fixtures/scoop/vital_signs_map.js index ad8b094..e3552c1 100644 --- a/test/fixtures/scoop/vital_signs_map.js +++ b/test/fixtures/scoop/vital_signs_map.js @@ -11,6 +11,14 @@ function map(patient) { "LOINC": ["55284-4"] }; + var targetBloodPressureSystolicCodes = { + "LOINC": ["8480-6"] + }; + + var targetBloodPressureDiastolicCodes = { + "LOINC": ["8480-6"] + }; + var targetTemperatureCodes = { "LOINC": ["8310-5"] }; @@ -60,6 +68,16 @@ function map(patient) { return vitalSignList.match(targetBloodPressureCodes, start, end).length; } + // Checks for existence of systolic blood pressure observation + function hasSystolicBloodPressure() { + return vitalSignList.match(targetBloodPressureSystolicCodes, start, end).length; + } + + // Checks for existence of diastolic blood pressure observation + function hasDiastolicBloodPressure() { + return vitalSignList.match(targetBloodPressureDiastolicCodes, start, end).length; + } + // Checks for existence of temperature observation function hasTemperature() { return vitalSignList.match(targetTemperatureCodes, start, end).length; @@ -91,6 +109,12 @@ function map(patient) { if (hasBloodPressure()) { emit(">19_pop_bp",1) } + if (hasSystolicBloodPressure()) { + emit(">19_pop_bp_systolic",1) + } + if (hasDiastolicBloodPressure()) { + emit(">19_pop_bp_diastolic",1) + } if (hasTemperature()) { emit(">19_pop_temperature", 1); } diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index 8ca9607..fa08181 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -254,7 +254,9 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 9, results['total_pop'] assert_equal 9, results['>19_pop'] assert_equal 1, results['>19_pop_heartrate'] - assert_equal 2, results['>19_pop_bp'] + #assert_equal 2, results['>19_pop_bp'] + assert_equal 2, results['>19_pop_bp_systolic'] + assert_equal 2, results['>19_pop_bp_diastolic'] assert_equal 1, results['>19_pop_temperature'] assert_equal 1, results['>19_pop_height'] assert_equal 1, results['>19_pop_weight'] From 13f4696265bcb3c9d8b2eca034343fb5a8ccf0b3 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 21 Aug 2013 16:11:16 -0700 Subject: [PATCH 082/205] Minor tweak to diastolic bp code Signed-off-by: Jeremy Ho --- test/fixtures/scoop/diabetes_bp_map.js | 18 ++++++++++++++++++ test/fixtures/scoop/vital_signs_map.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/test/fixtures/scoop/diabetes_bp_map.js b/test/fixtures/scoop/diabetes_bp_map.js index 7ab8681..cff8dd9 100644 --- a/test/fixtures/scoop/diabetes_bp_map.js +++ b/test/fixtures/scoop/diabetes_bp_map.js @@ -7,6 +7,14 @@ function map(patient) { "LOINC": ["55284-4"] }; + var targetBloodPressureSystolicCodes = { + "LOINC": ["8480-6"] + }; + + var targetBloodPressureDiastolicCodes = { + "LOINC": ["8462-4"] + }; + var targetLabCodes = { "LOINC": ["4548-4"] }; @@ -46,6 +54,16 @@ function map(patient) { return vitalSignList.match(targetBloodPressureCodes, start, end).length; } + // Checks for existence of systolic blood pressure observation + function hasSystolicBloodPressure() { + return vitalSignList.match(targetBloodPressureSystolicCodes, start, end).length; + } + + // Checks for existence of diastolic blood pressure observation + function hasDiastolicBloodPressure() { + return vitalSignList.match(targetBloodPressureDiastolicCodes, start, end).length; + } + // Checks for HGBA1C labs performed within the last 12 months function hasLabCode() { return resultList.match(targetLabCodes, start, end).length; diff --git a/test/fixtures/scoop/vital_signs_map.js b/test/fixtures/scoop/vital_signs_map.js index e3552c1..68fabdf 100644 --- a/test/fixtures/scoop/vital_signs_map.js +++ b/test/fixtures/scoop/vital_signs_map.js @@ -16,7 +16,7 @@ function map(patient) { }; var targetBloodPressureDiastolicCodes = { - "LOINC": ["8480-6"] + "LOINC": ["8462-4"] }; var targetTemperatureCodes = { From 6abe44f3f7f22263f040de2f7df5f9175ae03be0 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Thu, 22 Aug 2013 15:30:37 -0700 Subject: [PATCH 083/205] Complete AMCARE indicator diabetes *& bp <=130/80 in last yr --- test/fixtures/scoop/diabetes_bp_map.js | 62 ++++++++++++-------------- test/unit/scoop_job_test.rb | 7 +-- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/test/fixtures/scoop/diabetes_bp_map.js b/test/fixtures/scoop/diabetes_bp_map.js index cff8dd9..b5f30fe 100644 --- a/test/fixtures/scoop/diabetes_bp_map.js +++ b/test/fixtures/scoop/diabetes_bp_map.js @@ -1,12 +1,7 @@ // Supports Query Title: Diabetes & BP <= 130/80 in last yr -// Warning: Still work in progress. function map(patient) { - var targetBloodPressureCodes = { - "LOINC": ["55284-4"] - }; - var targetBloodPressureSystolicCodes = { "LOINC": ["8480-6"] }; @@ -24,8 +19,8 @@ function map(patient) { }; var ageLimit = 18; - var bpSystolicLimit = 130 - var bpDiastolicLimit = 80 + var bpSystolicLimit = 130; + var bpDiastolicLimit = 80; var resultList = patient.results(); var problemList = patient.conditions(); @@ -49,11 +44,6 @@ function map(patient) { return (patient.age(now) >= ageLimit); } - // Checks for existence of blood pressure observation - function hasBloodPressure() { - return vitalSignList.match(targetBloodPressureCodes, start, end).length; - } - // Checks for existence of systolic blood pressure observation function hasSystolicBloodPressure() { return vitalSignList.match(targetBloodPressureSystolicCodes, start, end).length; @@ -74,15 +64,23 @@ function map(patient) { return problemList.match(targetProblemCodes).length; } - - function hasBloodPressureMatchingIndicator() { - for (var i = 0; i < vitalSignList.length; i++) { - if (vitalSignList[i].includesCodeFrom(targetBloodPressureCodes) && - vitalSignList[i].values()[0].scalar() < bpSystolicLimit) { - //emit('systolic_dystolic['+i+']: '+vitalSignList[i].values()[0].scalar(), 1); - return true; - } else { - //emit('systolic_dystolic['+i+']: '+vitalSignList[i].values()[0].scalar(), 0); + function hasBloodPressureMatchingIndicators() { + for (var i = 0; i < vitalSignList.length - 1; i++) { + var bpSystolic = 0; + var bpDiastolic = 0; + if (vitalSignList[i].includesCodeFrom(targetBloodPressureSystolicCodes)) { + if (vitalSignList[i].values()[0].units() == "mm[Hg]") { + bpSystolic = vitalSignList[i].values()[0].scalar(); + //emit('systolic['+i+']: '+vitalSignList[i].values()[0].scalar(), 1); + } // TODO - assumes diastolic is next vital sign after systolic! Can we do better? + if (vitalSignList[i+1].values()[0].units() == "mm[Hg]") { + bpDiastolic = vitalSignList[i+1].values()[0].scalar(); + //emit('diastolic['+(i+1)+']: '+vitalSignList[i+1].values()[0].scalar(), 1); + } + } + if (bpSystolic > 0 && bpDiastolic > 0 && + bpSystolic < bpSystolicLimit && bpDiastolic < bpDiastolicLimit) { + return true } } return false; @@ -95,22 +93,20 @@ function map(patient) { emit(">=18_pop", 1); if (hasProblemCode()) { - emit(">=18_diabetics", 1); + emit(">=18_diabetics", 1); //+patient.given()+" "+patient.last(), 1); + if (hasBloodPressureMatchingIndicators()) { + emit(">=18_diabetics_bp130", 1); //+patient.given()+" "+patient.last(), 1); + } else { + emit(">=18_diabetics_bp130", 0); + } if(hasLabCode()) { - emit(">=18_diabetics_has_hgba1c_result", 1); - if (hasBloodPressure()) { - emit(">=18_diabetics_bp",1) - //if (hasBloodPressureMatchingIndicator()) { - // emit(">=18_diabetics_bp130",1) - //} + emit(">=18_diabetics_hgba1c", 1); //+patient.given()+" "+patient.last(), 1); + if (hasBloodPressureMatchingIndicators()) { + emit(">=18_diabetics_hgba1c_bp130", 1); //+patient.given()+" "+patient.last(), 1); } else { - emit(">=18_diabetics_bp",0) + emit(">=18_diabetics_hgba1c_bp130", 0); } - } else { - emit(">=18_diabetics_has_hgba1c_result", 0); } - } else { - emit(">=18_diabetics", 0); } } } \ No newline at end of file diff --git a/test/unit/scoop_job_test.rb b/test/unit/scoop_job_test.rb index fa08181..3c7cb36 100644 --- a/test/unit/scoop_job_test.rb +++ b/test/unit/scoop_job_test.rb @@ -254,7 +254,6 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 9, results['total_pop'] assert_equal 9, results['>19_pop'] assert_equal 1, results['>19_pop_heartrate'] - #assert_equal 2, results['>19_pop_bp'] assert_equal 2, results['>19_pop_bp_systolic'] assert_equal 2, results['>19_pop_bp_diastolic'] assert_equal 1, results['>19_pop_temperature'] @@ -276,8 +275,10 @@ class ScoopJobTest < ActiveSupport::TestCase assert_equal 9, results['total_pop'] assert_equal 9, results['>=18_pop'] assert_equal 3, results['>=18_diabetics'] - assert_equal 1, results['>=18_diabetics_has_hgba1c_result'] - assert_equal 0, results['>=18_diabetics_bp'] + assert_equal 1, results['>=18_diabetics_hgba1c'] + assert_equal 0, results['>=18_diabetics_bp130'] + assert_equal 0, results['>=18_diabetics_hgba1c_bp130'] + #assert_equal 'xyz', results end test "overweight query works properly" do From 05123cf72bd4b8fdb24f2f0ee2ad3b6f98466c14 Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Fri, 23 Aug 2013 11:48:31 -0700 Subject: [PATCH 084/205] Add regex support for target code specification --- Gemfile | 1 + Gemfile.lock | 2 +- test/fixtures/scoop/codes_with_regex_map.js | 127 ++++++++++++++++++++ test/unit/scoop_regex_test.rb | 28 +++++ 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/scoop/codes_with_regex_map.js create mode 100644 test/unit/scoop_regex_test.rb diff --git a/Gemfile b/Gemfile index 8abea82..ecf7e6a 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'delayed_job' gem 'delayed_job_mongoid' gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :branch => 'scoop-develop' +#gem 'hquery-patient-api', path: '../patientapi' gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop' gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop' #gem 'hqmf2js', path: '../hqmf2js' diff --git a/Gemfile.lock b/Gemfile.lock index 8fc1a23..faf9d88 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,7 +35,7 @@ GIT GIT remote: http://github.com/scoophealth/patientapi.git - revision: 2afc31e48f0480ca9ce16f27939a0a1a5efd153d + revision: 35340bb11c26115bd5e350ad270cb59ac1c3f56b branch: scoop-develop specs: hquery-patient-api (1.0.0) diff --git a/test/fixtures/scoop/codes_with_regex_map.js b/test/fixtures/scoop/codes_with_regex_map.js new file mode 100644 index 0000000..a82d9da --- /dev/null +++ b/test/fixtures/scoop/codes_with_regex_map.js @@ -0,0 +1,127 @@ +// Illustrates how to specify target codes containing regular expressions +// The match() and includesCodeFrom() methods need to be replaced with +// regex_match() and regex_includesCodeFrom() + +function map(patient) { + //"LOINC": ["56115-9"] + var targetWaistCircumferenceCodes = { + "LOINC": ["56115.*"] + }; + + //"LOINC": ['8302-2'] + var targetHeightCodes = { + "LOINC": ['8302-.'] + } + + // "LOINC": ["3141-9"] + var targetWeightCodes = { + "LOINC": ["3141.."] + } + + var ageLimit = 19; + + var wcLimit = 90; // waist circumference threshold (cm) + + var vitalSignList = patient.vitalSigns(); + + var now = new Date(2013, 7, 19); + var start = addDate(now, -2, 0, 0); + var end = addDate(now, 0, 0, 0); + + // Shifts date by year, month, and date specified + function addDate(date, y, m, d) { + var n = new Date(date); + n.setFullYear(date.getFullYear() + (y || 0)); + n.setMonth(date.getMonth() + (m || 0)); + n.setDate(date.getDate() + (d || 0)); + return n; + } + + // Checks if patient is older than ageLimit + function population(patient) { + return (patient.age(now) > ageLimit); + } + + + // Checks for existence of waist circumference observation + function hasWaistCircumference() { + return vitalSignList.regex_match(targetWaistCircumferenceCodes, start, end).length; + } + + function hasHeight() { + return vitalSignList.regex_match(targetHeightCodes, start, end).length; + } + + function hasWeight() { + return vitalSignList.regex_match(targetWeightCodes, start, end).length; + } + + // http://en.wikipedia.org/wiki/Body_mass_index + function calculateBMI(height, weight, metric) { + if (metric) { + bmi = weight/(height/100.0)^2; // assume cm and kg + } else { + bmi = 703 * weight /height^2; // assume in and lb + } + return bmi; + } + + function hasWaistCircumferenceIndicator() { + for (var i = 0; i < vitalSignList.length; i++) { + //if (vitalSignList[i].values()[0].units() == "cm") { + if (vitalSignList[i].regex_includesCodeFrom(targetWaistCircumferenceCodes) && + vitalSignList[i].values()[0].scalar() > wcLimit) { + return true; + } + //} + } + return false; + } + + if (hasHeight()) { + emit("hasHeight", 1); + } else { + emit("hasHeight", 0); + } + + function hasHeightWeightIndicators() { + var height = 0; + var weight = 0; + var bmi = 0; + for (var i = 0; i < vitalSignList.length; i++) { + //if (vitalSignList[i].values()[0].units() == "cm") { + if (vitalSignList[i].regex_includesCodeFrom(targetHeightCodes)) { + height = vitalSignList[i].values()[0].scalar(); + //emit("height="+height,1); + } + if (vitalSignList[i].regex_includesCodeFrom(targetWeightCodes)) { + weight = vitalSignList[i].values()[0].scalar(); + //emit("weight="+weight,1); + } + if (height != 0 && weight != 0) { + bmi = calculateBMI(height,weight,true); + //emit("bmi="+bmi,1); + return bmi > 30; + } + //} + } + return false; + } + + emit('total_pop', 1); + + if (population(patient)) { + //emit("senior_pop: " + patient.given() + " " + patient.last(), 1); + emit(">19_pop", 1); + if (hasWaistCircumference() && hasWaistCircumferenceIndicator()) { + emit(">19_pop_overweight_wc", 1); + } else { + emit(">19_pop_overweight_wc", 0) + }; + if (hasHeightWeightIndicators()) { + emit(">19_pop_bmi>30",1); + } else { + emit(">19_pop_bmi>30",0); + }; + } +} \ No newline at end of file diff --git a/test/unit/scoop_regex_test.rb b/test/unit/scoop_regex_test.rb new file mode 100644 index 0000000..25042ee --- /dev/null +++ b/test/unit/scoop_regex_test.rb @@ -0,0 +1,28 @@ +require 'test_helper' + +class ScoopRegexTest < ActiveSupport::TestCase + + setup do + dump_database + dump_jobs + Delayed::Worker.delay_jobs=false + load_scoop_database + end + + test "regex codes work properly" do + Delayed::Worker.delay_jobs=true + mf = File.read('test/fixtures/scoop/codes_with_regex_map.js') + rf = File.read('test/fixtures/scoop/scoop_general_reduce.js') + query = Query.create(map: mf, reduce: rf) + job = query.job + job.invoke_job + query.reload + results = query.result + #assert_equal 'xyz', results + assert_equal 9, results['>19_pop'] + assert_equal 0, results['>19_pop_overweight_wc'] + assert_equal 1, results['>19_pop_bmi>30'] + assert_equal 1, results['hasHeight'] + end + +end From 61ce7df34868fc0420db2d38a6aecdaeeec5a01d Mon Sep 17 00:00:00 2001 From: Raymond Rusk Date: Mon, 26 Aug 2013 10:41:57 -0700 Subject: [PATCH 085/205] Modified record saving to prevent duplicate records in mongodb --- app/controllers/records_controller.rb | 9 +++++++++ test/functional/records_controller_test.rb | 1 + 2 files changed, 10 insertions(+) diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 192dd4f..ecce924 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -12,6 +12,15 @@ def create if document_type == 'CA' pi = HealthDataStandards::Import::E2E::PatientImporter.instance patient = pi.parse_e2e(doc) + patient_id = patient.medical_record_number + # By specifying the _id field we create a new document when a record + # with that _id field doesn't already exist in the collection. If + # a record with the same _id field already exists, it is updated + # with the new document. For details see + # http://docs.mongodb.org/manual/reference/method/db.collection.save/ + if !patient_id.nil? && !patient_id.empty? + patient[:_id] = patient_id + end patient.save! render :text => 'E2E Document imported', :status => 201 # C32 diff --git a/test/functional/records_controller_test.rb b/test/functional/records_controller_test.rb index 341428b..91017a1 100644 --- a/test/functional/records_controller_test.rb +++ b/test/functional/records_controller_test.rb @@ -26,6 +26,7 @@ class RecordsControllerTest < ActionController::TestCase r = db['records'].where({:first => 'JOHN', :last => 'CLEESE'}).first assert r assert_equal -923616000, r['birthdate'] + assert_equal "000000000", r['_id'] end end From bfa461d81f95271259997c972e0d8e9ae11fa93e Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Mon, 26 Aug 2013 16:07:08 -0700 Subject: [PATCH 086/205] Updated test data with unique HINs Signed-off-by: Jeremy Ho --- test/fixtures/JOHN_CLEESE_1_25091940.xml | 6 +++--- test/fixtures/scoop-records.json | 18 +++++++++--------- test/functional/records_controller_test.rb | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml index 3699966..fa1a07c 100644 --- a/test/fixtures/JOHN_CLEESE_1_25091940.xml +++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml @@ -25,7 +25,7 @@ CDA Header PITO EMR-2-EMR Record of JOHN CLEESE - + - + @@ -62,7 +62,7 @@ CDA Header ******************************************************** --> -