Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ jobs:
- name: Run Rake test units
run: |
RUBYOPT="-W0"
bin/rails test test/unit/*.rb;
env IGNORE_ROLES=false bin/rails test test/unit/*.rb;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
- name: Run Rake test units lib
run: |
RUBYOPT="-W0"
bin/rails test test/unit/lib/*.rb;
env IGNORE_ROLES=false bin/rails test test/unit/lib/*.rb;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand All @@ -282,7 +282,7 @@ jobs:
- name: Run Rake test units lib cypress
run: |
RUBYOPT="-W0"
bin/rails test test/unit/lib/cypress/*.rb;
env IGNORE_ROLES=false bin/rails test test/unit/lib/cypress/*.rb;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand All @@ -291,7 +291,7 @@ jobs:
- name: Run Rake test units lib validators
run: |
RUBYOPT="-W0"
bin/rails test test/unit/lib/validators/*.rb;
env IGNORE_ROLES=false bin/rails test test/unit/lib/validators/*.rb;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand All @@ -300,7 +300,7 @@ jobs:
- name: Run Rake test models
run: |
RUBYOPT="-W0"
bin/rails test test/models;
env IGNORE_ROLES=false bin/rails test test/models;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -340,7 +340,7 @@ jobs:
- name: Run Rake test:jobs
run: |
RUBYOPT="-W0"
bundle exec rake test:jobs;
env IGNORE_ROLES=false bundle exec rake test:jobs;
- name: Upload code jobs coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand All @@ -349,7 +349,7 @@ jobs:
- name: Run Rake test:helpers
run: |
RUBYOPT="-W0"
bundle exec rake test:helpers;
env IGNORE_ROLES=false bundle exec rake test:helpers;
- name: Upload code helpers coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand All @@ -358,7 +358,7 @@ jobs:
- name: Run Rake test:controllers
run: |
RUBYOPT="-W0"
bundle exec rake test:controllers;
env IGNORE_ROLES=false bundle exec rake test:controllers;
- name: Upload controllers code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -398,7 +398,7 @@ jobs:
- name: Run Rake test
run: |
RUBYOPT="-W0"
bundle exec rake test:integration;
env IGNORE_ROLES=false bundle exec rake test:integration;
- name: Upload code coverage to codecov.io
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def measures_for_source

{ label: label_str, value: val }
end
end.flatten.to_json.html_safe
end.flatten.to_json
end
end
end
46 changes: 12 additions & 34 deletions app/javascript/controllers/measure_search_controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Controller } from "@hotwired/stimulus";
import $ from "jquery2";
import "jquery-ui";

// Connects data-controller="measure-search"
export default class extends Controller {
static targets = ["input"];
static targets = ["input", "allRecordsTemplate"];
static values = {
// JSON array for jQueryUI autocomplete source
source: String,
Expand All @@ -23,49 +21,29 @@ export default class extends Controller {
}

initializeAutocomplete() {
const $input = $(this.inputTarget);

const $ = window.jQuery;
let source = [];
try {
source = JSON.parse(this.sourceValue || "[]");
} catch (e) {
console.error("Bad source JSON", this.sourceValue, e);
}

$(document).ready(function () {
$input.autocomplete({
delay: 500,
source: this.sourceValue,
select: (event, data) => {
$.get(data.item.value);
event.preventDefault();
},
focus: (event) => event.preventDefault,
});
var availableTags = [{"label":"CMS349v7: HIV Screening","value":"/bundles/66797c1bdfe4bd02748db95e/records/by_measure?measure_id=2C928083-8907-CE68-0189-0DA36CC00327\u0026pop_set_key=PopulationSet_1"}];
$( "#search_measures" ).autocomplete({
delay: 500,
source: source,
select: (event, data) => {
$.get(data.item.value);
event.preventDefault();
},
focus: (event) => event.preventDefault
});

const ac = $input.data("ui-autocomplete");
if (!ac) return;

ac._renderItem = function (ul, item) {
return $('<li class="list-group-item">').append(item.label).appendTo(ul);
};

ac._renderMenu = function (ul, items) {
const that = this;
$.each(items, function (_index, item) {
this._renderItemData(ul, item);
});
$(ul).removeClass("ui-widget ui-widget-content").addClass("list-group");
};
}

bindKeyup() {
$(this.inputTarget).on("keyup.measureSearch", () => {
if (!$(this.inputTarget).val()) {
$("#records_list").html(this.allRecordsHtmlValue);

if ($.rails?.refreshCSRFTokens) $.rails.refreshCSRFTokens();
$("#records_list").html(this.allRecordsTemplateTarget.innerHTML);
}
});
}
Expand Down
27 changes: 13 additions & 14 deletions app/views/records/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,7 @@
<div
class="form-group"
data-controller="measure-search"
data-measure-search-source-value="<%= json_escape(@measure_dropdown.to_json) %>"
data-measure-search-all-records-html-value="<%= json_escape(
render(
'records_list',
patients: @patients,
measure: @measure,
population_set_hash: @population_set_hash,
product_test: @product_test,
bundle: @bundle,
task: @task,
vendor: @vendor
)
) %>"
>
data-measure-search-source-value="<%= ERB::Util.json_escape(@measure_dropdown) %>">
<label for="search_measures">Type to search by measure</label>
<input
id="search_measures"
Expand All @@ -59,6 +46,18 @@
placeholder="Type the name or CMS ID of a measure"
data-measure-search-target="input"
/>
<template data-measure-search-target="allRecordsTemplate">
<%= render(
"records_list",
patients: @patients,
measure: @measure,
population_set_hash: @population_set_hash,
product_test: @product_test,
bundle: @bundle,
task: @task,
vendor: @vendor
) %>
</template>
</div>
</div>
<% if !@task && !@product_test %>
Expand Down
5 changes: 2 additions & 3 deletions features/step_definitions/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@
end

And(/^the user selects a measure from the dropdown$/) do
byebug
page.execute_script "$('#search_measures').trigger('focus')"
page.execute_script "$('#search_measures').trigger('keydown')"
assert page.has_selector?('.ui-autocomplete .list-group-item'), 'no dropdown result'
assert page.has_selector?('.ui-autocomplete .ui-menu-item'), 'no dropdown result'

page.find('.ui-autocomplete .list-group-item', match: :first).click
page.find('.ui-autocomplete .ui-menu-item', match: :first).click
end

Then(/^the user should see results for that measure$/) do
Expand Down
1 change: 0 additions & 1 deletion features/step_definitions/record_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# T H E N #

Then(/^the user should see calculation results$/) do
byebug
page.assert_text('Template Name')
page.assert_text('IPOP')
page.assert_selector('span.result-marker')
Expand Down
Binary file modified test/fixtures/bundles/minimal_bundle_qdm_5_6.zip
Binary file not shown.
12 changes: 6 additions & 6 deletions test/helpers/test_executions_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ def test_padding_cms_id
end

def test_ecqi_link
# test with a measure from the 2023 reporting period
bundle2022 = Bundle.create(version: '2022.5.0')
measure2022 = Measure.create(reporting_program_type: 'ep', cms_id: 'CMS161v11', bundle_id: bundle2022.id)
ecqi_url2022 = ecqi_link(measure2022.cms_id)
ecqi_request2022 = RestClient::Request.execute(method: :get, url: ecqi_url2022)
assert_equal 200, ecqi_request2022.code
# test with a measure from the 2025 reporting period
bundle2024 = Bundle.create(version: '2024.5.0')
measure2024 = Measure.create(reporting_program_type: 'ep', cms_id: 'CMS128v13', bundle_id: bundle2024.id)
ecqi_url2024 = ecqi_link(measure2024.cms_id)
ecqi_request2024 = RestClient::Request.execute(method: :get, url: ecqi_url2024)
assert_equal 200, ecqi_request2024.code
end
end
4 changes: 2 additions & 2 deletions test/unit/lib/cypress/cql_bundle_importer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CqlBundleImporterTest < ActiveSupport::TestCase
Cypress::CqlBundleImporter.import(bundle_zip, Tracker.new)
assert_equal (before_measure_count + 2), Measure.count
# 21 valuesets from csv file, 3 direct reference codes
assert_equal (before_value_set_count + 25), ValueSet.count
assert_equal (before_value_set_count + 27), ValueSet.count
assert_equal (before_patient_count + 1), Patient.count
# only 2 individual results are saved
assert_equal (before_results_count + 2), IndividualResult.count
Expand All @@ -46,7 +46,7 @@ class CqlBundleImporterTest < ActiveSupport::TestCase
Cypress::CqlBundleImporter.import(bundle_zip, Tracker.new, include_highlighting: true)
assert_equal (before_measure_count + 2), Measure.count
# 21 valuesets from csv file, 3 direct reference codes
assert_equal (before_value_set_count + 25), ValueSet.count
assert_equal (before_value_set_count + 27), ValueSet.count
assert_equal (before_patient_count + 1), Patient.count
# only 2 individual results are saved
assert_equal (before_results_count + 2), IndividualResult.count
Expand Down