Permalink
Browse files

Adding back in the first test

  • Loading branch information...
1 parent b60734c commit a9fc168f0320acaed4b226f6b3a4d2381f1b8550 @eedrummer eedrummer committed Oct 16, 2012
View
@@ -1,7 +1,8 @@
PATH
remote: .
specs:
- quality-measure-engine (0.0.1)
+ quality-measure-engine (2.0.0)
+ moped (~> 1.2.7)
redis (~> 3.0.2)
resque (~> 1.23.0)
resque-status (~> 0.3.3)
@@ -11,6 +12,8 @@ GEM
specs:
macaddr (1.6.1)
systemu (~> 2.5.0)
+ minitest (4.1.0)
+ moped (1.2.7)
multi_json (1.3.6)
rack (1.4.1)
rack-protection (1.2.0)
@@ -45,4 +48,5 @@ PLATFORMS
ruby
DEPENDENCIES
+ minitest (~> 4.1.0)
quality-measure-engine!
View
@@ -1 +1,8 @@
require "bundler/gem_tasks"
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.libs << "test"
+ t.test_files = FileList['test/**/*_test.rb']
+ t.verbose = true
+end
@@ -1,5 +1,10 @@
require "bundler/setup"
+require 'redis'
+require 'resque'
+require 'resque-status'
+require 'moped'
+
require "qme/version"
require 'qme/database_access'
require 'qme/quality_measure'
@@ -0,0 +1,52 @@
+{
+ "id": "0043",
+ "name": "Pneumonia Vaccination Status for Older Adults",
+ "description": "Patients more than 65 years old who received a pneumococcal vaccine.",
+ "category": "Miscellaneous",
+ "steward": "NCQA",
+ "parameters": {
+ "effective_date": {
+ "description": "Effective end date for measure",
+ "type": "number",
+ "format": "utc-sec"
+ }
+ },
+ "patient":
+ {
+ "birthdate":
+ {
+ "description": "Date of birth",
+ "critical": true,
+ "standard_category": "characteristic",
+ "type":"number",
+ "format": "utc-sec",
+ "codes":
+ [
+ {
+ "set": "HL7",
+ "version": "3.0",
+ "values": ["00110"]
+ }
+ ]
+ }
+ },
+ "measure":
+ {
+ },
+ "population":
+ {
+ "category": "Patient Characteristic",
+ "title": "Age >= 64"
+ },
+ "denominator":
+ {
+ "category": "Outpatient Encounter",
+ "title": "Within a year"
+ },
+ "numerator":
+ {
+ "category": "Medication Administered",
+ "title": "Pneumococcal vaccination"
+ },
+ "exclusions": {}
+}
View
@@ -0,0 +1,2 @@
+require 'minitest/autorun'
+require 'quality-measure-engine'
@@ -0,0 +1,30 @@
+require 'test_helper'
+
+class MapReduceBuilderTest < MiniTest::Unit::TestCase
+ include QME::DatabaseAccess
+
+ def setup
+ raw_measure_json = File.read(File.join('test', 'fixtures', 'measures', 'measure_metadata.json'))
+ @measure_json = JSON.parse(raw_measure_json)
+ end
+
+ def test_extracting_measure_metadata
+ measure = QME::MapReduce::Builder.new(get_db(), @measure_json, 'effective_date' => Time.gm(2010, 9, 19).to_i)
+ assert_equal '0043', measure.id
+ end
+
+ def test_extracting_parameters
+ time = Time.gm(2010, 9, 19).to_i
+ measure = QME::MapReduce::Builder.new(get_db(), @measure_json, 'effective_date'=>time)
+ assert_equal 1, measure.params.size
+ assert measure.params.keys.include?('effective_date')
+ assert_equal time, measure.params['effective_date']
+ end
+
+ def test_raise_error_when_no_params_provided
+ rte = assert_raises(RuntimeError) do
+ QME::MapReduce::Builder.new(get_db(), @measure_json, {})
+ end
+ assert_equal "No value supplied for measure parameter: effective_date", rte.message
+ end
+end

0 comments on commit a9fc168

Please sign in to comment.