Skip to content

Commit

Permalink
merge updated gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ssayer committed Jun 5, 2012
2 parents f758be9 + d784485 commit 0ae51f0
Show file tree
Hide file tree
Showing 32 changed files with 302 additions and 138 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: ruby
rvm:
- 1.9.2
script: ./.travis/execute.sh

notifications:
email:
recipients:
- [email protected]
on_failure: change

branches:
only:
- master
- develop

2 changes: 2 additions & 0 deletions .travis/execute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cp ./.travis/mongoid.yml ./config/mongoid.yml
bundle exec rake test
20 changes: 20 additions & 0 deletions .travis/mongoid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Mongoid Configuration for Travis CI
# ===================================
#

defaults: &defaults
host: localhost
port: 27017

development:
<<: *defaults
database: pophealth-development

test:
<<: *defaults
database: pophealth-test

production:
<<: *defaults
database: pophealth-production

4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ gem 'rails', '3.1.0'
gem 'rack' , '1.3.3'

gem 'quality-measure-engine', '1.1.3'
# gem 'quality-measure-engine', :git => 'http://github.com/pophealth/quality-measure-engine.git', :branch => 'develop'
# gem 'quality-measure-engine', :git => 'http://github.com/pophealth/quality-measure-engine.git', :branch => 'master'
gem 'health-data-standards', '0.8.1'
# gem 'health-data-standards', :git => 'https://github.com/projectcypress/health-data-standards.git', :branch => 'develop'
# gem 'health-data-standards', :git => 'https://github.com/projectcypress/health-data-standards.git', :branch => 'master'

gem 'nokogiri'
gem 'rubyzip'
Expand Down
15 changes: 7 additions & 8 deletions app/assets/javascripts/dashboard.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
return $("tr.measure[data-measure='#{measure}']")
fadeIn: (measure) ->
Dashboard.measureRows(measure).fadeTo("fast", 0.5)
$.post("/measure/#{measure}/select", {})
$.post("#{rootContext}/measure/#{measure}/select", {})
fadeOut: (measure) ->
Dashboard.measureRows(measure).fadeOut("fast")
$.post("/measure/#{measure}/remove", {})
$.post("#{rootContext}/measure/#{measure}/remove", {})
calculateSelected: ->
$(".measureProviderPopulationPercentage").html("<div><div class='jobLabel'></div><img src='/assets/loading.gif'/></div>")
$(".measureProviderPopulationPercentage").html("<div><div class='jobLabel'></div><img src='#{rootContext}/assets/loading.gif'/></div>")
$(".numeratorValue").html('0')
$(".denominatorValue").html('0')
$("div.measureItemList ul li.checked").each (i, m) ->
Expand Down Expand Up @@ -79,24 +79,23 @@
providerParams = ''
if (providers['provider[]'])
providerParams = "&#{$.param(providers)}"
window.location.href="/measures/measure_report.xml?type=#{type}#{providerParams}"
window.location.href="#{rootContext}/measures/measure_report.xml?type=#{type}#{providerParams}"

changeMeasurePeriod: ->
effective_date = $('#measurementPeriodEndDate').val();
period = {"effective_date": effective_date, "persist": true};
npi = $(this).data('npi')
$.post("/measures/period", {"effective_date": effective_date, "persist": true}, (data) ->
$.post("#{rootContext}/measures/period", {"effective_date": effective_date, "persist": true}, (data) ->
$('#measurementPeriodStartDate').text(data.start)
npiParam = ''
npiParam = "?npi=#{npi}" if (npi)
window.location.href="/measures"+npiParam
window.location.href="#{rootContext}/measures"+npiParam
, 'json')

updatePeriodEnd: (selected) ->
effective_date = $('#measurementPeriodEndDate').val();
$.post("/measures/period", {"effective_date": effective_date, "persist": false}, (data) ->
$.post("#{rootContext}/measures/period", {"effective_date": effective_date, "persist": false}, (data) ->
$('#measurementPeriodStartDate').text(data.start)
# window.location.href="/measures"
, 'json')


Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/pophealth.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class @QualityReport
@sub_id or= null
@filters or= ActiveFilters.all()
url: ->
base = "/measure/#{@measure}"
base = "#{rootContext}/measure/#{@measure}"
if @sub_id? then "#{base}/#{@sub_id}" else base
fetch: (extraParams, callback) ->
params = $.extend({}, @filters, extraParams)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/providers.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Providers.isLoading()
$('#measurePopulationPercentage').text('failed')
updateProviders: (current_measure, sub_id) ->
$(".measureProviderPopulationPercentage").html("<div><div class='jobLabel'></div><img src='/assets/loading.gif'/></div>")
$(".measureProviderPopulationPercentage").html("<div><div class='jobLabel'></div><img src='#{rootContext}/assets/loading.gif'/></div>")
$(".numeratorValue").html('0')
$(".denominatorValue").html('0')
pr = new ProvidersReport(current_measure, sub_id)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/vtip.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ this.vtip = function() {

$('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );

$('p#vtip #vtipArrow').attr("src", '/assets/vtip_arrow.png');
$('p#vtip #vtipArrow').attr("src", rootContext + '/assets/vtip_arrow.png');
$('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");

}
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base
include Breadcrumbs
layout :layout_by_resource
before_filter :set_effective_date
before_filter :check_ssl_used

add_breadcrumb APP_CONFIG['practice_name'], :root_url

Expand All @@ -14,7 +15,7 @@ class ApplicationController < ActionController::Base

# Overwriting the sign_out redirect path method
def after_sign_out_path_for(resource_or_scope)
'/logout.html'
"#{Rails.configuration.relative_url_root}/logout.html"
end

def hash_document
Expand Down Expand Up @@ -54,4 +55,10 @@ def set_effective_date(effective_date=nil, persist=false)
def calc_start(date)
3.months.ago(Time.at(date))
end

def check_ssl_used
unless APP_CONFIG['force_unsecure_communications'] or request.ssl?
redirect_to "#{root_url}no_ssl_warning.html", :alert => "You should be using ssl"
end
end
end
8 changes: 4 additions & 4 deletions app/controllers/measures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class MeasuresController < ApplicationController
before_filter :set_up_environment
after_filter :hash_document, :only => :measure_report

add_breadcrumb_dynamic([:selected_provider], only: %w{index show patients}) {|data| provider = data[:selected_provider]; {title: (provider ? provider.full_name : nil), url: "/?npi=#{(provider) ? provider.npi : nil}"}}
add_breadcrumb_dynamic([:selected_provider], only: %w{index show patients}) {|data| provider = data[:selected_provider]; {title: (provider ? provider.full_name : nil), url: "#{Rails.configuration.relative_url_root}/?npi=#{(provider) ? provider.npi : nil}"}}
add_breadcrumb_dynamic([:definition], only: %w{providers}) do|data|
measure = data[:definition];
if measure
{title: "#{measure['endorser']}#{measure['id']}" + (measure['sub_id'] ? "#{measure['sub_id']}" : ''), url: "/measure/#{measure['id']}"+(measure['subid'] ? "/#{measure['sub_id']}" : '')+"/providers"}
{title: "#{measure['endorser']}#{measure['id']}" + (measure['sub_id'] ? "#{measure['sub_id']}" : ''), url: "#{Rails.configuration.relative_url_root}/measure/#{measure['id']}"+(measure['subid'] ? "/#{measure['sub_id']}" : '')+"/providers"}
else
{}
end
end
add_breadcrumb_dynamic([:definition, :selected_provider], only: %w{show patients}) {|data| measure = data[:definition]; provider = data[:selected_provider]; {title: "#{measure['endorser']}#{measure['id']}" + (measure['sub_id'] ? "#{measure['sub_id']}" : ''), url: "/measure/#{measure['id']}"+(measure['subid'] ? "/#{measure['sub_id']}" : '')+(provider ? "?npi=#{provider.npi}" : "/providers")}}
add_breadcrumb_dynamic([:definition, :selected_provider], only: %w{show patients}) {|data| measure = data[:definition]; provider = data[:selected_provider]; {title: "#{measure['endorser']}#{measure['id']}" + (measure['sub_id'] ? "#{measure['sub_id']}" : ''), url: "#{Rails.configuration.relative_url_root}/measure/#{measure['id']}"+(measure['subid'] ? "/#{measure['sub_id']}" : '')+(provider ? "?npi=#{provider.npi}" : "/providers")}}
add_breadcrumb 'parameters', '', only: %w{show}
add_breadcrumb 'patients', '', only: %w{patients}

Expand Down Expand Up @@ -241,7 +241,7 @@ def generate_xml_report(provider, selected_measures, provider_report=true)

selected_measures.each do |measure|
subs_iterator(measure['subs']) do |sub_id|
report[:results] << extract_result(measure['id'], sub_id, @effective_date, (provider_report) ? [provider ? provider.id.to_s : nil] : nil)
report[:results] << extract_result(measure['id'], sub_id, @effective_date, ((provider_report) ? [provider ? provider.id.to_s : nil] : nil))
end
end
report
Expand Down
23 changes: 0 additions & 23 deletions app/controllers/patients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,6 @@ class PatientsController < ApplicationController
after_filter :hash_document, :only => :list

add_breadcrumb_dynamic([:patient], only: %w{show}) {|data| patient = data[:patient]; {title: "#{patient.last}, #{patient.first}", url: "/patients/show/#{patient.id}"}}

def list
measure_id = params[:id]
sub_id = params[:sub_id]
@records = mongo['patient_cache'].find({'value.measure_id' => measure_id, 'value.sub_id' => sub_id,
'value.effective_date' => @effective_date}).to_a
# log the medical_record_number of each of the patients that this user has viewed
@records.each do |patient_container|
authorize! :read, patient_container
Log.create(:username => current_user.username,
:event => 'patient record viewed',
:medical_record_number => (patient_container['value'])['medical_record_id'])
end
respond_to do |format|
format.xml do
headers['Content-Disposition'] = 'attachment; filename="excel-export.xls"'
headers['Cache-Control'] = ''
render :content_type => "application/vnd.ms-excel"
end

format.html {}
end
end

def show
@outliers = []
Expand Down
57 changes: 8 additions & 49 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class ProvidersController < ApplicationController
load_resource except: %w{index}
authorize_resource
before_filter :authenticate_user!
before_filter :provider_list, except: 'measure'

add_breadcrumb 'providers', :providers_url

Expand Down Expand Up @@ -42,9 +41,14 @@ def edit
def create
@provider = Provider.create(params[:provider])
@providers = Provider.alphabetical.page(params[:page]).per(20)

respond_to do |wants|
wants.js {}
wants.json {
# @provider = Provider.create(params[:data])
render json: @provider
}
wants.js { }
wants.html { }
end
end

Expand All @@ -68,50 +72,5 @@ def merge
@provider.save!
redirect_to :action => :show
end

def measure
@selected_providers = Provider.selected_or_all(params[:selected_provider_ids]).alphabetical
@selected_races = (params[:selected_race_ids] && !params[:selected_race_ids].empty?) ? Race.selected(params[:selected_race_ids]).ordered : []
@selected_genders = (params[:selected_genders] && !params[:selected_genders].empty?) ? params[:selected_genders] : []
@definition = QME::QualityMeasure.new(params[:measure_id], params[:sub_id]).definition
calculate_measure_for_selected(@definition["id"], @definition['sub_id'], providers: @selected_providers, races: @selected_races, genders: @selected_genders)
respond_to do |wants|
wants.html do
@teams = Team.alphabetical
@races = Race.ordered
@genders = [{name: 'Male', key: 'M'}, {name: 'Female', key: 'F'}]
end

wants.json do
complete = @provider_job_uuids.empty? && @aggregate_quality_report_uuid.nil?
render json: {aggregate: @aggregate_quality_report.result, providers: @provider_reports, aggregate_job: @aggregate_quality_report_uuid, provider_jobs: @provider_job_uuids, :complete => complete}.to_json
end
end
end

private

def provider_list
@providers = Provider.alphabetical unless request.xhr?
end

def calculate_measure_for_selected(measure_id, sub_id, filters)
@provider_job_uuids = {}
@aggregate_quality_report = calculate_measure(measure_id, sub_id, filters)
@aggregate_quality_report_uuid = @aggregate_quality_report.calculate unless @aggregate_quality_report.calculated?
@provider_reports = {}
filters[:providers].each do |provider|
provider_filters = filters.clone
provider_filters[:providers] = [provider]
report = calculate_measure(measure_id, sub_id, provider_filters)
@provider_job_uuids[provider.id] = report.calculate unless report.calculated?
@provider_reports[provider.id] = report.result
end
end

def calculate_measure(measure_id, sub_id, filters)
QME::QualityReport.new(measure_id, sub_id, 'effective_date' => @effective_date, 'filters' => {'providers' => filters[:providers].map { |pv| pv.id.to_s }, 'races'=>filters[:races].map {|value| value.flatten(:race)}.flatten, 'ethnicities'=>filters[:races].map {|value| value.flatten(:ethnicity)}.flatten, 'genders'=>filters[:genders]})
end


end
end
29 changes: 29 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ class User
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:username]


## Database authenticatable
field :encrypted_password, :type => String, :null => false

## Recoverable
field :reset_password_token, :type => String
field :reset_password_sent_at, :type => Time

## Rememberable
field :remember_created_at, :type => Time

## Trackable
field :sign_in_count, :type => Integer
field :current_sign_in_at, :type => Time
field :last_sign_in_at, :type => Time
field :current_sign_in_ip, :type => String
field :last_sign_in_ip, :type => String


:remember_created_at
:reset_password_token
:reset_password_sent_at
:sign_in_count
:current_sign_in_at
:last_sign_in_at
:current_sign_in_ip
:last_sign_in_ip
:effective_date

field :first_name, type: String
field :last_name, type: String
field :username, type: String
Expand Down
11 changes: 11 additions & 0 deletions app/views/admin/patients.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

<tr><td>patients loaded: </td>
<td>
<%= @provider_count%> patients
<%= form_tag("/admin/remove_providers", :method => "delete") do %>
<%= submit_tag("Delete Providers") %>
<% end %>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

<tr><td colspan="2">&nbsp;</td></tr>

<tr><td>Upload patient zip file: </td>
Expand Down
11 changes: 8 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
sessionAlive: false,
alive_url: '/',
redirect_url: '<%= destroy_user_session_path %>',
logout_url: '/logout.html'
logout_url: '<%=Rails.configuration.relative_url_root%>/logout.html'
});
});

Expand All @@ -36,10 +36,15 @@

<% if @definition %>
<script type="text/javascript" charset="utf-8">
currentMeasure = "<%= @definition['id'] %>"
subMeasure = "<%= @definition['sub_id'] %>"
currentMeasure = "<%= @definition['id'] %>";
subMeasure = "<%= @definition['sub_id'] %>";

</script>
<% end %>

<script type="text/javascript" charset="utf-8">
rootContext = "<%= Rails.configuration.relative_url_root %>";
</script>
</head>
<body>

Expand Down
2 changes: 1 addition & 1 deletion app/views/measures/_measure.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% subs_iterator(measure['subs']) do |sub| %>
<tr style="<%=display_row(measure['id'], current_user.selected_measures)%>" data-measure="<%=measure['id']%>" data-measure-sub="<%= sub %>" class="measure">
<% if sub.nil? || sub == 'a' %>
<td class="name"><%= (can? :manage, :providers) ? link_to(raw("<span title='#{measure['description']}' class='vtip'>#{measure['name']}</span>"), "#{measure_path(measure['id'], sub)}/providers") : "#{measure['id']}: #{measure['name']}" %></td>
<td class="name"><%= (can? :manage, :providers) ? link_to(raw("<span title='#{measure['description']}' class='vtip'>#{measure['name']}</span>"), "#{measure_path(measure['id'], sub)}/providers") : raw("<span title='#{measure['description']}' class='vtip'>#{measure['id']}: #{measure['name']}</span>") %></td>
<% else %>
<td class="name" />
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/measures/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<div class="clear"></div>
<div class="dashboardTabs">
<span class="dashboardTab active">Measures</span>
<span class="dashboardTab">Comparison</span>
<!-- <span class="dashboardTab">Comparison</span> -->
</div>
<div class="legend">
<div class="numerator"></div><span>numerator</span>
Expand Down
Loading

0 comments on commit 0ae51f0

Please sign in to comment.