Class: FHIR::StructureDefinition
- Defined in:
- lib/fhir_ext/StructureDefinition.rb,
lib/fhir/resources/StructureDefinition.rb
Defined Under Namespace
Classes: Contact, Differential, Mapping, Snapshot
Constant Summary collapse
- SEARCH_PARAMS =
["abstract", "base", "base-path", "code", "context", "context-type", "date", "derivation", "description", "display", "experimental", "ext-context", "identifier", "kind", "name", "path", "publisher", "status", "type", "url", "valueset", "version"]
- METADATA =
{ 'id' => {'type'=>'id', 'path'=>'StructureDefinition.id', 'min'=>0, 'max'=>1}, 'meta' => {'type'=>'Meta', 'path'=>'StructureDefinition.meta', 'min'=>0, 'max'=>1}, 'implicitRules' => {'type'=>'uri', 'path'=>'StructureDefinition.implicitRules', 'min'=>0, 'max'=>1}, 'language' => {'type'=>'code', 'path'=>'StructureDefinition.language', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'extensible', 'uri'=>'http://hl7.org/fhir/ValueSet/languages'}}, 'text' => {'type'=>'Narrative', 'path'=>'StructureDefinition.text', 'min'=>0, 'max'=>1}, 'contained' => {'type'=>'Resource', 'path'=>'StructureDefinition.contained', 'min'=>0, 'max'=>Float::INFINITY}, 'extension' => {'type'=>'Extension', 'path'=>'StructureDefinition.extension', 'min'=>0, 'max'=>Float::INFINITY}, 'modifierExtension' => {'type'=>'Extension', 'path'=>'StructureDefinition.modifierExtension', 'min'=>0, 'max'=>Float::INFINITY}, 'url' => {'type'=>'uri', 'path'=>'StructureDefinition.url', 'min'=>1, 'max'=>1}, 'identifier' => {'type'=>'Identifier', 'path'=>'StructureDefinition.identifier', 'min'=>0, 'max'=>Float::INFINITY}, 'version' => {'type'=>'string', 'path'=>'StructureDefinition.version', 'min'=>0, 'max'=>1}, 'name' => {'type'=>'string', 'path'=>'StructureDefinition.name', 'min'=>1, 'max'=>1}, 'display' => {'type'=>'string', 'path'=>'StructureDefinition.display', 'min'=>0, 'max'=>1}, 'status' => {'valid_codes'=>{'http://hl7.org/fhir/conformance-resource-status'=>['draft', 'active', 'retired', 'draft', 'active', 'retired']}, 'type'=>'code', 'path'=>'StructureDefinition.status', 'min'=>1, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/conformance-resource-status'}}, 'experimental' => {'type'=>'boolean', 'path'=>'StructureDefinition.experimental', 'min'=>0, 'max'=>1}, 'publisher' => {'type'=>'string', 'path'=>'StructureDefinition.publisher', 'min'=>0, 'max'=>1}, 'contact' => {'type'=>'StructureDefinition::Contact', 'path'=>'StructureDefinition.contact', 'min'=>0, 'max'=>Float::INFINITY}, 'date' => {'type'=>'dateTime', 'path'=>'StructureDefinition.date', 'min'=>0, 'max'=>1}, 'description' => {'type'=>'markdown', 'path'=>'StructureDefinition.description', 'min'=>0, 'max'=>1}, 'useContext' => {'valid_codes'=>{'https://www.usps.com/'=>['AK', 'AL', 'AR', 'AS', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'FM', 'GA', 'GU', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MH', 'MI', 'MN', 'MO', 'MP', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'PR', 'PW', 'RI', 'SC', 'SD', 'TN', 'TX', 'UM', 'UT', 'VA', 'VI', 'VT', 'WA', 'WI', 'WV', 'WY'], 'http://hl7.org/fhir/practitioner-specialty'=>['cardio', 'dent', 'dietary', 'midw', 'sysarch'], 'urn:iso:std:iso:3166'=>['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CS', 'CT', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DD', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DY', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FQ', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'HV', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM', 'JO', 'JP', 'JT', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MI', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NH', 'NI', 'NL', 'NO', 'NP', 'NQ', 'NR', 'NT', 'NU', 'NZ', 'OM', 'PA', 'PC', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PU', 'PW', 'PY', 'PZ', 'QA', 'RE', 'RH', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SU', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TP', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VD', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WK', 'WS', 'YD', 'YE', 'YT', 'YU', 'ZA', 'ZM', 'ZR', 'ZW'], 'http://unstats.un.org/unsd/methods/m49/m49.htm'=>['004', '008', '012', '016', '020', '024', '028', '031', '032', '036', '040', '044', '048', '050', '051', '052', '056', '060', '064', '068', '070', '072', '076', '084', '090', '092', '096', '100', '104', '108', '112', '116', '120', '124', '132', '136', '140', '144', '148', '152', '156', '170', '174', '175', '178', '180', '184', '188', '191', '192', '196', '203', '204', '208', '212', '214', '218', '222', '226', '231', '232', '233', '234', '238', '242', '246', '248', '250', '254', '258', '262', '266', '268', '270', '275', '276', '288', '292', '296', '300', '304', '308', '312', '316', '320', '324', '328', '332', '336', '340', '344', '348', '352', '356', '360', '364', '368', '372', '376', '380', '384', '388', '392', '398', '400', '404', '408', '410', '414', '417', '418', '422', '426', '428', '430', '434', '438', '440', '442', '446', '450', '454', '458', '462', '466', '470', '474', '478', '480', '484', '492', '496', '498', '499', '500', '504', '508', '512', '516', '520', '524', '528', '531', '533', '534', '535', '540', '548', '554', '558', '562', '566', '570', '574', '578', '580', '583', '584', '585', '586', '591', '598', '600', '604', '608', '612', '616', '620', '624', '626', '630', '634', '638', '642', '643', '646', '652', '654', '659', '660', '662', '663', '666', '670', '674', '678', '680', '682', '686', '688', '690', '694', '702', '703', '704', '705', '706', '710', '716', '724', '728', '729', '732', '740', '744', '748', '752', '756', '760', '762', '764', '768', '772', '776', '780', '784', '788', '792', '795', '796', '798', '800', '804', '807', '818', '826', '830', '831', '832', '833', '834', '840', '850', '854', '858', '860', '862', '876', '882', '887', '894']}, 'type'=>'CodeableConcept', 'path'=>'StructureDefinition.useContext', 'min'=>0, 'max'=>Float::INFINITY, 'binding'=>{'strength'=>'extensible', 'uri'=>'http://hl7.org/fhir/ValueSet/use-context'}}, 'requirements' => {'type'=>'markdown', 'path'=>'StructureDefinition.requirements', 'min'=>0, 'max'=>1}, 'copyright' => {'type'=>'string', 'path'=>'StructureDefinition.copyright', 'min'=>0, 'max'=>1}, 'code' => {'valid_codes'=>{'http://snomed.info/sct'=>[], 'http://loinc.org'=>[]}, 'type'=>'Coding', 'path'=>'StructureDefinition.code', 'min'=>0, 'max'=>Float::INFINITY, 'binding'=>{'strength'=>'example', 'uri'=>'http://hl7.org/fhir/ValueSet/profile-code'}}, 'fhirVersion' => {'type'=>'id', 'path'=>'StructureDefinition.fhirVersion', 'min'=>0, 'max'=>1}, 'mapping' => {'type'=>'StructureDefinition::Mapping', 'path'=>'StructureDefinition.mapping', 'min'=>0, 'max'=>Float::INFINITY}, 'kind' => {'valid_codes'=>{'http://hl7.org/fhir/structure-definition-kind'=>['primitive-type', 'complex-type', 'resource', 'logical', 'primitive-type', 'complex-type', 'resource', 'logical']}, 'type'=>'code', 'path'=>'StructureDefinition.kind', 'min'=>1, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/structure-definition-kind'}}, 'abstract' => {'type'=>'boolean', 'path'=>'StructureDefinition.abstract', 'min'=>1, 'max'=>1}, 'contextType' => {'valid_codes'=>{'http://hl7.org/fhir/extension-context'=>['resource', 'datatype', 'extension', 'resource', 'datatype', 'extension']}, 'type'=>'code', 'path'=>'StructureDefinition.contextType', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/extension-context'}}, 'context' => {'type'=>'string', 'path'=>'StructureDefinition.context', 'min'=>0, 'max'=>Float::INFINITY}, 'type' => {'valid_codes'=>{'http://hl7.org/fhir/data-types'=>['Address', 'Age', 'Annotation', 'Attachment', 'BackboneElement', 'CodeableConcept', 'Coding', 'ContactDetail', 'ContactPoint', 'Contributor', 'Count', 'DataRequirement', 'Distance', 'Duration', 'Element', 'ElementDefinition', 'Extension', 'HumanName', 'Identifier', 'Meta', 'Money', 'Narrative', 'ParameterDefinition', 'Period', 'Quantity', 'Range', 'Ratio', 'Reference', 'RelatedResource', 'SampledData', 'Signature', 'SimpleQuantity', 'Timing', 'TriggerDefinition', 'UsageContext', 'base64Binary', 'boolean', 'code', 'date', 'dateTime', 'decimal', 'id', 'instant', 'integer', 'markdown', 'oid', 'positiveInt', 'string', 'time', 'unsignedInt', 'uri', 'uuid', 'xhtml', 'Address', 'Age', 'Annotation', 'Attachment', 'BackboneElement', 'CodeableConcept', 'Coding', 'ContactDetail', 'ContactPoint', 'Contributor', 'Count', 'DataRequirement', 'Distance', 'Duration', 'Element', 'ElementDefinition', 'Extension', 'HumanName', 'Identifier', 'Meta', 'Money', 'Narrative', 'ParameterDefinition', 'Period', 'Quantity', 'Range', 'Ratio', 'Reference', 'RelatedResource', 'SampledData', 'Signature', 'SimpleQuantity', 'Timing', 'TriggerDefinition', 'UsageContext', 'base64Binary', 'boolean', 'code', 'date', 'dateTime', 'decimal', 'id', 'instant', 'integer', 'markdown', 'oid', 'positiveInt', 'string', 'time', 'unsignedInt', 'uri', 'uuid', 'xhtml'], 'http://hl7.org/fhir/resource-types'=>['Account', 'ActivityDefinition', 'AllergyIntolerance', 'Appointment', 'AppointmentResponse', 'AuditEvent', 'Basic', 'Binary', 'BodySite', 'Bundle', 'CarePlan', 'CareTeam', 'Claim', 'ClaimResponse', 'ClinicalImpression', 'CodeSystem', 'Communication', 'CommunicationRequest', 'CompartmentDefinition', 'Composition', 'ConceptMap', 'Condition', 'Conformance', 'Consent', 'Contract', 'Coverage', 'DataElement', 'DecisionSupportServiceModule', 'DetectedIssue', 'Device', 'DeviceComponent', 'DeviceMetric', 'DeviceUseRequest', 'DeviceUseStatement', 'DiagnosticReport', 'DiagnosticRequest', 'DocumentManifest', 'DocumentReference', 'DomainResource', 'EligibilityRequest', 'EligibilityResponse', 'Encounter', 'Endpoint', 'EnrollmentRequest', 'EnrollmentResponse', 'EpisodeOfCare', 'ExpansionProfile', 'ExplanationOfBenefit', 'FamilyMemberHistory', 'Flag', 'Goal', 'Group', 'GuidanceResponse', 'HealthcareService', 'ImagingManifest', 'ImagingStudy', 'Immunization', 'ImmunizationRecommendation', 'ImplementationGuide', 'Library', 'Linkage', 'List', 'Location', 'Measure', 'MeasureReport', 'Media', 'Medication', 'MedicationAdministration', 'MedicationDispense', 'MedicationOrder', 'MedicationStatement', 'MessageHeader', 'NamingSystem', 'NutritionRequest', 'Observation', 'OperationDefinition', 'OperationOutcome', 'Organization', 'Parameters', 'Patient', 'PaymentNotice', 'PaymentReconciliation', 'Person', 'PlanDefinition', 'Practitioner', 'PractitionerRole', 'Procedure', 'ProcedureRequest', 'ProcessRequest', 'ProcessResponse', 'Provenance', 'Questionnaire', 'QuestionnaireResponse', 'ReferralRequest', 'RelatedPerson', 'Resource', 'RiskAssessment', 'Schedule', 'SearchParameter', 'Sequence', 'Slot', 'Specimen', 'StructureDefinition', 'StructureMap', 'Subscription', 'Substance', 'SupplyDelivery', 'SupplyRequest', 'Task', 'TestScript', 'ValueSet', 'VisionPrescription', 'Account', 'ActivityDefinition', 'AllergyIntolerance', 'Appointment', 'AppointmentResponse', 'AuditEvent', 'Basic', 'Binary', 'BodySite', 'Bundle', 'CarePlan', 'CareTeam', 'Claim', 'ClaimResponse', 'ClinicalImpression', 'CodeSystem', 'Communication', 'CommunicationRequest', 'CompartmentDefinition', 'Composition', 'ConceptMap', 'Condition', 'Conformance', 'Consent', 'Contract', 'Coverage', 'DataElement', 'DecisionSupportServiceModule', 'DetectedIssue', 'Device', 'DeviceComponent', 'DeviceMetric', 'DeviceUseRequest', 'DeviceUseStatement', 'DiagnosticReport', 'DiagnosticRequest', 'DocumentManifest', 'DocumentReference', 'DomainResource', 'EligibilityRequest', 'EligibilityResponse', 'Encounter', 'Endpoint', 'EnrollmentRequest', 'EnrollmentResponse', 'EpisodeOfCare', 'ExpansionProfile', 'ExplanationOfBenefit', 'FamilyMemberHistory', 'Flag', 'Goal', 'Group', 'GuidanceResponse', 'HealthcareService', 'ImagingManifest', 'ImagingStudy', 'Immunization', 'ImmunizationRecommendation', 'ImplementationGuide', 'Library', 'Linkage', 'List', 'Location', 'Measure', 'MeasureReport', 'Media', 'Medication', 'MedicationAdministration', 'MedicationDispense', 'MedicationOrder', 'MedicationStatement', 'MessageHeader', 'NamingSystem', 'NutritionRequest', 'Observation', 'OperationDefinition', 'OperationOutcome', 'Organization', 'Parameters', 'Patient', 'PaymentNotice', 'PaymentReconciliation', 'Person', 'PlanDefinition', 'Practitioner', 'PractitionerRole', 'Procedure', 'ProcedureRequest', 'ProcessRequest', 'ProcessResponse', 'Provenance', 'Questionnaire', 'QuestionnaireResponse', 'ReferralRequest', 'RelatedPerson', 'Resource', 'RiskAssessment', 'Schedule', 'SearchParameter', 'Sequence', 'Slot', 'Specimen', 'StructureDefinition', 'StructureMap', 'Subscription', 'Substance', 'SupplyDelivery', 'SupplyRequest', 'Task', 'TestScript', 'ValueSet', 'VisionPrescription']}, 'type'=>'code', 'path'=>'StructureDefinition.type', 'min'=>1, 'max'=>1, 'binding'=>{'strength'=>'extensible', 'uri'=>'http://hl7.org/fhir/ValueSet/defined-types'}}, 'baseDefinition' => {'type'=>'uri', 'path'=>'StructureDefinition.baseDefinition', 'min'=>0, 'max'=>1}, 'derivation' => {'valid_codes'=>{'http://hl7.org/fhir/type-derivation-rule'=>['specialization', 'constraint', 'specialization', 'constraint']}, 'type'=>'code', 'path'=>'StructureDefinition.derivation', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/type-derivation-rule'}}, 'snapshot' => {'type'=>'StructureDefinition::Snapshot', 'path'=>'StructureDefinition.snapshot', 'min'=>0, 'max'=>1}, 'differential' => {'type'=>'StructureDefinition::Differential', 'path'=>'StructureDefinition.differential', 'min'=>0, 'max'=>1} }
Instance Attribute Summary collapse
-
#abstract ⇒ Object
1-1 boolean.
-
#baseDefinition ⇒ Object
0-1 uri.
-
#code ⇒ Object
0-* [ Coding ].
-
#contact ⇒ Object
0-* [ StructureDefinition::Contact ].
-
#contained ⇒ Object
0-* [ Resource ].
-
#context ⇒ Object
0-* [ string ].
-
#contextType ⇒ Object
0-1 code.
-
#copyright ⇒ Object
0-1 string.
-
#date ⇒ Object
0-1 dateTime.
-
#derivation ⇒ Object
0-1 code.
-
#description ⇒ Object
0-1 markdown.
-
#differential ⇒ Object
0-1 StructureDefinition::Differential.
-
#display ⇒ Object
0-1 string.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#experimental ⇒ Object
0-1 boolean.
-
#extension ⇒ Object
0-* [ Extension ].
-
#fhirVersion ⇒ Object
0-1 id.
-
#finding ⇒ Object
Returns the value of attribute finding.
-
#id ⇒ Object
0-1 id.
-
#identifier ⇒ Object
0-* [ Identifier ].
-
#implicitRules ⇒ Object
0-1 uri.
-
#kind ⇒ Object
1-1 code.
-
#language ⇒ Object
0-1 code.
-
#mapping ⇒ Object
0-* [ StructureDefinition::Mapping ].
-
#meta ⇒ Object
0-1 Meta.
-
#modifierExtension ⇒ Object
0-* [ Extension ].
-
#name ⇒ Object
1-1 string.
-
#publisher ⇒ Object
0-1 string.
-
#requirements ⇒ Object
0-1 markdown.
-
#snapshot ⇒ Object
0-1 StructureDefinition::Snapshot.
-
#status ⇒ Object
1-1 code.
-
#text ⇒ Object
0-1 Narrative.
-
#type ⇒ Object
1-1 code.
-
#url ⇒ Object
1-1 uri.
-
#useContext ⇒ Object
0-* [ CodeableConcept ].
-
#version ⇒ Object
0-1 string.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#compare_extension_definition(x, y, another_definition) ⇒ Object
private.
- #deep_copy(thing) ⇒ Object
- #get_element_by_path(path, elements = snapshot.element) ⇒ Object
- #get_extension(extension, elements = snapshot.element) ⇒ Object
-
#is_compatible?(another_definition) ⇒ Boolean
Checks whether or not “another_definition” is compatible with this definition.
- #is_some_type_of_xml_or_json(code) ⇒ Object
- #resourceType ⇒ Object
- #validate_resource(resource) ⇒ Object
-
#validates_resource?(resource) ⇒ Boolean
————————————————————————- Profile Validation ————————————————————————-.
Methods included from Xml
from_xml, is_valid?, #to_xml, validate
Methods included from Json
Methods included from Hashable
Methods inherited from Model
#attribute_mismatch, #compare_attribute, #equals?, #initialize, #is_valid?, #method_missing, #mismatch, #to_reference, #validate, #validate_profile
Constructor Details
This class inherits a constructor from FHIR::Model
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FHIR::Model
Instance Attribute Details
#abstract ⇒ Object
1-1 boolean
151 152 153 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 151 def abstract @abstract end |
#baseDefinition ⇒ Object
0-1 uri
155 156 157 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 155 def baseDefinition @baseDefinition end |
#code ⇒ Object
0-* [ Coding ]
147 148 149 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 147 def code @code end |
#contact ⇒ Object
0-* [ StructureDefinition::Contact ]
141 142 143 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 141 def contact @contact end |
#contained ⇒ Object
0-* [ Resource ]
130 131 132 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 130 def contained @contained end |
#context ⇒ Object
0-* [ string ]
153 154 155 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 153 def context @context end |
#contextType ⇒ Object
0-1 code
152 153 154 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 152 def contextType @contextType end |
#copyright ⇒ Object
0-1 string
146 147 148 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 146 def copyright @copyright end |
#date ⇒ Object
0-1 dateTime
142 143 144 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 142 def date @date end |
#derivation ⇒ Object
0-1 code
156 157 158 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 156 def derivation @derivation end |
#description ⇒ Object
0-1 markdown
143 144 145 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 143 def description @description end |
#differential ⇒ Object
0-1 StructureDefinition::Differential
158 159 160 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 158 def differential @differential end |
#display ⇒ Object
0-1 string
137 138 139 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 137 def display @display end |
#errors ⇒ Object
Returns the value of attribute errors.
5 6 7 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 5 def errors @errors end |
#experimental ⇒ Object
0-1 boolean
139 140 141 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 139 def experimental @experimental end |
#extension ⇒ Object
0-* [ Extension ]
131 132 133 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 131 def extension @extension end |
#fhirVersion ⇒ Object
0-1 id
148 149 150 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 148 def fhirVersion @fhirVersion end |
#finding ⇒ Object
Returns the value of attribute finding.
4 5 6 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 4 def finding @finding end |
#id ⇒ Object
0-1 id
125 126 127 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 125 def id @id end |
#identifier ⇒ Object
0-* [ Identifier ]
134 135 136 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 134 def identifier @identifier end |
#implicitRules ⇒ Object
0-1 uri
127 128 129 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 127 def implicitRules @implicitRules end |
#kind ⇒ Object
1-1 code
150 151 152 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 150 def kind @kind end |
#language ⇒ Object
0-1 code
128 129 130 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 128 def language @language end |
#mapping ⇒ Object
0-* [ StructureDefinition::Mapping ]
149 150 151 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 149 def mapping @mapping end |
#meta ⇒ Object
0-1 Meta
126 127 128 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 126 def @meta end |
#modifierExtension ⇒ Object
0-* [ Extension ]
132 133 134 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 132 def modifierExtension @modifierExtension end |
#name ⇒ Object
1-1 string
136 137 138 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 136 def name @name end |
#publisher ⇒ Object
0-1 string
140 141 142 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 140 def publisher @publisher end |
#requirements ⇒ Object
0-1 markdown
145 146 147 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 145 def requirements @requirements end |
#snapshot ⇒ Object
0-1 StructureDefinition::Snapshot
157 158 159 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 157 def snapshot @snapshot end |
#status ⇒ Object
1-1 code
138 139 140 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 138 def status @status end |
#text ⇒ Object
0-1 Narrative
129 130 131 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 129 def text @text end |
#type ⇒ Object
1-1 code
154 155 156 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 154 def type @type end |
#url ⇒ Object
1-1 uri
133 134 135 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 133 def url @url end |
#useContext ⇒ Object
0-* [ CodeableConcept ]
144 145 146 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 144 def useContext @useContext end |
#version ⇒ Object
0-1 string
135 136 137 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 135 def version @version end |
#warnings ⇒ Object
Returns the value of attribute warnings.
6 7 8 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 6 def warnings @warnings end |
Instance Method Details
#compare_extension_definition(x, y, another_definition) ⇒ Object
private
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 225 def compare_extension_definition(x,y,another_definition) x_profiles = x.type.map{|t|t.profile} y_profiles = y.type.map{|t|t.profile} x_only = x_profiles - y_profiles y_only = y_profiles - x_profiles shared = x_profiles - x_only if !shared.nil? && shared.size==0 # same name, but different profiles # maybe the profiles are the same, just with different URLs... # ... so we have to compare them, if we can. @warnings << @finding.warning("#{x.path} (#{x.name})",'type.profile','Different Profiles',"#{x_profiles}","#{y_profiles}") x_extension = FHIR::Definitions.get_extension_definition(x.type[0].profile) y_extension = FHIR::Definitions.get_extension_definition(y.type[0].profile) if !x_extension.nil? && !y_extension.nil? x_extension.is_compatible?(y_extension) @errors << x_extension.errors @warnings << x_extension.warnings else @warnings << @finding.warning("#{x.path} (#{x.name})",'','Could not find extension definitions to compare.','','') end else compare_element_definitions(x,y,another_definition) end end |
#deep_copy(thing) ⇒ Object
541 542 543 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 541 def deep_copy(thing) JSON.parse(JSON.unparse(thing)) end |
#get_element_by_path(path, elements = snapshot.element) ⇒ Object
149 150 151 152 153 154 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 149 def get_element_by_path(path,elements=snapshot.element) elements.each do |element| return element if element.path==path end nil end |
#get_extension(extension, elements = snapshot.element) ⇒ Object
156 157 158 159 160 161 162 163 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 156 def get_extension(extension,elements=snapshot.element) elements.each do |element| if element.path.include?('extension') || element.type.map{|t|t.code}.include?('Extension') return element if element.name==extension || element.type.map{|t|t.profile}.include?(extension) end end nil end |
#is_compatible?(another_definition) ⇒ Boolean
Checks whether or not “another_definition” is compatible with this definition. If they have conflicting elements, restrictions, bindings, modifying extensions, etc.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 14 def is_compatible?(another_definition) @errors = [] @warnings = [] @finding = FHIR::StructureDefinitionFinding.new @finding.resourceType = snapshot.element[0].path @finding.profileIdA = id @finding.profileIdB = another_definition.id if another_definition.respond_to?(:id) if !(another_definition.is_a? FHIR::StructureDefinition) @errors << @finding.error('','','Not a StructureDefinition','StructureDefinition',"#{another_definition.class.name}") return false elsif another_definition.snapshot.element[0].path!=snapshot.element[0].path @errors << @finding.error('','','Incompatible resourceType',@finding.resourceType, "#{another_definition.snapshot.element[0].path}") return false end left_elements = Array.new(snapshot.element) right_elements = Array.new(another_definition.snapshot.element) left_paths = left_elements.map { |e| e.path } right_paths = right_elements.map { |e| e.path } # StructureDefinitions don't always include all base attributes (for example, of a ContactPoint) # if nothing is modified from the base definition, so we have to add them in if they are missing. base_definition = FHIR::Definitions.get_resource_definition(snapshot.element[0].path) base_elements = base_definition.snapshot.element left_missing = right_paths - left_paths # left_missing_roots = left_missing.map{|e| e.split('.')[0..-2].join('.') }.uniq add_missing_elements(id,left_missing,left_elements,base_elements) right_missing = left_paths - right_paths # right_missing_roots = right_missing.map{|e| e.split('.')[0..-2].join('.') }.uniq add_missing_elements(another_definition.id,right_missing,right_elements,base_elements) # update paths left_paths = left_elements.map { |e| e.path } right_paths = right_elements.map { |e| e.path } # recalculate the missing attributes left_missing = right_paths - left_paths right_missing = left_paths - right_paths # generate warnings for missing fields (ignoring extensions) left_missing.each do |e| if !e.include? 'extension' elem = get_element_by_path(e,right_elements) if !elem.min.nil? && elem.min > 0 @errors << @finding.error(e,'min','Missing REQUIRED element','Missing',"#{elem.min}") elsif elem.isModifier==true @errors << @finding.error(e,'isModifier','Missing MODIFIER element','Missing',"#{elem.isModifier}") else @warnings << @finding.warning(e,'','Missing element','Missing','Defined') end end end right_missing.each do |e| if !e.include? 'extension' elem = get_element_by_path(e,left_elements) if !elem.min.nil? && elem.min > 0 @errors << @finding.error(e,'min','Missing REQUIRED element',"#{elem.min}",'Missing') elsif elem.isModifier==true @errors << @finding.error(e,'isModifier','Missing MODIFIER element',"#{elem.isModifier}",'Missing') else @warnings << @finding.warning(e,'','Missing element','Defined','Missing') end end end left_extensions = [] right_extensions = [] # compare elements, starting with the elements in this definition left_elements.each do |x| if x.path.include? 'extension' # handle extensions separately left_extensions << x else y = get_element_by_path(x.path,right_elements) compare_element_definitions(x,y,another_definition) end end # now compare elements defined in the other definition, if we haven't already looked at them right_elements.each do |y| if y.path.include? 'extension' # handle extensions separately right_extensions << y elsif left_missing.include? y.path x = get_element_by_path(y.path,left_elements) compare_element_definitions(x,y,another_definition) end end # finally, compare the extensions. checked_extensions = [] left_extensions.each do |x| y = get_extension(x.name,right_extensions) if !y.nil? # both profiles share an extension with the same name checked_extensions << x.name compare_extension_definition(x,y,another_definition) end y = nil y = get_extension(x.type[0].profile,right_extensions) if !y.nil? && x.name!=y.name # both profiles share the same extension definition but with a different name checked_extensions << x.name checked_extensions << y.name compare_element_definitions(x,y,another_definition) end end right_extensions.each do |y| next if checked_extensions.include?(y.name) x = get_extension(y.name,left_extensions) if !x.nil? # both profiles share an extension with the same name checked_extensions << y.name compare_extension_definition(x,y,another_definition) end x = nil x = get_extension(y.type[0].profile,left_extensions) if !x.nil? && x.name!=y.name && !checked_extensions.include?(x.name) # both profiles share the same extension definition but with a different name checked_extensions << x.name checked_extensions << y.name compare_element_definitions(x,y,another_definition) end end @errors.flatten! @warnings.flatten! @errors.size==0 end |
#is_some_type_of_xml_or_json(code) ⇒ Object
699 700 701 702 703 704 705 706 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 699 def is_some_type_of_xml_or_json(code) m = code.downcase return true if m=='xml' || m=='json' return true if (m.starts_with?('application/') || m.starts_with?('text/')) && (m.ends_with?('json') || m.ends_with?('xml')) return true if (m.starts_with?('application/xml') || m.starts_with?('text/xml')) return true if (m.starts_with?('application/json') || m.starts_with?('text/json')) false end |
#resourceType ⇒ Object
160 161 162 |
# File 'lib/fhir/resources/StructureDefinition.rb', line 160 def resourceType 'StructureDefinition' end |
#validate_resource(resource) ⇒ Object
397 398 399 400 401 402 403 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 397 def validate_resource(resource) @errors = [] @warnings = [] @errors << "#{resource.class} is not a resource." unless resource.is_a?(FHIR::Model) is_valid_json?(resource.to_json) if resource @errors end |
#validates_resource?(resource) ⇒ Boolean
Profile Validation
393 394 395 |
# File 'lib/fhir_ext/StructureDefinition.rb', line 393 def validates_resource?(resource) validate_resource(resource).empty? end |