You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My name is Jake Poe and I work with Battelle Memorial Institute as a software developer for the eCQI Resource Center (ecqi.healthit.gov).
We're attempting to run our annual update using the branch derep_2021_rebase. The script script/export_to_drupal.rb is failing with the error outlined in the title of the issue post. I've been able to deduce that the error refers to accessing an object in an array, but I'm not a ruby developer so I haven't been able to get much farther than adding nil checks via ternaries in the method parameters on line 214.
I attempted to replace line 214 with the following: @code_constraints = to_drupal_lookup_table_with_revisions(execute_request(:get, "#{@options['base_url']}/jsonapi/paragraph/code_constraint")) { |term| "#{term['attributes']['field_code_system'] ? term['attributes']['field_code_system'] : nil}-#{term['attributes']['field_oid'] ? term['attributes']['field_oid'] : nil}-#{term['attributes']['field_name'] ? term['attributes']['field_name'] : nil}-#{term['attributes']['field_url']['uri'] ? term['attributes']['field_url']['uri'] : nil}" }
But no dice. For good measure I also tried replacing nil with just an empty string. Still getting the same error.
23: from bin/rails:4:in '<main>'
22: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in 'require'
21: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in 'load_dependency'
20: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in 'block in require'
19: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in 'require'
18: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in 'require_with_bootsnap_lfi'
17: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in 'register'
16: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in 'block in require_with_bootsnap_lfi'
15: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in 'require'
14: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in '<main>'
13: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.4.3/lib/rails/command.rb:46:in 'invoke'
12: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in 'perform'
11: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in 'dispatch'
10: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in 'invoke_command'
9: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in 'run'
8: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/runner/runner_command.rb:38:in 'perform'
7: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in 'load'
6: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:70:in 'rescue in load'
5: from /home/cypress/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:70:in 'load'
4: from script/export_to_drupal.rb:214:in '<main>'
3: from script/export_to_drupal.rb:185:in 'to_drupal_lookup_table_with_revisions'
2: from script/export_to_drupal.rb:185:in 'map'
1: from script/export_to_drupal.rb:186:in 'block in to_drupal_lookup_table_with_revisions'
script/export_to_drupal.rb:214:in 'block in <main>': undefined method '[]' for nil:NilClass (NoMethodError)
I'm aware the last call in the stacktrace points to line 186, but like I said I'm not a ruby guy and I'm not sure how I'd try and diagnose anything on that line. Regardless, I'd think passing nil in the parameters before that method gets called should resolve the issue regardless.
Think you can help me out?
Thank you,
Jake Poe
The text was updated successfully, but these errors were encountered:
I also added some puts in to_drupal_lookup_table_with_revisions(ary).
Here is a successful object's output: paragraph--code_constraint
1f11d330-74df-4eb9-bd96-185d86c40123
{"drupal_internal__id"=>19891, "drupal_internal__revision_id"=>23296, "langcode"=>"en", "status"=>true, "created"=>"2020-06-09T00:01:21+00:00", "parent_id"=>"164341", "parent_type"=>"node", "parent_field_name"=>"field_code_constraint", "behavior_settings"=>[], "default_langcode"=>true, "revision_translation_affected"=>nil, "synonyms"=>nil, "field_code_system"=>"CPT", "field_description"=>{"value"=>"{{ I removed a whole lot of HTML for readability here }}", "format"=>"body_html", "processed"=>"{{ I removed a whole lot of HTML for readability here }}"}, "field_name"=>"Observation care discharge day management (This code is to be utilized to report all services provided to a patient on discharge from outpatient hospital observation status if the discharge is on other than the initial date of observation status. To re...", "field_oid"=>nil, "field_url"=>{"uri"=>"https://vsac.nlm.nih.gov/context/cs/codesystem/CPT/version/2020/code/99217/info", "title"=>"()", "options"=>[]}}
And here's the output for the object that's failing: paragraph--code_constraint
That's what makes me think the issue is with accessing an array
edited for formatting
JacobPoe
changed the title
script/export_to_drupal.rb:214:in block in <main>': undefined method []' for nil:NilClass (NoMethodError)
script/export_to_drupal.rb:214:in 'block in <main>': undefined method '[]' for nil:NilClass (NoMethodError)
Apr 23, 2021
Hello,
My name is Jake Poe and I work with Battelle Memorial Institute as a software developer for the eCQI Resource Center (ecqi.healthit.gov).
We're attempting to run our annual update using the branch
derep_2021_rebase
. The scriptscript/export_to_drupal.rb
is failing with the error outlined in the title of the issue post. I've been able to deduce that the error refers to accessing an object in an array, but I'm not a ruby developer so I haven't been able to get much farther than adding nil checks via ternaries in the method parameters on line 214.I attempted to replace line 214 with the following:
@code_constraints = to_drupal_lookup_table_with_revisions(execute_request(:get, "#{@options['base_url']}/jsonapi/paragraph/code_constraint")) { |term| "#{term['attributes']['field_code_system'] ? term['attributes']['field_code_system'] : nil}-#{term['attributes']['field_oid'] ? term['attributes']['field_oid'] : nil}-#{term['attributes']['field_name'] ? term['attributes']['field_name'] : nil}-#{term['attributes']['field_url']['uri'] ? term['attributes']['field_url']['uri'] : nil}" }
But no dice. For good measure I also tried replacing
nil
with just an empty string. Still getting the same error.Below is the full error stacktrace:
Traceback (most recent call last):
bin/rails: Bootsnap::LoadPathCache::FallbackScan
script/export_to_drupal.rb:214:in 'block in <main>': undefined method '[]' for nil:NilClass (NoMethodError)
I'm aware the last call in the stacktrace points to line 186, but like I said I'm not a ruby guy and I'm not sure how I'd try and diagnose anything on that line. Regardless, I'd think passing
nil
in the parameters before that method gets called should resolve the issue regardless.Think you can help me out?
Thank you,
Jake Poe
The text was updated successfully, but these errors were encountered: