Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #330 from onc-healthit/development
Browse files Browse the repository at this point in the history
Version 2.7.0
  • Loading branch information
Jammjammjamm authored Oct 22, 2019
2 parents dbb146a + a1b7c45 commit 7e62f04
Show file tree
Hide file tree
Showing 436 changed files with 29,640 additions and 2,752 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib/app/modules/uscore_v*/* linguist-generated=true
resources/terminology/validators/* linguist-generated=true
52 changes: 23 additions & 29 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-05-31 09:51:21 -0400 using RuboCop version 0.67.2.
# on 2019-09-26 15:38:33 -0400 using RuboCop version 0.74.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 25
# Offense count: 6
Lint/EmptyWhen:
Enabled: false
Exclude:
- 'lib/app/modules/argonaut/argonaut_careplan_sequence.rb'
- 'lib/app/modules/argonaut/argonaut_diagnostic_report_sequence.rb'
- 'lib/app/modules/argonaut/argonaut_observation_sequence.rb'
- 'lib/app/modules/argonaut/argonaut_procedure_sequence.rb'
- 'lib/app/modules/argonaut/argonaut_vital_signs_observation_sequence.rb'
- 'lib/tasks/tasks.rake'

# Offense count: 2
# Offense count: 1
# Configuration parameters: AllowComments.
Lint/HandleExceptions:
Exclude:
- 'generators/argonaut-r4/generator.rb'
- 'lib/app/sequence_base.rb'

# Offense count: 1
Expand All @@ -27,56 +33,43 @@ Lint/ShadowingOuterLocalVariable:
- 'lib/app/utils/terminology.rb'
- 'lib/app/utils/valueset.rb'

# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'lib/tasks/tasks.rake'

# Offense count: 3
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
Max: 4

# Offense count: 38
# Offense count: 32
Metrics/CyclomaticComplexity:
Max: 33
Max: 30

# Offense count: 33
# Offense count: 32
Style/ClassVars:
Exclude:
- 'lib/app/module.rb'
- 'lib/app/modules/onc_program/onc_ehr_launch_sequence.rb'
- 'lib/app/modules/onc_program/onc_standalone_launch_sequence.rb'
- 'lib/app/sequence_base.rb'
- 'lib/app/utils/logged_rest_client.rb'
- 'lib/app/utils/terminology.rb'

# Offense count: 95
# Offense count: 132
Style/Documentation:
Enabled: false

# Offense count: 22
# Offense count: 4
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/app/utils/validation.rb'
- 'lib/app/utils/tls_tester.rb'
- 'lib/app/utils/validation.rb'

# Max line length needs to be reduced before fixing these
# Offense count: 14
# Offense count: 3
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/app/models/testing_instance.rb'
- 'lib/app/utils/assertions.rb'
- 'lib/tasks/tasks.rake'

# Offense count: 1
Style/MixinUsage:
Exclude:
- 'lib/tasks/tasks.rake'

# Offense count: 4
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Expand All @@ -91,8 +84,9 @@ Style/Semicolon:
Exclude:
- 'test/unit/sequence_validation_test.rb'

# Offense count: 2935
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# Offense count: 1064
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 180
Max: 177
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gem 'thin'
gem 'time_difference'

group :test do
gem 'minitest'
gem 'rack-test'
gem 'rubocop', require: false
gem 'simplecov', require: false
Expand Down
35 changes: 18 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
aes_key_wrap (1.0.1)
ast (2.4.0)
backports (3.15.0)
Expand All @@ -23,7 +23,7 @@ GEM
bitarray
msgpack
byebug (11.0.1)
childprocess (1.0.1)
childprocess (2.0.0)
rake (< 13.0)
coderay (1.1.2)
colorize (0.8.1)
Expand Down Expand Up @@ -87,11 +87,11 @@ GEM
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
fhir_client (4.0.2)
fhir_client (4.0.3)
activesupport (>= 3)
addressable (>= 2.3)
fhir_dstu2_models (>= 1.0.10)
fhir_models (>= 4.0.1)
fhir_models (>= 4.0.2)
fhir_stu3_models (>= 3.0.1)
nokogiri (>= 1.10.4)
oauth2 (~> 1.1)
Expand All @@ -103,7 +103,7 @@ GEM
date_time_precision (>= 0.8)
mime-types (>= 3.0)
nokogiri (>= 1.10.4)
fhir_models (4.0.1)
fhir_models (4.0.2)
bcp47 (>= 0.3)
date_time_precision (>= 0.8)
mime-types (>= 3.0)
Expand All @@ -129,11 +129,11 @@ GEM
jwt (2.2.1)
kramdown (2.1.0)
method_source (0.9.2)
mime-types (3.2.2)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mime-types-data (3.2019.0904)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.12.2)
msgpack (1.3.1)
multi_json (1.13.1)
multi_xml (0.6.0)
Expand All @@ -149,15 +149,15 @@ GEM
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
parallel (1.17.0)
parser (2.6.3.0)
parser (2.6.4.1)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (3.1.1)
public_suffix (4.0.1)
rack (2.0.7)
rack-protection (2.0.7)
rack
Expand All @@ -179,12 +179,12 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
rubyzip (1.2.3)
rubyzip (1.3.0)
safe_yaml (1.0.5)
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
selenium-webdriver (3.142.4)
childprocess (>= 0.5, < 3.0)
rubyzip (~> 1.2, >= 1.2.2)
simplecov (0.17.0)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
Expand All @@ -208,7 +208,7 @@ GEM
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thread_safe (0.3.6)
tilt (2.0.9)
tilt (2.0.10)
time_difference (0.7.0)
activesupport (~> 5.1)
tzinfo (1.2.5)
Expand All @@ -218,7 +218,7 @@ GEM
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
uuidtools (2.1.5)
webmock (3.6.2)
webmock (3.7.6)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -236,6 +236,7 @@ DEPENDENCIES
fhir_client
json-jwt
kramdown
minitest
pry
pry-byebug
rack-test
Expand Down
3 changes: 2 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ modules:
- onc
- onc_r4
- smart
- us_core_r4
- argonaut
- uscore_v3.0.0
- uscore_v3.0.1

# preset fhir servers: optional. Minimally requires name, uri, module, optional inferno_uri, client_id, client_secret, scopes, instructions link
presets:
Expand Down
5 changes: 0 additions & 5 deletions download-argonaut-valuesets.sh

This file was deleted.

87 changes: 87 additions & 0 deletions generator/generator_base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# frozen_string_literal: true

require 'erb'
require 'pry'
require 'fileutils'
require 'net/http'
require 'fhir_models'

module Inferno
module Generator
class Base
attr_accessor :path, :extras, :resource_by_path, :resources_by_type,
:claimed_test_id_prefixes

def initialize(path, extras)
@path = path
@extras = extras
@claimed_test_id_prefixes = Set.new
load_resources
end

def load_resources
@resource_by_path = Hash.new {}
@resources_by_type = Hash.new { |h, k| h[k] = [] }
Dir.glob("#{resource_file_path}/**/*.*") do |resource| # note one extra "*"
if File.file?(resource) && resource.end_with?('json', 'xml')

# We should consider using the native Ruby models instead of JSON
# There were problems with round-tripping certain SearchParameters though
new_resource_json = JSON.parse(File.read(resource))
new_resource = FHIR.from_contents(File.read(resource))
resource_by_path[resource_path(new_resource)] = new_resource_json
type = new_resource.class.name.demodulize
type = 'CapabilityStatement' if type == 'Conformance'
resources_by_type[type].push(new_resource_json)
end
end
end

def ig_resource
resources_by_type['ImplementationGuide'].first
end

def capability_statement(mode = 'server')
resources_by_type['CapabilityStatement'].find do |capability_statement_resource|
capability_statement_resource['rest'].any? { |r| r['mode'] == mode }
end
end

def resource_path(resource)
"#{resource.class.name.demodulize}/#{resource.id}"
end

def format_output
system("rubocop -x --display-only-fail-level-offenses #{sequence_out_path}")
end

def run
generate
format_output
end

# subclass must implement the following
def generate
raise StandardError('Method not implemented.')
end

def sequence_prefix
version = ig_resource['version'].delete('.')
name = ig_metadata['name']
"#{version}#{name}"
end

def module_yml_out_path
File.expand_path('./lib/app/modules/')
end

def sequence_out_path
File.expand_path("#{module_yml_out_path}/#{path}")
end

def resource_file_path
File.expand_path("./resources/#{path}")
end
end
end
end
Loading

0 comments on commit 7e62f04

Please sign in to comment.