Skip to content

Commit

Permalink
Merge pull request #114 from fhir-crucible/FI-2833-r5
Browse files Browse the repository at this point in the history
FI-2833 Add R5 Support
  • Loading branch information
yunwwang authored Sep 30, 2024
2 parents 00acb83 + 0942d11 commit 80e40d7
Show file tree
Hide file tree
Showing 304 changed files with 2,018,116 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tmp/
.idea

# ig-extraction
lib/fhir_models/igs/packages
lib/fhir_models/igs/package
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ AllCops:
- 'spec/**/*'
- 'lib/fhir_models/fhir/**/*'
- 'lib/fhir_models/fhirpath/evaluate.rb'
- 'lib/fhir_models/r4/generated/**/*'
- 'lib/fhir_models/r4b/generated/**/*'
- 'lib/fhir_models/*/generated/**/*'
- 'lib/**/*.rake'
- 'tmp/**/*'
- '*.gemspec'
Expand Down
42 changes: 3 additions & 39 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-08-29 16:52:13 UTC using RuboCop version 1.23.0.
# on 2024-09-30 12:52:20 UTC using RuboCop version 1.23.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: 1
# Cop supports --auto-correct.
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
Layout/EmptyLineBetweenDefs:
Exclude:
- 'lib/fhir_models/fhir_ext/common_structure_definition.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Layout/EmptyLinesAroundModuleBody:
Exclude:
- 'lib/fhir_models/fhir_ext/common_element_definition.rb'
- 'lib/fhir_models/fhir_ext/common_structure_definition.rb'
- 'lib/fhir_models/fhir_ext/common_structure_definition_finding.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingEmptyLines:
Exclude:
- 'lib/fhir_models/bootstrap/json.rb'
- 'lib/fhir_models/r4/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/r4/fhir_ext/structure_definition_compare.rb'
- 'lib/fhir_models/r4/fhir_ext/structure_definition_finding.rb'
- 'lib/fhir_models/r4b/fhir_ext/structure_definition.rb'
- 'lib/fhir_models/r4b/fhir_ext/structure_definition_compare.rb'
- 'lib/fhir_models/r4b/fhir_ext/structure_definition_finding.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'lib/fhir_models/fhir_ext/common_structure_definition.rb'
- 'lib/fhir_models/fhir_ext/common_structure_definition_compare.rb'
- 'lib/fhir_models/fhir_ext/common_structure_definition_finding.rb'
- 'lib/fhir_models/r5/fhir_ext/structure_definition_compare.rb'

# Offense count: 43
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Expand Down Expand Up @@ -80,20 +51,13 @@ Metrics/MethodLength:
# Offense count: 4
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 354
Max: 347

# Offense count: 30
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 76

# Offense count: 5
# Configuration parameters: EnforcedStyle, IgnoredPatterns.
# SupportedStyles: snake_case, camelCase
Naming/MethodName:
Exclude:
- 'lib/fhir_models/fhir_ext/common_structure_definition_finding.rb'

# Offense count: 4
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
Expand Down
1 change: 0 additions & 1 deletion lib/fhir_models.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# require versions
require_relative 'fhir_models/r4'
require_relative 'fhir_models/r4b'
22 changes: 13 additions & 9 deletions lib/fhir_models/fhir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
require 'uri'

module FHIR
module ClassMethods
def from_contents(contents)
doc = Nokogiri::XML(contents)
if doc.errors.empty?
versioned_fhir_module::Xml.from_xml(contents)
else
versioned_fhir_module::Json.from_json(contents)
end
end
end
include ClassMethods
extend ClassMethods

def self.logger
@logger || default_logger
end
Expand All @@ -15,15 +28,6 @@ def self.default_logger
@default_logger ||= Logger.new(ENV['FHIR_LOGGER'] || $stdout)
end

def self.from_contents(contents)
doc = Nokogiri::XML(contents)
if doc.errors.empty?
FHIR::Xml.from_xml(contents)
else
FHIR::Json.from_json(contents)
end
end

# TODO: pull regexes from metadata
def self.primitive?(datatype:, value:)
# Remaining data types: handle special cases before checking type StructureDefinitions
Expand Down
3 changes: 2 additions & 1 deletion lib/fhir_models/generator/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

VERSION_MAP = {
'4.0.1' => 'r4',
'4.3.0' => 'r4b'
'4.3.0' => 'r4b',
'5.0.0' => 'r5'
}.freeze

module FHIR
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/generator/ig_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_search_parameters(type_name = nil)
resources_by_type['SearchParameter']
else
resources_by_type['SearchParameter'].select do |p|
p['base']&.include?(type_name) && p['xpath'] && !p['xpath'].include?('extension')
p['base']&.include?(type_name) && p['expression'] && !p['expression'].include?('extension')
end
end
end
Expand Down
Binary file added lib/fhir_models/igs/hl7.fhir.r5.core.tgz
Binary file not shown.
10 changes: 10 additions & 0 deletions lib/fhir_models/igs/hl7.fhir.r5.core/package_exclude/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# FHIR NPM Package Supplement Files

The files in this directory will excluded from the hl7.fhir.<version>.core.tgz package.
FHIR NPM Package may contains some files which are not to be processed, such as examples.
Add files to the excluded list to prevent code generator from processing them.
These files will not supersede the files in the IG.

## excluded_files.json

This file contains list of file names to be excluded from processing.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# FHIR NPM Package Supplement Files

The files in this directory will supplement files in the hl7.fhir.<version>.core.tgz package.
Add files to this directory if you need to add information that may be missing from the package.
These files will not supersede the files in the IG.

## expansions.json

This file contains ValueSet expansions which are used by code generator
Loading

0 comments on commit 80e40d7

Please sign in to comment.