diff --git a/.rubocop.yml b/.rubocop.yml
index 6cdb1f12d..616f0c5dc 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -6,6 +6,7 @@ AllCops:
- 'spec/**/*'
- 'lib/fhir_models/fhir/**/*'
- 'lib/fhir_models/fluentpath/evaluate.rb'
+ - 'lib/**/*.rake'
- 'tmp/**/*'
- '*.gemspec'
- 'bin/*'
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index fe82df15e..7628afd12 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -27,7 +27,7 @@ Metrics/BlockLength:
# Offense count: 1
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
- Max: 4
+ Max: 8
# Offense count: 5
# Configuration parameters: CountComments.
@@ -41,7 +41,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 40
# Configuration parameters: CountComments.
Metrics/MethodLength:
- Max: 109
+ Max: 150
# Offense count: 1
# Configuration parameters: CountComments.
diff --git a/.travis.yml b/.travis.yml
index 8e3e4ee66..cfb1608ae 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,10 +2,10 @@ language: ruby
env:
- TESTMEMORY=0 GCDELAY=2.0
rvm:
- - 2.2
- 2.3
- 2.4
- 2.5
+ - 2.6
script:
- bundle exec rake
- bundle exec codeclimate-test-reporter
diff --git a/fhir_models.gemspec b/fhir_models.gemspec
index f483aa888..9755bc6b0 100644
--- a/fhir_models.gemspec
+++ b/fhir_models.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'nokogiri', '>= 1.8.2'
spec.add_dependency 'date_time_precision', '>= 0.8'
spec.add_dependency 'bcp47', '>= 0.3'
- spec.add_dependency 'mime-types', '>= 1.16', '< 3'
+ spec.add_dependency 'mime-types', '>= 3.0'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
diff --git a/lib/fhir_models/bootstrap/hashable.rb b/lib/fhir_models/bootstrap/hashable.rb
index 0ecc3042d..84171a145 100644
--- a/lib/fhir_models/bootstrap/hashable.rb
+++ b/lib/fhir_models/bootstrap/hashable.rb
@@ -51,7 +51,7 @@ def from_hash(hash)
if !klass.nil? && !value.nil?
# handle array of objects
if value.is_a?(Array)
- value.map! do |child|
+ value = value.map do |child|
obj = child
unless [FHIR::RESOURCES, FHIR::TYPES].flatten.include? child.class.name.gsub('FHIR::', '')
obj = make_child(child, klass)
@@ -68,7 +68,7 @@ def from_hash(hash)
FHIR.logger.error("Unhandled and unrecognized class/type: #{meta['type']}")
elsif value.is_a?(Array)
# array of primitives
- value.map! { |child| convert_primitive(child, meta) }
+ value = value.map { |child| convert_primitive(child, meta) }
instance_variable_set("@#{local_name}", value)
else
# single primitive
@@ -111,7 +111,7 @@ def convert_primitive(value, meta)
elsif FHIR::PRIMITIVES.include?(meta['type'])
primitive_meta = FHIR::PRIMITIVES[meta['type']]
if primitive_meta['type'] == 'number'
- rval = BigDecimal.new(value.to_s)
+ rval = BigDecimal(value.to_s)
rval = rval.frac.zero? ? rval.to_i : rval.to_f
end # primitive is number
end # boolean else
diff --git a/lib/fhir_models/bootstrap/model.rb b/lib/fhir_models/bootstrap/model.rb
index 2c31be680..637ba2bc3 100644
--- a/lib/fhir_models/bootstrap/model.rb
+++ b/lib/fhir_models/bootstrap/model.rb
@@ -200,8 +200,8 @@ def validate_field(field, value, contained_here, meta, errors)
else
errors[field] << "#{meta['path']}: expected Reference, found #{klassname}"
end
- # if the data type is a particular resource or complex type
- elsif FHIR::RESOURCES.include?(datatype) || FHIR::TYPES.include?(datatype)
+ # if the data type is a particular resource or complex type or BackBone element within this resource
+ elsif FHIR::RESOURCES.include?(datatype) || FHIR::TYPES.include?(datatype) || v.class.name.start_with?(self.class.name)
if datatype == klassname
validation = v.validate(contained_here)
errors[field] << validation unless validation.empty?
diff --git a/lib/fhir_models/examples/json/capabilitystatement-example.json b/lib/fhir_models/examples/json/capabilitystatement-example.json
index 787c70c14..34eabd27c 100644
--- a/lib/fhir_models/examples/json/capabilitystatement-example.json
+++ b/lib/fhir_models/examples/json/capabilitystatement-example.json
@@ -216,7 +216,7 @@
"mode": "consumer",
"documentation": "Basic rules for all documents in the EHR system",
"profile": {
- "reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
+ "reference": "http://fhir.hl7.org/StructureDefinition/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
}
}
]
diff --git a/lib/fhir_models/examples/json/claim-example-oral-contained-identifier.json b/lib/fhir_models/examples/json/claim-example-oral-contained-identifier.json
index 8d1b50510..6b61d6c5e 100644
--- a/lib/fhir_models/examples/json/claim-example-oral-contained-identifier.json
+++ b/lib/fhir_models/examples/json/claim-example-oral-contained-identifier.json
@@ -109,7 +109,7 @@
"sequence": 1,
"focal": true,
"coverage": {
- "reference": "http://www.jurisdiction.com/nationalplan/123AB345"
+ "reference": "http://www.jurisdiction.com/Coverage/123AB345"
}
}
],
diff --git a/lib/fhir_models/examples/json/dataelement-example.json b/lib/fhir_models/examples/json/dataelement-example.json
index b48c80803..e9280319a 100644
--- a/lib/fhir_models/examples/json/dataelement-example.json
+++ b/lib/fhir_models/examples/json/dataelement-example.json
@@ -186,7 +186,7 @@
"mapping": [
{
"identity": "fhir",
- "language": "application/xquery",
+ "language": "application/xml",
"map": "return f:/Patient/f:gender"
}
]
diff --git a/lib/fhir_models/examples/json/endpoint-examples-general-template.json b/lib/fhir_models/examples/json/endpoint-examples-general-template.json
index 092536cf4..f5c117a72 100644
--- a/lib/fhir_models/examples/json/endpoint-examples-general-template.json
+++ b/lib/fhir_models/examples/json/endpoint-examples-general-template.json
@@ -199,7 +199,7 @@
}
],
"payloadMimeType": [
- "PDF"
+ "application/pdf"
],
"address": "https://sqlonfhir-dstu2.azurewebsites.net/fhir"
}
@@ -232,7 +232,7 @@
}
],
"payloadMimeType": [
- "HL7v2"
+ "application/fhir+json"
],
"address": "127.0.0.1"
}
@@ -265,7 +265,7 @@
}
],
"payloadMimeType": [
- "XDA/XDS"
+ "application/xml"
],
"address": "https://open.epic.com/Interface/XDS.b"
}
@@ -298,7 +298,7 @@
}
],
"payloadMimeType": [
- "DICOM WADO-RS"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
@@ -331,7 +331,7 @@
}
],
"payloadMimeType": [
- "DICOM QIDO-RS"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
@@ -364,7 +364,7 @@
}
],
"payloadMimeType": [
- "DICOM STOW-RS"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
@@ -397,7 +397,7 @@
}
],
"payloadMimeType": [
- "DICOM STOW-RS"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
@@ -430,7 +430,7 @@
}
],
"payloadMimeType": [
- "DICOM WADO-URI"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/wadoUri"
}
@@ -463,7 +463,7 @@
}
],
"payloadMimeType": [
- "IHE IID"
+ "application/dicom"
],
"address": "https://pacs.hospital.org/IHEInvokeImageDisplay"
}
diff --git a/lib/fhir_models/examples/json/provenance-example-sig.json b/lib/fhir_models/examples/json/provenance-example-sig.json
index 6bd54cd71..2fcee86e2 100644
--- a/lib/fhir_models/examples/json/provenance-example-sig.json
+++ b/lib/fhir_models/examples/json/provenance-example-sig.json
@@ -35,7 +35,7 @@
]
}
],
- "whoUri": "mailto://hhd@ssa.gov"
+ "whoUri": "mailto:hhd@ssa.gov"
}
],
"signature": [
diff --git a/lib/fhir_models/examples/xml/capabilitystatement-example.xml b/lib/fhir_models/examples/xml/capabilitystatement-example.xml
index 189adb180..88b7b7704 100644
--- a/lib/fhir_models/examples/xml/capabilitystatement-example.xml
+++ b/lib/fhir_models/examples/xml/capabilitystatement-example.xml
@@ -211,7 +211,7 @@
-
-
-
-
-
-
-
-
-