fhir_dstu2_models 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.github/workflows/ruby.yml +2 -1
- data/.rubocop.yml +7 -1
- data/.rubocop_todo.yml +56 -161
- data/.ruby-version +1 -0
- data/.simplecov +1 -5
- data/.tool-versions +1 -0
- data/Gemfile.lock +37 -35
- data/Guardfile +1 -1
- data/fhir_dstu2_models.gemspec +2 -1
- data/lib/fhir_dstu2_models/bootstrap/definitions.rb +18 -4
- data/lib/fhir_dstu2_models/bootstrap/field.rb +2 -2
- data/lib/fhir_dstu2_models/bootstrap/generator.rb +6 -4
- data/lib/fhir_dstu2_models/bootstrap/hashable.rb +6 -5
- data/lib/fhir_dstu2_models/bootstrap/json.rb +2 -2
- data/lib/fhir_dstu2_models/bootstrap/model.rb +45 -32
- data/lib/fhir_dstu2_models/bootstrap/preprocess.rb +19 -11
- data/lib/fhir_dstu2_models/bootstrap/xml.rb +9 -7
- data/lib/fhir_dstu2_models/deprecate.rb +1 -0
- data/lib/fhir_dstu2_models/fhir/metadata.rb +19 -21
- data/lib/fhir_dstu2_models/fhir/resources/Account.rb +20 -20
- data/lib/fhir_dstu2_models/fhir/resources/AllergyIntolerance.rb +34 -34
- data/lib/fhir_dstu2_models/fhir/resources/Appointment.rb +28 -28
- data/lib/fhir_dstu2_models/fhir/resources/AppointmentResponse.rb +17 -17
- data/lib/fhir_dstu2_models/fhir/resources/AuditEvent.rb +66 -66
- data/lib/fhir_dstu2_models/fhir/resources/Basic.rb +14 -14
- data/lib/fhir_dstu2_models/fhir/resources/Binary.rb +7 -7
- data/lib/fhir_dstu2_models/fhir/resources/BodySite.rb +15 -15
- data/lib/fhir_dstu2_models/fhir/resources/Bundle.rb +45 -45
- data/lib/fhir_dstu2_models/fhir/resources/CarePlan.rb +63 -63
- data/lib/fhir_dstu2_models/fhir/resources/Claim.rb +118 -118
- data/lib/fhir_dstu2_models/fhir/resources/ClaimResponse.rb +122 -124
- data/lib/fhir_dstu2_models/fhir/resources/ClinicalImpression.rb +42 -42
- data/lib/fhir_dstu2_models/fhir/resources/Communication.rb +28 -28
- data/lib/fhir_dstu2_models/fhir/resources/CommunicationRequest.rb +30 -30
- data/lib/fhir_dstu2_models/fhir/resources/Composition.rb +46 -46
- data/lib/fhir_dstu2_models/fhir/resources/ConceptMap.rb +53 -53
- data/lib/fhir_dstu2_models/fhir/resources/Condition.rb +44 -44
- data/lib/fhir_dstu2_models/fhir/resources/Conformance.rb +138 -138
- data/lib/fhir_dstu2_models/fhir/resources/Contract.rb +98 -98
- data/lib/fhir_dstu2_models/fhir/resources/Coverage.rb +23 -23
- data/lib/fhir_dstu2_models/fhir/resources/DataElement.rb +35 -35
- data/lib/fhir_dstu2_models/fhir/resources/DetectedIssue.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/Device.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/DeviceComponent.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/DeviceMetric.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/DeviceUseRequest.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/DeviceUseStatement.rb +21 -21
- data/lib/fhir_dstu2_models/fhir/resources/DiagnosticOrder.rb +36 -36
- data/lib/fhir_dstu2_models/fhir/resources/DiagnosticReport.rb +32 -32
- data/lib/fhir_dstu2_models/fhir/resources/DocumentManifest.rb +31 -31
- data/lib/fhir_dstu2_models/fhir/resources/DocumentReference.rb +51 -51
- data/lib/fhir_dstu2_models/fhir/resources/DomainResource.rb +12 -12
- data/lib/fhir_dstu2_models/fhir/resources/EligibilityRequest.rb +16 -16
- data/lib/fhir_dstu2_models/fhir/resources/EligibilityResponse.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/Encounter.rb +59 -59
- data/lib/fhir_dstu2_models/fhir/resources/EnrollmentRequest.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/EnrollmentResponse.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/EpisodeOfCare.rb +31 -31
- data/lib/fhir_dstu2_models/fhir/resources/ExplanationOfBenefit.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/FamilyMemberHistory.rb +39 -39
- data/lib/fhir_dstu2_models/fhir/resources/Flag.rb +17 -17
- data/lib/fhir_dstu2_models/fhir/resources/Goal.rb +30 -30
- data/lib/fhir_dstu2_models/fhir/resources/Group.rb +33 -33
- data/lib/fhir_dstu2_models/fhir/resources/HealthcareService.rb +48 -48
- data/lib/fhir_dstu2_models/fhir/resources/ImagingObjectSelection.rb +41 -41
- data/lib/fhir_dstu2_models/fhir/resources/ImagingStudy.rb +48 -48
- data/lib/fhir_dstu2_models/fhir/resources/Immunization.rb +52 -52
- data/lib/fhir_dstu2_models/fhir/resources/ImmunizationRecommendation.rb +35 -35
- data/lib/fhir_dstu2_models/fhir/resources/ImplementationGuide.rb +67 -67
- data/lib/fhir_dstu2_models/fhir/resources/List.rb +29 -29
- data/lib/fhir_dstu2_models/fhir/resources/Location.rb +27 -27
- data/lib/fhir_dstu2_models/fhir/resources/Media.rb +21 -21
- data/lib/fhir_dstu2_models/fhir/resources/Medication.rb +40 -40
- data/lib/fhir_dstu2_models/fhir/resources/MedicationAdministration.rb +36 -36
- data/lib/fhir_dstu2_models/fhir/resources/MedicationDispense.rb +49 -49
- data/lib/fhir_dstu2_models/fhir/resources/MedicationOrder.rb +57 -57
- data/lib/fhir_dstu2_models/fhir/resources/MedicationStatement.rb +41 -41
- data/lib/fhir_dstu2_models/fhir/resources/MessageHeader.rb +40 -40
- data/lib/fhir_dstu2_models/fhir/resources/NamingSystem.rb +34 -34
- data/lib/fhir_dstu2_models/fhir/resources/NutritionOrder.rb +67 -67
- data/lib/fhir_dstu2_models/fhir/resources/Observation.rb +68 -68
- data/lib/fhir_dstu2_models/fhir/resources/OperationDefinition.rb +51 -51
- data/lib/fhir_dstu2_models/fhir/resources/OperationOutcome.rb +21 -21
- data/lib/fhir_dstu2_models/fhir/resources/Order.rb +23 -23
- data/lib/fhir_dstu2_models/fhir/resources/OrderResponse.rb +16 -16
- data/lib/fhir_dstu2_models/fhir/resources/Organization.rb +24 -24
- data/lib/fhir_dstu2_models/fhir/resources/Parameters.rb +48 -48
- data/lib/fhir_dstu2_models/fhir/resources/Patient.rb +54 -54
- data/lib/fhir_dstu2_models/fhir/resources/PaymentNotice.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/PaymentReconciliation.rb +39 -39
- data/lib/fhir_dstu2_models/fhir/resources/Person.rb +24 -24
- data/lib/fhir_dstu2_models/fhir/resources/Practitioner.rb +36 -36
- data/lib/fhir_dstu2_models/fhir/resources/Procedure.rb +42 -42
- data/lib/fhir_dstu2_models/fhir/resources/ProcedureRequest.rb +27 -27
- data/lib/fhir_dstu2_models/fhir/resources/ProcessRequest.rb +29 -29
- data/lib/fhir_dstu2_models/fhir/resources/ProcessResponse.rb +27 -27
- data/lib/fhir_dstu2_models/fhir/resources/Provenance.rb +39 -39
- data/lib/fhir_dstu2_models/fhir/resources/Questionnaire.rb +40 -40
- data/lib/fhir_dstu2_models/fhir/resources/QuestionnaireResponse.rb +50 -50
- data/lib/fhir_dstu2_models/fhir/resources/ReferralRequest.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/RelatedPerson.rb +19 -19
- data/lib/fhir_dstu2_models/fhir/resources/Resource.rb +5 -5
- data/lib/fhir_dstu2_models/fhir/resources/RiskAssessment.rb +30 -30
- data/lib/fhir_dstu2_models/fhir/resources/Schedule.rb +14 -14
- data/lib/fhir_dstu2_models/fhir/resources/SearchParameter.rb +29 -29
- data/lib/fhir_dstu2_models/fhir/resources/Slot.rb +17 -17
- data/lib/fhir_dstu2_models/fhir/resources/Specimen.rb +45 -45
- data/lib/fhir_dstu2_models/fhir/resources/StructureDefinition.rb +54 -54
- data/lib/fhir_dstu2_models/fhir/resources/Subscription.rb +24 -24
- data/lib/fhir_dstu2_models/fhir/resources/Substance.rb +26 -26
- data/lib/fhir_dstu2_models/fhir/resources/SupplyDelivery.rb +20 -20
- data/lib/fhir_dstu2_models/fhir/resources/SupplyRequest.rb +25 -25
- data/lib/fhir_dstu2_models/fhir/resources/TestScript.rb +140 -140
- data/lib/fhir_dstu2_models/fhir/resources/ValueSet.rb +108 -108
- data/lib/fhir_dstu2_models/fhir/resources/VisionPrescription.rb +35 -35
- data/lib/fhir_dstu2_models/fhir/types/Address.rb +16 -16
- data/lib/fhir_dstu2_models/fhir/types/Annotation.rb +10 -10
- data/lib/fhir_dstu2_models/fhir/types/Attachment.rb +14 -14
- data/lib/fhir_dstu2_models/fhir/types/BackboneElement.rb +7 -7
- data/lib/fhir_dstu2_models/fhir/types/CodeableConcept.rb +8 -8
- data/lib/fhir_dstu2_models/fhir/types/Coding.rb +11 -11
- data/lib/fhir_dstu2_models/fhir/types/ContactPoint.rb +11 -11
- data/lib/fhir_dstu2_models/fhir/types/Element.rb +3 -3
- data/lib/fhir_dstu2_models/fhir/types/ElementDefinition.rb +263 -263
- data/lib/fhir_dstu2_models/fhir/types/Extension.rb +40 -40
- data/lib/fhir_dstu2_models/fhir/types/HumanName.rb +13 -13
- data/lib/fhir_dstu2_models/fhir/types/Identifier.rb +12 -12
- data/lib/fhir_dstu2_models/fhir/types/Meta.rb +11 -11
- data/lib/fhir_dstu2_models/fhir/types/Narrative.rb +8 -8
- data/lib/fhir_dstu2_models/fhir/types/Period.rb +8 -8
- data/lib/fhir_dstu2_models/fhir/types/Quantity.rb +11 -11
- data/lib/fhir_dstu2_models/fhir/types/Range.rb +8 -8
- data/lib/fhir_dstu2_models/fhir/types/Ratio.rb +8 -8
- data/lib/fhir_dstu2_models/fhir/types/Reference.rb +5 -5
- data/lib/fhir_dstu2_models/fhir/types/SampledData.rb +13 -13
- data/lib/fhir_dstu2_models/fhir/types/Signature.rb +12 -12
- data/lib/fhir_dstu2_models/fhir/types/Timing.rb +24 -24
- data/lib/fhir_dstu2_models/fhir.rb +7 -6
- data/lib/fhir_dstu2_models/fhir_ext/element_definition.rb +3 -0
- data/lib/fhir_dstu2_models/fhir_ext/structure_definition.rb +19 -14
- data/lib/fhir_dstu2_models/fhir_ext/structure_definition_compare.rb +10 -0
- data/lib/fhir_dstu2_models/fhir_ext/structure_definition_finding.rb +2 -2
- data/lib/fhir_dstu2_models/fluentpath/evaluate.rb +18 -11
- data/lib/fhir_dstu2_models/fluentpath/expression.rb +3 -5
- data/lib/fhir_dstu2_models/fluentpath/parse.rb +7 -4
- data/lib/fhir_dstu2_models/version.rb +1 -1
- metadata +11 -9
@@ -5,18 +5,18 @@ module FHIR
|
|
5
5
|
include FHIR::DSTU2::Json
|
6
6
|
include FHIR::DSTU2::Xml
|
7
7
|
|
8
|
-
SEARCH_PARAMS =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
SEARCH_PARAMS =
|
9
|
+
METADATA = {
|
10
|
+
'id' => { 'type' => 'id', 'path' => 'SampledData.id', 'min' => 0, 'max' => 1 },
|
11
|
+
'extension' => { 'type' => 'Extension', 'path' => 'SampledData.extension', 'min' => 0, 'max' => Float::INFINITY },
|
12
|
+
'origin' => { 'type' => 'Quantity', 'path' => 'SampledData.origin', 'min' => 1, 'max' => 1 },
|
13
|
+
'period' => { 'type' => 'decimal', 'path' => 'SampledData.period', 'min' => 1, 'max' => 1 },
|
14
|
+
'factor' => { 'type' => 'decimal', 'path' => 'SampledData.factor', 'min' => 0, 'max' => 1 },
|
15
|
+
'lowerLimit' => { 'type' => 'decimal', 'path' => 'SampledData.lowerLimit', 'min' => 0, 'max' => 1 },
|
16
|
+
'upperLimit' => { 'type' => 'decimal', 'path' => 'SampledData.upperLimit', 'min' => 0, 'max' => 1 },
|
17
|
+
'dimensions' => { 'type' => 'positiveInt', 'path' => 'SampledData.dimensions', 'min' => 1, 'max' => 1 },
|
18
|
+
'data' => { 'type' => 'string', 'path' => 'SampledData.data', 'min' => 1, 'max' => 1 }
|
19
|
+
}
|
20
20
|
|
21
21
|
attr_accessor :id # 0-1 id
|
22
22
|
attr_accessor :extension # 0-* [ Extension ]
|
@@ -29,4 +29,4 @@ module FHIR
|
|
29
29
|
attr_accessor :data # 1-1 string
|
30
30
|
end
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
@@ -8,17 +8,17 @@ module FHIR
|
|
8
8
|
MULTIPLE_TYPES = {
|
9
9
|
'who' => ['uri', 'Reference']
|
10
10
|
}
|
11
|
-
SEARCH_PARAMS =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
SEARCH_PARAMS =
|
12
|
+
METADATA = {
|
13
|
+
'id' => { 'type' => 'id', 'path' => 'Signature.id', 'min' => 0, 'max' => 1 },
|
14
|
+
'extension' => { 'type' => 'Extension', 'path' => 'Signature.extension', 'min' => 0, 'max' => Float::INFINITY },
|
15
|
+
'type' => { 'valid_codes' => { 'http://hl7.org/fhir/valueset-signature-type' => ['1.2.840.10065.1.12.1.1', '1.2.840.10065.1.12.1.2', '1.2.840.10065.1.12.1.3', '1.2.840.10065.1.12.1.4', '1.2.840.10065.1.12.1.5', '1.2.840.10065.1.12.1.6', '1.2.840.10065.1.12.1.7', '1.2.840.10065.1.12.1.8', '1.2.840.10065.1.12.1.9', '1.2.840.10065.1.12.1.10', '1.2.840.10065.1.12.1.11', '1.2.840.10065.1.12.1.12', '1.2.840.10065.1.12.1.13', '1.2.840.10065.1.12.1.14', '1.2.840.10065.1.12.1.15', '1.2.840.10065.1.12.1.16', '1.2.840.10065.1.12.1.17'] }, 'type' => 'Coding', 'path' => 'Signature.type', 'min' => 1, 'max' => Float::INFINITY, 'binding' => { 'strength' => 'preferred', 'uri' => 'http://hl7.org/fhir/ValueSet/signature-type' } },
|
16
|
+
'when' => { 'type' => 'instant', 'path' => 'Signature.when', 'min' => 1, 'max' => 1 },
|
17
|
+
'whoUri' => { 'type' => 'uri', 'path' => 'Signature.who[x]', 'min' => 1, 'max' => 1 },
|
18
|
+
'whoReference' => { 'type' => 'Reference', 'path' => 'Signature.who[x]', 'min' => 1, 'max' => 1 },
|
19
|
+
'contentType' => { 'type' => 'code', 'path' => 'Signature.contentType', 'min' => 1, 'max' => 1, 'binding' => { 'strength' => 'required', 'uri' => 'http://www.rfc-editor.org/bcp/bcp13.txt' } },
|
20
|
+
'blob' => { 'type' => 'base64Binary', 'path' => 'Signature.blob', 'min' => 1, 'max' => 1 }
|
21
|
+
}
|
22
22
|
|
23
23
|
attr_accessor :id # 0-1 id
|
24
24
|
attr_accessor :extension # 0-* [ Extension ]
|
@@ -30,4 +30,4 @@ module FHIR
|
|
30
30
|
attr_accessor :blob # 1-1 base64Binary
|
31
31
|
end
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end
|
@@ -5,14 +5,14 @@ module FHIR
|
|
5
5
|
include FHIR::DSTU2::Json
|
6
6
|
include FHIR::DSTU2::Xml
|
7
7
|
|
8
|
-
SEARCH_PARAMS =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
SEARCH_PARAMS =
|
9
|
+
METADATA = {
|
10
|
+
'id' => { 'type' => 'id', 'path' => 'Timing.id', 'min' => 0, 'max' => 1 },
|
11
|
+
'extension' => { 'type' => 'Extension', 'path' => 'Timing.extension', 'min' => 0, 'max' => Float::INFINITY },
|
12
|
+
'event' => { 'type' => 'dateTime', 'path' => 'Timing.event', 'min' => 0, 'max' => Float::INFINITY },
|
13
|
+
'repeat' => { 'type' => 'Timing::Repeat', 'path' => 'Timing.repeat', 'min' => 0, 'max' => 1 },
|
14
|
+
'code' => { 'valid_codes' => { 'http://hl7.org/fhir/timing-abbreviation' => ['QD', 'QOD', 'Q4H', 'Q6H'], 'http://hl7.org/fhir/v3/GTSAbbreviation' => ['AM', 'BID', 'JB', 'JE', 'JH', '_GTSAbbreviationHolidaysChristianRoman', 'JHCHREAS', 'JHCHRGFR', 'JHCHRNEW', 'JHCHRPEN', 'JHCHRXME', 'JHCHRXMS', 'JHNNL', 'JHNNLLD', 'JHNNLQD', 'JHNNLSK', 'JHNUS', 'JHNUSCLM', 'JHNUSIND', 'JHNUSIND1', 'JHNUSIND5', 'JHNUSLBR', 'JHNUSMEM', 'JHNUSMEM5', 'JHNUSMEM6', 'JHNUSMLK', 'JHNUSPRE', 'JHNUSTKS', 'JHNUSTKS5', 'JHNUSVET', 'PM', 'QID', 'TID'] }, 'type' => 'CodeableConcept', 'path' => 'Timing.code', 'min' => 0, 'max' => 1, 'binding' => { 'strength' => 'preferred', 'uri' => 'http://hl7.org/fhir/ValueSet/timing-abbreviation' } }
|
15
|
+
}
|
16
16
|
|
17
17
|
class Repeat < FHIR::DSTU2::Model
|
18
18
|
include FHIR::DSTU2::Hashable
|
@@ -23,21 +23,21 @@ module FHIR
|
|
23
23
|
'bounds' => ['Quantity', 'Range', 'Period']
|
24
24
|
}
|
25
25
|
METADATA = {
|
26
|
-
'id' => {'type'=>'id', 'path'=>'Repeat.id', 'min'=>0, 'max'=>1},
|
27
|
-
'extension' => {'type'=>'Extension', 'path'=>'Repeat.extension', 'min'=>0, 'max'=>Float::INFINITY},
|
28
|
-
'boundsQuantity' => {'type'=>'Quantity', 'path'=>'Repeat.bounds[x]', 'min'=>0, 'max'=>1},
|
29
|
-
'boundsRange' => {'type'=>'Range', 'path'=>'Repeat.bounds[x]', 'min'=>0, 'max'=>1},
|
30
|
-
'boundsPeriod' => {'type'=>'Period', 'path'=>'Repeat.bounds[x]', 'min'=>0, 'max'=>1},
|
31
|
-
'count' => {'type'=>'integer', 'path'=>'Repeat.count', 'min'=>0, 'max'=>1},
|
32
|
-
'duration' => {'type'=>'decimal', 'path'=>'Repeat.duration', 'min'=>0, 'max'=>1},
|
33
|
-
'durationMax' => {'type'=>'decimal', 'path'=>'Repeat.durationMax', 'min'=>0, 'max'=>1},
|
34
|
-
'durationUnits' => {'valid_codes'=>{'http://unitsofmeasure.org'=>['s', 'min', 'h', 'd', 'wk', 'mo', 'a']}, 'type'=>'code', 'path'=>'Repeat.durationUnits', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/units-of-time'}},
|
35
|
-
'frequency' => {'type'=>'integer', 'path'=>'Repeat.frequency', 'min'=>0, 'max'=>1},
|
36
|
-
'frequencyMax' => {'type'=>'integer', 'path'=>'Repeat.frequencyMax', 'min'=>0, 'max'=>1},
|
37
|
-
'period' => {'type'=>'decimal', 'path'=>'Repeat.period', 'min'=>0, 'max'=>1},
|
38
|
-
'periodMax' => {'type'=>'decimal', 'path'=>'Repeat.periodMax', 'min'=>0, 'max'=>1},
|
39
|
-
'periodUnits' => {'valid_codes'=>{'http://unitsofmeasure.org'=>['s', 'min', 'h', 'd', 'wk', 'mo', 'a']}, 'type'=>'code', 'path'=>'Repeat.periodUnits', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/units-of-time'}},
|
40
|
-
'when' => {'valid_codes'=>{'http://hl7.org/fhir/v3/TimingEvent'=>['AC', 'ACD', 'ACM', 'ACV', 'C', 'CD', 'CM', 'CV', 'HS', 'IC', 'ICD', 'ICM', 'ICV', 'PC', 'PCD', 'PCM', 'PCV', 'WAKE']}, 'type'=>'code', 'path'=>'Repeat.when', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/event-timing'}}
|
26
|
+
'id' => { 'type' => 'id', 'path' => 'Repeat.id', 'min' => 0, 'max' => 1 },
|
27
|
+
'extension' => { 'type' => 'Extension', 'path' => 'Repeat.extension', 'min' => 0, 'max' => Float::INFINITY },
|
28
|
+
'boundsQuantity' => { 'type' => 'Quantity', 'path' => 'Repeat.bounds[x]', 'min' => 0, 'max' => 1 },
|
29
|
+
'boundsRange' => { 'type' => 'Range', 'path' => 'Repeat.bounds[x]', 'min' => 0, 'max' => 1 },
|
30
|
+
'boundsPeriod' => { 'type' => 'Period', 'path' => 'Repeat.bounds[x]', 'min' => 0, 'max' => 1 },
|
31
|
+
'count' => { 'type' => 'integer', 'path' => 'Repeat.count', 'min' => 0, 'max' => 1 },
|
32
|
+
'duration' => { 'type' => 'decimal', 'path' => 'Repeat.duration', 'min' => 0, 'max' => 1 },
|
33
|
+
'durationMax' => { 'type' => 'decimal', 'path' => 'Repeat.durationMax', 'min' => 0, 'max' => 1 },
|
34
|
+
'durationUnits' => { 'valid_codes' => { 'http://unitsofmeasure.org' => ['s', 'min', 'h', 'd', 'wk', 'mo', 'a'] }, 'type' => 'code', 'path' => 'Repeat.durationUnits', 'min' => 0, 'max' => 1, 'binding' => { 'strength' => 'required', 'uri' => 'http://hl7.org/fhir/ValueSet/units-of-time' } },
|
35
|
+
'frequency' => { 'type' => 'integer', 'path' => 'Repeat.frequency', 'min' => 0, 'max' => 1 },
|
36
|
+
'frequencyMax' => { 'type' => 'integer', 'path' => 'Repeat.frequencyMax', 'min' => 0, 'max' => 1 },
|
37
|
+
'period' => { 'type' => 'decimal', 'path' => 'Repeat.period', 'min' => 0, 'max' => 1 },
|
38
|
+
'periodMax' => { 'type' => 'decimal', 'path' => 'Repeat.periodMax', 'min' => 0, 'max' => 1 },
|
39
|
+
'periodUnits' => { 'valid_codes' => { 'http://unitsofmeasure.org' => ['s', 'min', 'h', 'd', 'wk', 'mo', 'a'] }, 'type' => 'code', 'path' => 'Repeat.periodUnits', 'min' => 0, 'max' => 1, 'binding' => { 'strength' => 'required', 'uri' => 'http://hl7.org/fhir/ValueSet/units-of-time' } },
|
40
|
+
'when' => { 'valid_codes' => { 'http://hl7.org/fhir/v3/TimingEvent' => ['AC', 'ACD', 'ACM', 'ACV', 'C', 'CD', 'CM', 'CV', 'HS', 'IC', 'ICD', 'ICM', 'ICV', 'PC', 'PCD', 'PCM', 'PCV', 'WAKE'] }, 'type' => 'code', 'path' => 'Repeat.when', 'min' => 0, 'max' => 1, 'binding' => { 'strength' => 'required', 'uri' => 'http://hl7.org/fhir/ValueSet/event-timing' } }
|
41
41
|
}
|
42
42
|
|
43
43
|
attr_accessor :id # 0-1 id
|
@@ -64,4 +64,4 @@ module FHIR
|
|
64
64
|
attr_accessor :code # 0-1 CodeableConcept
|
65
65
|
end
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'logger'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
module FHIR
|
5
6
|
module DSTU2
|
@@ -35,11 +36,11 @@ module FHIR
|
|
35
36
|
when 'string', 'markdown'
|
36
37
|
value.is_a?(String)
|
37
38
|
when 'decimal'
|
38
|
-
!(value.to_s =~ /\A([-+]?(
|
39
|
+
!(value.to_s =~ /\A([-+]?(0|([1-9][0-9]*))(\.[0-9]+)?)\Z/).nil?
|
39
40
|
when 'uri'
|
40
41
|
begin
|
41
42
|
!URI.parse(value).nil?
|
42
|
-
rescue
|
43
|
+
rescue StandardError
|
43
44
|
false
|
44
45
|
end
|
45
46
|
when 'base64binary'
|
@@ -48,7 +49,7 @@ module FHIR
|
|
48
49
|
# whitespace is not significant so we strip it out before doing the regex so that we can be sure that
|
49
50
|
# the number of characters is a multiple of 4.
|
50
51
|
# https://tools.ietf.org/html/rfc4648
|
51
|
-
!(value.to_s.gsub(/\s/, '') =~ %r{\A(|[0-9a-zA-Z
|
52
|
+
!(value.to_s.gsub(/\s/, '') =~ %r{\A(|[0-9a-zA-Z+=/]{4}+)\Z}).nil?
|
52
53
|
when 'instant'
|
53
54
|
formatted_value = value.respond_to?(:xmlschema) ? value.xmlschema : value.to_s
|
54
55
|
!(formatted_value =~ /\A([0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))))))\Z/).nil?
|
@@ -63,16 +64,16 @@ module FHIR
|
|
63
64
|
when 'time'
|
64
65
|
!(value.to_s =~ /\A(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?)\Z/).nil?
|
65
66
|
when 'code'
|
66
|
-
!(value.to_s =~ /\A[^\s]+(
|
67
|
+
!(value.to_s =~ /\A[^\s]+(\s?[^\s]+)*\Z/).nil?
|
67
68
|
when 'oid'
|
68
69
|
!(value.to_s =~ /\Aurn:oid:[0-2](\.[1-9]\d*)+\Z/).nil?
|
69
70
|
when 'id'
|
70
|
-
!(value.to_s =~ /\A[A-Za-z0-9
|
71
|
+
!(value.to_s =~ /\A[A-Za-z0-9\-.]{1,64}\Z/).nil?
|
71
72
|
when 'xhtml'
|
72
73
|
fragment = Nokogiri::HTML::DocumentFragment.parse(value)
|
73
74
|
value.is_a?(String) && fragment.errors.size.zero?
|
74
75
|
when 'unsignedint'
|
75
|
-
!(value.to_s =~ /\A(
|
76
|
+
!(value.to_s =~ /\A(0|([1-9][0-9]*))\Z/).nil?
|
76
77
|
when 'positiveint'
|
77
78
|
!(value.to_s =~ /\A+?[1-9][0-9]*\Z/).nil?
|
78
79
|
else
|
@@ -26,6 +26,7 @@ module FHIR
|
|
26
26
|
def keep_children(whitelist = [])
|
27
27
|
@marked_for_keeping = true if whitelist.include?(path)
|
28
28
|
return unless @children
|
29
|
+
|
29
30
|
@children.each do |child|
|
30
31
|
child.keep_children(whitelist)
|
31
32
|
end
|
@@ -33,6 +34,7 @@ module FHIR
|
|
33
34
|
|
34
35
|
def sweep_children
|
35
36
|
return unless @children
|
37
|
+
|
36
38
|
@children.each(&:sweep_children)
|
37
39
|
@children = @children.keep_if(&:marked_for_keeping)
|
38
40
|
@marked_for_keeping = !@children.empty? || @marked_for_keeping
|
@@ -41,6 +43,7 @@ module FHIR
|
|
41
43
|
def print_children(spaces = 0)
|
42
44
|
puts "#{' ' * spaces}+#{local_name || path} #{name} #{min}..#{max}"
|
43
45
|
return nil unless @children
|
46
|
+
|
44
47
|
@children.each do |child|
|
45
48
|
child.print_children(spaces + 2)
|
46
49
|
end
|
@@ -61,7 +61,7 @@ module FHIR
|
|
61
61
|
if json.is_a? String
|
62
62
|
begin
|
63
63
|
json = JSON.parse(json)
|
64
|
-
rescue => e
|
64
|
+
rescue StandardError => e
|
65
65
|
@errors << "Failed to parse JSON: #{e.message} %n #{h} %n #{e.backtrace.join("\n")}"
|
66
66
|
return false
|
67
67
|
end
|
@@ -103,13 +103,15 @@ module FHIR
|
|
103
103
|
def get_json_nodes(json, path)
|
104
104
|
results = []
|
105
105
|
return [json] if path.nil?
|
106
|
+
|
106
107
|
steps = path.split('.')
|
107
108
|
steps.each.with_index do |step, index|
|
108
|
-
|
109
|
+
case json
|
110
|
+
when Hash
|
109
111
|
json = json[step]
|
110
|
-
|
112
|
+
when Array
|
111
113
|
json.each do |e|
|
112
|
-
results << get_json_nodes(e, steps[index
|
114
|
+
results << get_json_nodes(e, steps[index..].join('.'))
|
113
115
|
end
|
114
116
|
return results.flatten!
|
115
117
|
else
|
@@ -129,11 +131,11 @@ module FHIR
|
|
129
131
|
|
130
132
|
def verify_element(element, json)
|
131
133
|
path = element.local_name || element.path
|
132
|
-
path = path[(@hierarchy.path.size + 1)
|
134
|
+
path = path[(@hierarchy.path.size + 1)..] if path.start_with? @hierarchy.path
|
133
135
|
|
134
136
|
begin
|
135
137
|
data_type_found = element.type.first.code
|
136
|
-
rescue
|
138
|
+
rescue StandardError
|
137
139
|
data_type_found = nil
|
138
140
|
end
|
139
141
|
|
@@ -165,9 +167,10 @@ module FHIR
|
|
165
167
|
end
|
166
168
|
|
167
169
|
return if nodes.empty?
|
170
|
+
|
168
171
|
# Check the datatype for each node, only if the element has one declared, and it isn't the root element
|
169
172
|
if !element.type.empty? && element.path != id
|
170
|
-
codeable_concept_pattern = element.pattern
|
173
|
+
codeable_concept_pattern = element.pattern&.is_a?(FHIR::DSTU2::CodeableConcept)
|
171
174
|
matching_pattern = false
|
172
175
|
nodes.each do |value|
|
173
176
|
matching_type = 0
|
@@ -204,7 +207,7 @@ module FHIR
|
|
204
207
|
matching_pattern = true if vcoding.system == pcoding.system && vcoding.code == pcoding.code
|
205
208
|
end
|
206
209
|
end
|
207
|
-
elsif
|
210
|
+
elsif ['CodeableConcept', 'Coding', 'Quantity'].include? data_type_found
|
208
211
|
required_strength = element&.binding&.strength == 'required'
|
209
212
|
binding_issues = required_strength ? @errors : @warnings
|
210
213
|
|
@@ -277,6 +280,7 @@ module FHIR
|
|
277
280
|
|
278
281
|
# check children if the element has any
|
279
282
|
return unless element.children
|
283
|
+
|
280
284
|
nodes.each do |node|
|
281
285
|
element.children.each do |child|
|
282
286
|
verify_element(child, node)
|
@@ -296,7 +300,7 @@ module FHIR
|
|
296
300
|
ret_val = definition.validates_hash?(value)
|
297
301
|
@errors += definition.errors
|
298
302
|
@warnings += definition.warnings
|
299
|
-
rescue
|
303
|
+
rescue StandardError
|
300
304
|
@errors << "Unable to verify #{data_type_code} as a FHIR::DSTU2 Resource."
|
301
305
|
end
|
302
306
|
return ret_val
|
@@ -316,7 +320,7 @@ module FHIR
|
|
316
320
|
ret_val = definition.validates_hash?(value)
|
317
321
|
@errors += definition.errors
|
318
322
|
@warnings += definition.warnings
|
319
|
-
rescue
|
323
|
+
rescue StandardError
|
320
324
|
@errors << "Unable to verify #{resource_type} as a FHIR::DSTU2 Resource."
|
321
325
|
end
|
322
326
|
ret_val
|
@@ -338,7 +342,7 @@ module FHIR
|
|
338
342
|
ret_val = definition.validates_hash?(value)
|
339
343
|
@errors += definition.errors
|
340
344
|
@warnings += definition.warnings
|
341
|
-
rescue
|
345
|
+
rescue StandardError
|
342
346
|
@errors << "Unable to verify #{data_type_code} as a FHIR::DSTU2 type."
|
343
347
|
end
|
344
348
|
ret_val
|
@@ -356,13 +360,13 @@ module FHIR
|
|
356
360
|
|
357
361
|
matching_type = 0
|
358
362
|
|
359
|
-
if
|
363
|
+
if ['http://hl7.org/fhir/ValueSet/content-type', 'http://www.rfc-editor.org/bcp/bcp13.txt'].include?(vs_uri)
|
360
364
|
matches = MIME::Types[value]
|
361
365
|
if (matches.nil? || matches.size.zero?) && !some_type_of_xml_or_json?(value)
|
362
366
|
@errors << "#{element.path} has invalid mime-type: '#{value}'"
|
363
367
|
matching_type -= 1 if element.binding.strength == 'required'
|
364
368
|
end
|
365
|
-
elsif
|
369
|
+
elsif ['http://hl7.org/fhir/ValueSet/languages', 'http://tools.ietf.org/html/bcp47'].include?(vs_uri)
|
366
370
|
has_region = !(value =~ /-/).nil?
|
367
371
|
valid = !BCP47::Language.identify(value.downcase).nil? && (!has_region || !BCP47::Region.identify(value.upcase).nil?)
|
368
372
|
unless valid
|
@@ -395,10 +399,11 @@ module FHIR
|
|
395
399
|
|
396
400
|
def some_type_of_xml_or_json?(code)
|
397
401
|
m = code.downcase
|
398
|
-
return true if
|
402
|
+
return true if ['xml', 'json'].include?(m)
|
399
403
|
return true if (m.starts_with?('application/') || m.starts_with?('text/')) && (m.ends_with?('json') || m.ends_with?('xml'))
|
400
404
|
return true if m.starts_with?('application/xml') || m.starts_with?('text/xml')
|
401
405
|
return true if m.starts_with?('application/json') || m.starts_with?('text/json')
|
406
|
+
|
402
407
|
false
|
403
408
|
end
|
404
409
|
deprecate :is_some_type_of_xml_or_json, :some_type_of_xml_or_json?
|
@@ -57,6 +57,7 @@ module FHIR
|
|
57
57
|
# generate warnings for missing fields (ignoring extensions)
|
58
58
|
left_missing.each do |e|
|
59
59
|
next if e.include? 'extension'
|
60
|
+
|
60
61
|
elem = get_element_by_path(e, right_elements)
|
61
62
|
if !elem.min.nil? && elem.min > 0
|
62
63
|
@errors << @finding.error(e, 'min', 'Missing REQUIRED element', 'Missing', elem.min.to_s)
|
@@ -68,6 +69,7 @@ module FHIR
|
|
68
69
|
end
|
69
70
|
right_missing.each do |e|
|
70
71
|
next if e.include? 'extension'
|
72
|
+
|
71
73
|
elem = get_element_by_path(e, left_elements)
|
72
74
|
if !elem.min.nil? && elem.min > 0
|
73
75
|
@errors << @finding.error(e, 'min', 'Missing REQUIRED element', elem.min.to_s, 'Missing')
|
@@ -114,6 +116,7 @@ module FHIR
|
|
114
116
|
end
|
115
117
|
y = get_extension(x.type[0].profile, right_extensions)
|
116
118
|
next unless !y.nil? && x.name != y.name
|
119
|
+
|
117
120
|
# both profiles share the same extension definition but with a different name
|
118
121
|
checked_extensions << x.name
|
119
122
|
checked_extensions << y.name
|
@@ -121,6 +124,7 @@ module FHIR
|
|
121
124
|
end
|
122
125
|
right_extensions.each do |y|
|
123
126
|
next if checked_extensions.include?(y.name)
|
127
|
+
|
124
128
|
x = get_extension(y.name, left_extensions)
|
125
129
|
unless x.nil?
|
126
130
|
# both profiles share an extension with the same name
|
@@ -129,6 +133,7 @@ module FHIR
|
|
129
133
|
end
|
130
134
|
x = get_extension(y.type[0].profile, left_extensions)
|
131
135
|
next unless !x.nil? && x.name != y.name && !checked_extensions.include?(x.name)
|
136
|
+
|
132
137
|
# both profiles share the same extension definition but with a different name
|
133
138
|
checked_extensions << x.name
|
134
139
|
checked_extensions << y.name
|
@@ -180,13 +185,16 @@ module FHIR
|
|
180
185
|
x = path.split('.')
|
181
186
|
root = x.first(x.size - 1).join('.')
|
182
187
|
next unless root.include? '.'
|
188
|
+
|
183
189
|
# get the root element to fill in the details
|
184
190
|
elem = get_element_by_path(root, elements)
|
185
191
|
# get the data type definition to fill in the details
|
186
192
|
# assume missing elements are from first data type (gross)
|
187
193
|
next if elem.type.nil? || elem.type.empty?
|
194
|
+
|
188
195
|
type_def = FHIR::DSTU2::Definitions.type_definition(elem.type[0].code)
|
189
196
|
next if type_def.nil?
|
197
|
+
|
190
198
|
type_elements = Array.new(type_def.snapshot.element)
|
191
199
|
# _DEEP_ copy
|
192
200
|
type_elements.map! do |e| # {|e| FHIR::DSTU2::ElementDefinition.from_fhir_json(e.to_fhir_json) }
|
@@ -200,6 +208,7 @@ module FHIR
|
|
200
208
|
type_elements.each do |z|
|
201
209
|
y = get_element_by_path(z.path, elements)
|
202
210
|
next unless y.nil?
|
211
|
+
|
203
212
|
elements << z
|
204
213
|
# else
|
205
214
|
# @warnings << "StructureDefinition #{name} already contains #{z.path}"
|
@@ -368,6 +377,7 @@ module FHIR
|
|
368
377
|
|
369
378
|
# isModifier
|
370
379
|
return unless x.isModifier != y.isModifier
|
380
|
+
|
371
381
|
@errors << @finding.error(x.path.to_s, 'isModifier', 'Incompatible isModifier', (x.isModifier || false).to_s, (y.isModifier || false).to_s)
|
372
382
|
end
|
373
383
|
|
@@ -16,7 +16,7 @@ module FHIR
|
|
16
16
|
"#{resourceType},#{profileIdA},#{profileIdB},#{path},#{attribute},#{status},#{message},#{valueA},#{valueB}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def to_json
|
19
|
+
def to_json(*_args)
|
20
20
|
JSON.pretty_unparse(as_json)
|
21
21
|
end
|
22
22
|
|
@@ -31,7 +31,7 @@ module FHIR
|
|
31
31
|
hash.each do |key, value|
|
32
32
|
obj.send("#{key}=".to_sym, value) if value
|
33
33
|
end
|
34
|
-
rescue => e
|
34
|
+
rescue StandardError => e
|
35
35
|
FHIR::DSTU2.logger.error "Failed to parse JSON: #{e.message}"
|
36
36
|
return nil
|
37
37
|
end
|
@@ -20,12 +20,14 @@ module FluentPath
|
|
20
20
|
return 'http://unitsofmeasure.org' if key == '%ucum'
|
21
21
|
return 'http://snomed.info/sct' if key == '%sct'
|
22
22
|
return 'http://loinc.org' if key == '%loinc'
|
23
|
-
return key.gsub!(/\A
|
23
|
+
return key.gsub!(/\A'|'\Z/, '') if key.start_with?("'") && key.end_with?("'")
|
24
|
+
|
24
25
|
key.gsub!(/\A"|"\Z/, '') # remove quotes around path if they exist
|
25
26
|
if hash.is_a?(Array)
|
26
27
|
response = []
|
27
28
|
hash.each do |e|
|
28
29
|
next unless e.is_a?(Hash)
|
30
|
+
|
29
31
|
item = e[key]
|
30
32
|
if item.is_a?(Array)
|
31
33
|
item.each { |i| response << i }
|
@@ -37,6 +39,7 @@ module FluentPath
|
|
37
39
|
end
|
38
40
|
return :null unless hash.is_a?(Hash)
|
39
41
|
return hash if hash['resourceType'] == key
|
42
|
+
|
40
43
|
val = hash[key]
|
41
44
|
if val.nil?
|
42
45
|
# this block is a dangerous hack to get fields of multiple data types
|
@@ -60,6 +63,7 @@ module FluentPath
|
|
60
63
|
return false if value.is_a?(Hash) && value.empty?
|
61
64
|
return false if value == :null
|
62
65
|
return false if value == false
|
66
|
+
|
63
67
|
true
|
64
68
|
end
|
65
69
|
|
@@ -99,7 +103,7 @@ module FluentPath
|
|
99
103
|
if node.is_a?(String) && !(node.start_with?("'") && node.end_with?("'"))
|
100
104
|
array_index = nil
|
101
105
|
if node.include?('[') && node.end_with?(']')
|
102
|
-
array_index = node[node.index('[')
|
106
|
+
array_index = node[node.index('[')..].gsub(/\[|\]/, '')
|
103
107
|
t = get(array_index, data)
|
104
108
|
t = array_index.to_i if t.nil? || t == :null
|
105
109
|
array_index = t
|
@@ -128,14 +132,15 @@ module FluentPath
|
|
128
132
|
raise 'Where function requires a block.'
|
129
133
|
end
|
130
134
|
previous_node = [] if previous_node == :null
|
131
|
-
|
135
|
+
case previous_node
|
136
|
+
when Array
|
132
137
|
previous_node.keep_if do |item|
|
133
138
|
sub = compute(block.clone, item)
|
134
139
|
convert_to_boolean(sub)
|
135
140
|
end
|
136
141
|
tree[index] = previous_node
|
137
142
|
clean_index(tree, previous_index)
|
138
|
-
|
143
|
+
when Hash
|
139
144
|
sub = compute(block, previous_node)
|
140
145
|
tree[index] = convert_to_boolean(sub) ? previous_node : {}
|
141
146
|
clean_index(tree, previous_index)
|
@@ -154,13 +159,14 @@ module FluentPath
|
|
154
159
|
raise 'Select function requires a block.'
|
155
160
|
end
|
156
161
|
previous_node = [] if previous_node == :null
|
157
|
-
|
162
|
+
case previous_node
|
163
|
+
when Array
|
158
164
|
previous_node.map! do |item|
|
159
165
|
compute(block.clone, item)
|
160
166
|
end
|
161
167
|
tree[index] = previous_node
|
162
168
|
clean_index(tree, previous_index)
|
163
|
-
|
169
|
+
when Hash
|
164
170
|
tree[index] = compute(block, previous_node)
|
165
171
|
clean_index(tree, previous_index)
|
166
172
|
else
|
@@ -182,8 +188,8 @@ module FluentPath
|
|
182
188
|
if exts.is_a?(Array)
|
183
189
|
url = nil
|
184
190
|
begin
|
185
|
-
url = block.tree.first.gsub(
|
186
|
-
rescue
|
191
|
+
url = block.tree.first.gsub(/'|"/, '')
|
192
|
+
rescue StandardError
|
187
193
|
raise 'Extension function requires a single URL as String.'
|
188
194
|
end
|
189
195
|
ext = exts.select { |x| x['url'] == url }.first
|
@@ -380,9 +386,10 @@ module FluentPath
|
|
380
386
|
break
|
381
387
|
when :toInteger
|
382
388
|
# the previous node should be a data (as String, Integer, Boolean)
|
383
|
-
|
389
|
+
case previous_node
|
390
|
+
when String
|
384
391
|
tree[index] = previous_node.to_i rescue 0
|
385
|
-
|
392
|
+
when Numeric
|
386
393
|
tree[index] = previous_node.to_i
|
387
394
|
else
|
388
395
|
tree[index] = 0
|
@@ -587,4 +594,4 @@ module FluentPath
|
|
587
594
|
tree.first
|
588
595
|
end
|
589
596
|
end
|
590
|
-
end
|
597
|
+
end
|
@@ -8,7 +8,7 @@ module FluentPath
|
|
8
8
|
|
9
9
|
# This method tokenizes the expression into a flat array of tokens
|
10
10
|
def self.tokenize(expression)
|
11
|
-
raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s
|
11
|
+
raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|/|\*)})
|
12
12
|
# recreate strings if they were split
|
13
13
|
size = nil
|
14
14
|
while raw_tokens.include?("'") && size != raw_tokens.length
|
@@ -45,13 +45,15 @@ module FluentPath
|
|
45
45
|
def self.reassemble_strings(tokens)
|
46
46
|
tokens.each_with_index do |token, index|
|
47
47
|
next unless token.is_a?(String)
|
48
|
+
|
48
49
|
e_index = nil
|
49
50
|
if token.start_with?('"') && !token.end_with?('"')
|
50
|
-
e_index = tokens[index
|
51
|
+
e_index = tokens[index..].index { |t| t.end_with?('"') }
|
51
52
|
elsif token.start_with?("'") && !token.end_with?("'")
|
52
|
-
e_index = tokens[index
|
53
|
+
e_index = tokens[index..].index { |t| t.end_with?("'") }
|
53
54
|
end
|
54
55
|
next unless e_index
|
56
|
+
|
55
57
|
i = index + 1
|
56
58
|
while i <= index + e_index
|
57
59
|
tokens[index] += tokens[i]
|
@@ -64,6 +66,7 @@ module FluentPath
|
|
64
66
|
# This method builds an Abstract Syntax Tree (AST) from a flat list of tokens
|
65
67
|
def self.build_tree(tokens)
|
66
68
|
return if tokens.empty?
|
69
|
+
|
67
70
|
tree = []
|
68
71
|
until tokens.empty?
|
69
72
|
token = tokens.delete_at(0)
|
@@ -92,7 +95,7 @@ module FluentPath
|
|
92
95
|
value = token
|
93
96
|
begin
|
94
97
|
value = Float(token)
|
95
|
-
rescue
|
98
|
+
rescue StandardError
|
96
99
|
value = token
|
97
100
|
value = token.to_sym if @@reserved.include?(token)
|
98
101
|
value = true if token == 'true'
|