delayed job execution - failed with error 16722: "exception: SyntaxError: Unexpected token ;"

We are gettng this error while running delayed job execution. We believe the because of this the measures are not getting populated.

Please advice.

Zohair

 

 

like0

Comments

Dataset and Version?

Peter Li's picture

Hi Zohair,

Can you provide more information associated with your setup, in particular;

- PopHealth version that you are using

- Description of Dataset that you have imported into the popHealth which you have encounted the error, i.e., format, etc.

- Did you run the Cypress dataset as a test? Did it run correctly?

Thanks.

like0

error 16722: "exception: SyntaxError: Unexpected token

Peter Li's picture

Hi Zohair,

dMahesh just posted a comment on the OSEHRA popHealth Github issues area - see view it on GitHub

Here is excerpt:

I have followed the latest installation instructions to the letter, and I am running into the #39 issue with delayed job execution - failed with error 16722: "exception: SyntaxError: Unexpected token ;"

Downgrading fixed the issue, so I believe this is a problem somewhere between the current popHealth source code, the gem versions it uses, and the version of the measures bundle that gets imported.

Here is what fixed the issue for me:

git reset --hard eb00169
delete all gems and do bundle install again
drop all dbs in mongo
download an older bundle (2.4.0): curl -u NLM_USERNAME:NLM_PASSWORD http://demo.projectcypress.org/bundles/bundle-2.4.0.zip -o ../bundle-2.4.0.zip
re-import this older bundle: bundle exec rake bundle:import[../bundle-2.4.0.zip,false,false,'*',true,true]
Please try installing using the latest instructions and you are guaranteed to reproduce this error.

Let me know if this is the same issue that you are facing.

Peter

like0

Hi Zohair, This error might

Sabbir Siddiqui's picture

Hi Zohair,

This error might be a bug with the quality measure engine gem. Which version of QME are you using? 

In the Gemfile, try changing the 'quality-measure-engine' gem to the '3.1.0' version, do a bundle install, and restart the server and the delayed jobs. 

Thanks,

Sabbir Siddiqui

like0

NameError (uninitialized constant Moped::BSON):

zohair Hussain's picture
Now we are getting this error while we are starting the site. 
 
bundle exec rails s
 
 
 
=> Rails 4.1.5 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
 
 
Started GET "/" for 172.16.194.100 at 2015-01-15 11:56:25 -0500
Processing by HomeController#index as HTML
Completed 500 Internal Server Error in 46ms
 
NameError (uninitialized constant Moped::BSON):
  app/controllers/application_controller.rb:39:in `set_effective_date'
 
 
  Rendered /usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.8ms)
  Rendered /usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (10.3ms)

Zohair..

like0

re: NameError (uninitialized constant Moped::BSON)

Sabbir Siddiqui's picture

Hi Zohair,

This might be a cache issue. Try closing and reopening the browser, then try again.

Sabbir Siddiqui

like0

Let me try that

zohair Hussain's picture

Let me try that Sabbir,

thanks once again.

like0

failed with error 16722: "exception: SyntaxError: Unexpected tok

zohair Hussain's picture

ok the site is working now but we still not able to fix this error.

we checked version for Gem - quality-measure-engine and it is showing 3.1.0

health-data-standard - 3.5.0

hquery-patient-api - 1.0.4

 

Pls advice

 

 

 

 

 

 

 

like0

Zohair, Which code base are

Sabbir Siddiqui's picture

Zohair,

Which code base are you using for pophealth?

like0

we are using pophealth verson

zohair Hussain's picture

we are using pophealth verson 3.0 and bundle 2.5.0.

 

this is the comand we are using

git clone https://github.com/pophealth/pophealth.git

cd pophealth

bundle install

thanks

Zohair

 

 

 

like0

Zohair, Did you use a fresh

Sabbir Siddiqui's picture

Zohair,

Did you use a fresh database for importing the old bundle?

Try using a fresh database, and redo the rake tasks with the proper environment. 

1. open the mongo console and drop the pophealth development database

2. return to step 7 in the installation wiki. Remember to use bundle-2.4.0. Add the highlighted part to indicate the environment when running the bundle import 

  • bundle exec rake bundle:import[/home/pophealth/bundle-2.4.0.zip,false,false,'*',true,true] RAILS_ENV=development

3. create admin account

  • bundle exec rake admin:create_admin_account RAILS_ENV=development

4. seed the db

  • bundle exec rake db:seed RAILS_ENV=development

5. bundle exec rake jobs:work RAILS_ENV=development

Then restart the rails server, and it should work. 

like0

Zohair, Did you use a fresh

Sabbir Siddiqui's picture

Zohair,

Did you use a fresh database for importing the old bundle?

Try using a fresh database, and redo the rake tasks with the proper environment. 

1. open the mongo console and drop the pophealth development database

2. return to step 7 in the installation wiki. Remember to use bundle-2.4.0. Add the highlighted part to indicate the environment when running the bundle import 

  • bundle exec rake bundle:import[/home/pophealth/bundle-2.4.0.zip,false,false,'*',true,true] RAILS_ENV=development

3. create admin account

  • bundle exec rake admin:create_admin_account RAILS_ENV=development

4. seed the db

  • bundle exec rake db:seed RAILS_ENV=development

5. bundle exec rake jobs:work RAILS_ENV=development

Then restart the rails server, and it should work. 

like0

Thanks Sabbir we  what you

zohair Hussain's picture

Thanks Sabbir

we  what you suggested. It seems the error is gone no from job worker screen. We imported our patient and

select few measure. Now the job worker is on MapReduce: MeasureCaculationJob (id = 54b....) running.

Is it what it is suppose to do? nothing is happening on measure screen.

Zohair

 

like0

Sabbir, Finally it started to

zohair Hussain's picture

Sabbir,

Finally it started to calculate the measures and showing it under measure screen.

Measure 117 Childhood immunization is not getting calculated. I know that there is some patients for this measure. Any Advice.

 

Also , multiple occations while running worker, MongoDB gets locked and then our worker screen and popHeath site gets freeze.

Thanks for all your help.

like0

Unfortunately I don't

Ben West's picture

Unfortunately I don't remember the exact solutions to those problems, but wanted to give a +1 to see if anyone has good ways of debugging these sorts of things. Mongo's tools are extremely limited, and because the map reduce code is automatically generated (and huge) the standard solution of putting print statements in everywhere is really obnoxious.

like0

(Besides the stuff you can

Ben West's picture

(Besides the stuff you can set in pophealth.yml)

like0

How can we change the measure

zohair Hussain's picture

How can we change the measure id's in pophealth? Cyress is giving us error while validating QRDA 3 file generated from pophealth. ( ID for DENOM, DEXEX....)..is there any config file where we can change those ID's?

We believe it is throwing error because the cypress bundle is 2.5 and in pophealth we used 2.4.

 

thanks

Zohair

 

 

 

like0

Hi, Same error was coming to

Suresh Kumar Reddy M's picture

Hi,

Same error was coming to me. I could able to solve it by addiing short_circuit parameter for calcualte method in app/controllers/api/queries_controller.rb file.

Along with enable_rationale and eable_logging passed short_circuit as false.

I am also stuck with CMS117 Childhood Immunization issue what Zohair as mentioned. 

Zohair is your problem solved. If solved please update how the issue is solved.

 

Thanks,

Suresh

 

 

 

 

like0

Hi Suresh CMS 117 still does

zohair Hussain's picture

Hi Suresh

CMS 117 still does not show anyting in popheath. There are many others which which show 0 populatons and does not calculate measure properly.

We are using budle 2.4 as the latest budle errors out.

like0

Is it posibl for you to share

zohair Hussain's picture

Is it posibl for you to share queries_controller.rb file to the group?

thanks

like0

Thanks for the reply Zohair.

Suresh Kumar Reddy M's picture

Thanks for the reply Zohair. I couldn't find option to attach file. I have pasted the content. You can add below entry in  config/popHealth.yml incase you want to override the default.

config/popHealth.yml

enable_map_reduce_short_circuit: false

 

queries_controller.rb

#########################################

module Api

  class QueriesController  < ApplicationController
    resource_description do
      short 'Queries'
      formats ['json']
      description <<-QCDESC
        This resource is responsible for managing clinical quality measure calculations. Creating a new query will kick
        off a new CQM calculation (if it hasn't already been calculated). You can determine the status of ongoing
        calculations, force recalculations and see results through this resource.
      QCDESC
    end
    include PaginationHelper
    skip_authorization_check
    before_filter :authenticate_user!
    before_filter :set_pagination_params, :only=>[:patient_results, :patients]
 
    def index
      filter = {}
      filter["hqmf_id"] = {"$in" => params["measure_ids"]} if params["measure_ids"]
      providers = collect_provider_id
      filter["filters.providers"] = {"$in" => providers} if providers
      render json: QME::QualityReport.where(filter)
    end
 
    api :GET, '/queries/:id', "Retrieve clinical quality measure calculation"
    param :id, String, :desc => 'The id of the quality measure calculation', :required => true
    example '{"DENEX":0,"DENEXCEP":0,"DENOM":5,"IPP":5,"MSRPOPL":0,"NUMER":0,  "status":{"state":"completed", ...}, ...}'
    description "Gets a clinical quality measure calculation. If calculation is completed, the response will include the results."
    def show
      @qr = QME::QualityReport.find(params[:id])
      authorize! :read, @qr
      render json: @qr
    end
 
    api :POST, '/queries', "Start a clinical quality measure calculation"
    param :measure_id, String, :desc => 'The HQMF id for the CQM to calculate', :required => true
    param :sub_id, String, :desc => 'The sub id for the CQM to calculate. This is popHealth specific.', :required => false,:allow_nil => true
    param :effective_date, ->(effective_date){ effective_date.present? }, :desc => 'Time in seconds since the epoch for the end date of the reporting period',
                                   :required => true
    param :providers, Array, :desc => 'An array of provider IDs to filter the query by', :allow_nil => true
    example '{"_id":"52fe409bb99cc8f818000001", "status":{"state":"queued", ...}, ...}'
    description <<-CDESC
      This action will create a clinical quality measure calculation. If the measure has already been calculated,
      it will return the results. If not, it will return the status of the calculation, which can be checked in
      the status property of the returned JSON. If it is calculating, then the results may be obtained by the
      GET action with the id.
    CDESC
    def create
      options = {}
      options[:filters] = build_filter
 
      authorize_providers
 
      options[:effective_date] = params[:effective_date]
      options['prefilter'] = build_mr_prefilter if APP_CONFIG['use_map_reduce_prefilter']
      qr = QME::QualityReport.find_or_create(params[:measure_id],
                                           params[:sub_id], options)
      if !qr.calculated?
        qr.calculate( {"oid_dictionary" =>OidHelper.generate_oid_dictionary(qr.measure),
          "enable_rationale" => APP_CONFIG['enable_map_reduce_rationale'] || false,
          "enable_logging" => APP_CONFIG['enable_map_reduce_logging'] || false, 
 "short_circuit" => APP_CONFIG['enable_map_reduce_short_circuit'] || false}, true)
      end
 
      render json: qr
    end
 
    api :DELETE, '/queries/:id', "Remove clinical quality measure calculation"
    param :id, String, :desc => 'The id of the quality measure calculation', :required => true
    def destroy
      qr = QME::QualityReport.find(params[:id])
      authorize! :delete, qr
      qr.destroy
      render :status=> 204, :text=>""
    end
 
    api :PUT, '/queries/:id/recalculate', "Force a clinical quality measure to recalculate"
    param :id, String, :desc => 'The id of the quality measure calculation', :required => true
    def recalculate
      qr = QME::QualityReport.find(params[:id])
      authorize! :recalculate , qr
      qr.calculate({"oid_dictionary" =>OidHelper.generate_oid_dictionary(qr.measure_id),
                     'recalculate' =>true}, true)
      render json: qr
    end
 
    api :GET, '/queries/:id/patient_results[?population=true|false]',
              "Retrieve patients relevant to a clinical quality measure calculation"
    param :id, String, :desc => 'The id of the quality measure calculation', :required => true
    param :ipp, /true|false/, :desc => 'Ensure patients meet the initial patient population for the measure', :required => false
    param :denom, /true|false/, :desc => 'Ensure patients meet the denominator for the measure', :required => false
    param :numer, /true|false/, :desc => 'Ensure patients meet the numerator for the measure', :required => false
    param :denex, /true|false/, :desc => 'Ensure patients meet the denominator exclusions for the measure', :required => false
    param :denexcp, /true|false/, :desc => 'Ensure patients meet the denominator exceptions for the measure', :required => false
    param :msrpopl, /true|false/, :desc => 'Ensure patients meet the measure population for the measure', :required => false
    param :antinumerator, /true|false/, :desc => 'Ensure patients are not in the numerator but are in the denominator for the measure', :required => false
    param_group :pagination, Api::PatientsController
    example '[{"_id":"52fe409ef78ba5bfd2c4127f","value":{"DENEX":0,"DENEXCEP":0,"DENOM":1,"IPP":1,"NUMER":1,"antinumerator":0,"birthdate":1276869600.0,"effective_date":1356998340.0,,"first":"Steve","gender":"M","last":"E","measure_id":"40280381-3D61-56A7-013E-6224E2AC25F3","medical_record_id":"ce83c561f62e245ad4e0ca648e9de0dd","nqf_id":"0038","patient_id":"52fbbf34b99cc8a728000068"}},...]'
    description <<-PRDESC
      This action returns an array of patients that have results calculated for this clinical quality measure. The list can be restricted
      to specific populations, such as only patients that have made it into the numerator by passing in a query parameter for a particular
      population. Results are paginated.
    PRDESC
    def patient_results
      qr = QME::QualityReport.find(params[:id])
      authorize! :read, qr
      # this returns a criteria object so we can filter it additionally as needed
      results = qr.patient_results
      render json: paginate(patient_results_api_query_url(qr),results.where(build_patient_filter).order_by([:last.asc, :first.asc]))
    end
 
    def patients
      qr = QME::QualityReport.find(params[:id])
      authorize! :read, qr
      # this returns a criteria object so we can filter it additionally as needed
      results = qr.patient_results
      ids = paginate(patients_api_query_url(qr),results.where(build_patient_filter).order_by([:last.asc, :first.asc])).collect{|r| r["value.medical_record_id"]}
      render :json=> Record.where({:medical_record_number.in => ids})
    end
 
 
  private
    def build_filter
      @filter = params.select { |k, v| %w(providers).include? k }.to_options
    end
 
    def authorize_providers
      providers = @filter[:providers] || []
      if !providers.empty?
        providers.each do |p|
          provider = Provider.find(p)
          authorize! :read, provider
        end
      else
        #this is hacky and ugly but cancan will allow just the
        # class Provider to pass for a simple user so providing
        #an empty Provider with no NPI number gets around this
        authorize! :read, Provider.new
      end
    end
 
    def build_mr_prefilter
      measure = HealthDataStandards::CQM::Measure.where({"hqmf_id" => params[:measure_id], "sub_id"=>params[:sub_id]}).first
      measure.prefilter_query!(params[:effective_date].to_i)
    end
 
    def build_patient_filter
      patient_filter = {}
      patient_filter["value.IPP"]= {"$gt" => 0} if params[:ipp] == "true"
      patient_filter["value.DENOM"]= {"$gt" => 0} if params[:denom] == "true"
      patient_filter["value.NUMER"]= {"$gt" => 0} if params[:numer] == "true"
      patient_filter["value.DENEX"]= {"$gt" => 0} if params[:denex] == "true"
      patient_filter["value.DENEXCEP"]= {"$gt" => 0} if params[:denexcep] == "true"
      patient_filter["value.MSRPOPL"]= {"$gt" => 0} if params[:msrpopl] == "true"
      patient_filter["value.antinumerator"]= {"$gt" => 0} if params[:antinumerator] == "true"
      patient_filter["value.provider_performances.provider_id"]= BSON::ObjectId.from_string(params[:provider_id]) if params[:provider_id]
      patient_filter
    end
 
    def collect_provider_id
      params[:providers] || Provider.where({:npi.in => params[:npis] || []}).to_a
    end
  end
end
 

 

 

like0

Thanks Suresh...this seems to

zohair Hussain's picture

Thanks Suresh...this seems to fix lot of other things.

QRDA 3 Export Stopped working..it throughs an error "Undefined method "Round" for NIL: NILCLASS

like0

You can replace the below

Suresh Kumar Reddy M's picture

You can replace the below file to resolve this issue.

 

/usr/local/rvm/gems/ruby-2.1.2/gems/health-data-standards-3.5.0/templates/cat3/_measure_data.cat3.erb

<!----------------------------------------------------------------------------------->

 
<!--   MEASURE DATA REPORTING FOR    <%= population.type %>  <%= population.id %>  -->
<observation classCode="OBS" moodCode="EVN">
  <!-- Measure Data template -->
  <templateId root="2.16.840.1.113883.10.20.27.3.5"/>
  <code code="ASSERTION" 
        codeSystem="2.16.840.1.113883.5.4" 
        displayName="Assertion" 
        codeSystemName="ActCode"/>
  <statusCode code="completed"/>
  <value xsi:type="CD" code="<%= population.type %>" 
         codeSystem="2.16.840.1.113883.5.1063"  
         codeSystemName="ObservationValue"/>
  <!-- Aggregate Count -->
  <entryRelationship typeCode="SUBJ" inversionInd="true">
    <observation classCode="OBS" moodCode="EVN">
      <templateId root="2.16.840.1.113883.10.20.27.3.3"/>
      <code code="MSRAGG" 
        displayName="rate aggregation" 
        codeSystem="2.16.840.1.113883.5.4" 
        codeSystemName="ActCode"/>
      <value xsi:type="INT" value="<%= ( (population.value.is_a? Numeric) ? population.value.round : 0) %>"/>
      <methodCode code="COUNT" 
        displayName="Count" 
        codeSystem="2.16.840.1.113883.5.84" 
        codeSystemName="ObservationMethod"/>
    </observation>
  </entryRelationship>
  <% population.stratifications.each do |strat| -%>
 
  <!--  Startification Reporting Template for <%= population.type %>  <%= population.id %>  Stratification <%= strat.id %>   -->
 
  <entryRelationship typeCode="COMP">
    <observation classCode="OBS" moodCode="EVN">
      <templateId root="2.16.840.1.113883.10.20.27.3.4"/>
      <code code="ASSERTION" 
            codeSystem="2.16.840.1.113883.5.4" 
            displayName="Assertion" 
            codeSystemName="ActCode"/>
      <statusCode code="completed"/>
      <value xsi:type="CD" nullFlavor="OTH">
       <originalText>Stratum</originalText>
      </value>
      <entryRelationship typeCode="SUBJ" inversionInd="true">
        <observation classCode="OBS" moodCode="EVN">
          <templateId root="2.16.840.1.113883.10.20.27.3.3"/>
          <code code="MSRAGG" 
                displayName="rate aggregation" 
                codeSystem="2.16.840.1.113883.5.4" 
                codeSystemName="ActCode"/>
          <value xsi:type="INT" value="<%= ( (strat.value.is_a? Numeric) ? strat.value.round : 0) %>"/>
          <methodCode code="COUNT" 
                      displayName="Count" 
                      codeSystem="2.16.840.1.113883.5.84" 
                      codeSystemName="ObservationMethod"/>
        </observation>
      </entryRelationship>
      <% if population.type == 'MSRPOPL' -%>
      <% 
      #need to lookup the observation population entry and then find the stratification entry for it
      observ = aggregate_count.populations.find{|p| p.type == "OBSERV"}
      obs_strat = observ.stratifications.find{|s| s.id == strat.id}
        if obs_strat
      %>
      <%== render :partial => 'continuous_variable_value', :locals => {:id => observ.id, :value=>obs_strat.value } %>
      <% 
        end
      end -%>
      <reference typeCode="REFR">
        <externalObservation classCode="OBS" moodCode="EVN">
          <id root="<%= strat.id %>"/>
        </externalObservation>
      </reference>
    </observation>
  </entryRelationship>
  <% end -%>
  <% if population.supplemental_data.present? -%>
  <%   sex_supplimental_data = population.supplemental_data["SEX"]
       if sex_supplimental_data.present?
         sex_supplimental_data.each do |sex, count| -%>
   
   <!--    SEX Supplemental Data Reporting for <%= population.type %>  <%= population.id %>      --> 
         
  <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Sex Supplemental Data', 
                :template_id => '2.16.840.1.113883.10.20.27.3.6', :supplemental_data_code => '184100006',
                :supplemental_data_code_system => '2.16.840.1.113883.6.96', :supplemental_data_value_code => sex,
                :supplemental_data_value_code_system => '2.16.840.1.113883.5.1', :count => count} %>   
      <% end -%>
    <% end -%>
  <%   ethnicity_supplimental_data = population.supplemental_data["ETHNICITY"]
       if ethnicity_supplimental_data.present?
         ethnicity_supplimental_data.each do |ethnicity, count| -%>
 
    <!--     ETHNICITY Supplemental Data Reporting  for <%= population.type %>  <%= population.id %>     --> 
 
  <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Ethnicity Supplemental Data', 
                :template_id => '2.16.840.1.113883.10.20.27.3.7', :supplemental_data_code => '364699009',
                :supplemental_data_code_system => '2.16.840.1.113883.6.96', :supplemental_data_value_code => ethnicity,
                :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => count} %>   
      <% end -%>
    <% end -%>
  <%   race_supplimental_data = population.supplemental_data["RACE"]
       if race_supplimental_data.present?
         race_supplimental_data.each do |race, count| -%>
 
   <!--      RACE Supplemental Data Reporting  for <%= population.type %>  <%= population.id %> --> 
 
  <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Race Supplemental Data', 
                :template_id => '2.16.840.1.113883.10.20.27.3.8', :supplemental_data_code => '103579009',
                :supplemental_data_code_system => '2.16.840.1.113883.6.96', :supplemental_data_value_code => race,
                :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => count} %>   
      <% end -%>
    <% end -%>
  <%   payer_supplimental_data = population.supplemental_data["PAYER"]
       if payer_supplimental_data.present?
         payer_supplimental_data.each do |payer, count| -%>
 
 <!--         PAYER Supplemental Data Reporting   for<%= population.type %>  <%= population.id %>   -->        
  <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Payer Supplemental Data', 
                :template_id => '2.16.840.1.113883.10.20.27.3.9', :supplemental_data_code => '48768-6',
                :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => payer,
                :supplemental_data_value_code_system => '2.16.840.1.113883.3.221.5', :count => count} %>   
      <% end -%>
    <% end -%>
  <% end -%>
  <% if population.type == 'MSRPOPL' -%>
  <%  observ = aggregate_count.populations.find{|p| p.type == "OBSERV"} %>
  <%== render :partial => 'continuous_variable_value', :locals => {:id => observ.id, :value=>observ.value}%>
  <% end -%>
  <reference typeCode="REFR">
     <externalObservation classCode="OBS" moodCode="EVN">
        <id root="<%= population.id %>"/>
     </externalObservation>
  </reference>
</observation>
 
like0

Suresh, that worked..Problem

zohair Hussain's picture

Suresh, that worked..Problem was with the measures with stratifications..

We are able to export qrda 3 now. Thanks once again..

 
like0

CMS117v2/0038 - Childhood Immunization Status

zohair Hussain's picture
like0

Hi Zohair, For me Only this

Suresh Kumar Reddy M's picture

Hi Zohair,

For me Only this one is not calculating.  Other measures which we are using gave same result as cypress. I tried with bundle 2.5.0 and 2.4.0 also.

like0