Skip to content

Commit

Permalink
Merge pull request #49 from fhir-crucible/port
Browse files Browse the repository at this point in the history
Porting recent fhir_dstu2_model changes
  • Loading branch information
jawalonoski authored Feb 18, 2019
2 parents 1ebe780 + 959cf7d commit 9c6c376
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 38 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AllCops:
- 'spec/**/*'
- 'lib/fhir_models/fhir/**/*'
- 'lib/fhir_models/fluentpath/evaluate.rb'
- 'lib/**/*.rake'
- 'tmp/**/*'
- '*.gemspec'
- 'bin/*'
Expand Down
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Metrics/BlockLength:
# Offense count: 1
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
Max: 4
Max: 8

# Offense count: 5
# Configuration parameters: CountComments.
Expand All @@ -41,7 +41,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 40
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 109
Max: 150

# Offense count: 1
# Configuration parameters: CountComments.
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion fhir_models.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions lib/fhir_models/bootstrap/hashable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/fhir_models/bootstrap/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"sequence": 1,
"focal": true,
"coverage": {
"reference": "http://www.jurisdiction.com/nationalplan/123AB345"
"reference": "http://www.jurisdiction.com/Coverage/123AB345"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/json/dataelement-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"mapping": [
{
"identity": "fhir",
"language": "application/xquery",
"language": "application/xml",
"map": "return f:/Patient/f:gender"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
}
],
"payloadMimeType": [
"PDF"
"application/pdf"
],
"address": "https://sqlonfhir-dstu2.azurewebsites.net/fhir"
}
Expand Down Expand Up @@ -232,7 +232,7 @@
}
],
"payloadMimeType": [
"HL7v2"
"application/fhir+json"
],
"address": "127.0.0.1"
}
Expand Down Expand Up @@ -265,7 +265,7 @@
}
],
"payloadMimeType": [
"XDA/XDS"
"application/xml"
],
"address": "https://open.epic.com/Interface/XDS.b"
}
Expand Down Expand Up @@ -298,7 +298,7 @@
}
],
"payloadMimeType": [
"DICOM WADO-RS"
"application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
Expand Down Expand Up @@ -331,7 +331,7 @@
}
],
"payloadMimeType": [
"DICOM QIDO-RS"
"application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
Expand Down Expand Up @@ -364,7 +364,7 @@
}
],
"payloadMimeType": [
"DICOM STOW-RS"
"application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
Expand Down Expand Up @@ -397,7 +397,7 @@
}
],
"payloadMimeType": [
"DICOM STOW-RS"
"application/dicom"
],
"address": "https://pacs.hospital.org/dicomweb"
}
Expand Down Expand Up @@ -430,7 +430,7 @@
}
],
"payloadMimeType": [
"DICOM WADO-URI"
"application/dicom"
],
"address": "https://pacs.hospital.org/wadoUri"
}
Expand Down Expand Up @@ -463,7 +463,7 @@
}
],
"payloadMimeType": [
"IHE IID"
"application/dicom"
],
"address": "https://pacs.hospital.org/IHEInvokeImageDisplay"
}
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/json/provenance-example-sig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
]
}
],
"whoUri": "mailto://[email protected]"
"whoUri": "mailto:[email protected]"
}
],
"signature": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
<!-- this is the important element: a reference to a published document profile
note that this is a version specific reference. -->
<profile>
<reference value="http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"/>
<reference value="http://fhir.hl7.org/StructureDefinition/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"/>
</profile>
</document>
</CapabilityStatement>
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<sequence value="1"/>
<focal value="true"/>
<coverage>
<reference value="http://www.jurisdiction.com/nationalplan/123AB345"/>
<reference value="http://www.jurisdiction.com/Coverage/123AB345"/>
</coverage>
</insurance>

Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/xml/dataelement-example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
</binding>
<mapping>
<identity value="fhir"/>
<language value="application/xquery"/>
<language value="application/xml"/>
<map value="return f:/Patient/f:gender"/>
</mapping>
</element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
<code value="CDA-EventSummary"/>
</coding>
</payloadType>
<payloadMimeType value="PDF"/>
<payloadMimeType value="application/pdf"/>
<address value="https://sqlonfhir-dstu2.azurewebsites.net/fhir"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -244,7 +244,7 @@
<code value="REF-I12"/>
</coding>
</payloadType>
<payloadMimeType value="HL7v2"/>
<payloadMimeType value="application/fhir+json"/>
<address value="127.0.0.1"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -279,7 +279,7 @@
<code value="CDA-EventSummary"/>
</coding>
</payloadType>
<payloadMimeType value="XDA/XDS"/>
<payloadMimeType value="application/xml"/>
<address value="https://open.epic.com/Interface/XDS.b"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -314,7 +314,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="DICOM WADO-RS"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/dicomweb"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -349,7 +349,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="DICOM QIDO-RS"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/dicomweb"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -384,7 +384,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="DICOM STOW-RS"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/dicomweb"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -419,7 +419,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="DICOM STOW-RS"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/dicomweb"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -454,7 +454,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="DICOM WADO-URI"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/wadoUri"/>
</Endpoint>
</resource>
Expand Down Expand Up @@ -489,7 +489,7 @@
<code value="varies (application/dicom, application/dicom+xml, image/jpeg, and many more)"/>
</coding>
</payloadType>
<payloadMimeType value="IHE IID"/>
<payloadMimeType value="application/dicom"/>
<address value="https://pacs.hospital.org/IHEInvokeImageDisplay"/>
</Endpoint>
</resource>
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/xml/provenance-example-sig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<!-- very often, the user won't have a known system - these aren't available
for security system log ons. But where you can define it, you should.
Most of the time the userId is fully qualfied such as an email address -->
<whoUri value="mailto://[email protected]"/>
<whoUri value="mailto:[email protected]"/>
</agent>
<signature>
<!-- verification signature -->
Expand Down
Loading

0 comments on commit 9c6c376

Please sign in to comment.