Skip to content

Commit

Permalink
Merge pull request #16 from fhir-crucible/autogen_fixes
Browse files Browse the repository at this point in the history
Autogen fixes
  • Loading branch information
arscan authored Dec 9, 2016
2 parents 23339f1 + 87ec986 commit 8b5da70
Show file tree
Hide file tree
Showing 172 changed files with 1,283 additions and 1,287 deletions.
2 changes: 1 addition & 1 deletion lib/fhir_models/bootstrap/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def self.load_search_params
def self.get_search_parameters(type_name)
return nil if type_name.nil?
load_search_params
@@search_params.select { |p| p['base'] == type_name && p['xpath'] && !p['xpath'].include?('extension') }.map { |p| p['code'] }
@@search_params.select { |p| p['base'].include?(type_name) && p['xpath'] && !p['xpath'].include?('extension') }.map { |p| p['code'] }
end

private_class_method :load_types, :load_extensions, :load_expansions, :load_profiles, :load_resources, :load_search_params
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/bootstrap/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def generate_class(hierarchy, structure_def, top_level = false)
# profiles contains a list of profiles if the datatype is Reference or Extension
profiles = []
element['type'].select { |t| t['code'] == 'Reference' || t['code'] == 'Extension' }.each do |data_type|
profiles << data_type['profile']
profiles << data_type['targetProfile']
end
profiles.select! { |p| !p.nil? }
profiles.flatten!
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/bootstrap/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def to_s(offset = 0)
s[-1] = s[-1][0..-2] # remove the trailing comma
s << "#{space}}"
else
s << "#{space}#{constant.upcase} = #{value}"
s << "#{space}#{constant.upcase} = #{value.to_s.tr!('"', '\'')}"
end
end
s << ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
]
},
"prescription": {
"reference": "http://www.optdocs.com/prescription/12345"
"reference": "http://www.optdocs.com/VisionPrescription/12345"
},
"payee": {
"type": {
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/json/claimresponse-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"reference": "Organization/1"
},
"request": {
"reference": "http://www.BenefitsInc.com/fhir/oralhealthclaim/15476332402"
"reference": "http://www.BenefitsInc.com/fhir/Claim/15476332402"
},
"outcome": {
"coding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"sourceReference": {
"reference": "http://hl7.org/fhir/ValueSet/v2-0487"
},
"targetReference": {
"reference": "http://snomed.info/id?fhir_vs"
},
"targetUri": "http://snomed.info/id?fhir_vs",
"group": [
{
"source": "http://hl7.org/fhir/v2/0487",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"status": "active",
"created": "2014-08-16",
"request": {
"reference": "http://www.BenefitsInc.com/fhir/eligibility/225476332402"
"reference": "http://www.BenefitsInc.com/fhir/EligibilityRequest/225476332402"
},
"outcome": {
"coding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"status": "active",
"created": "2014-08-16",
"request": {
"reference": "http://www.BenefitsInc.com/fhir/eligibility/225476332402"
"reference": "http://www.BenefitsInc.com/fhir/EligibilityRequest/225476332402"
},
"outcome": {
"coding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"status": "active",
"request": {
"reference": "http://www.BenefitsInc.com/fhir/eligibility/225476332402"
"reference": "http://www.BenefitsInc.com/fhir/EnrollmentRequest/225476332402"
},
"outcome": {
"coding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"reference": "Organization/2"
},
"request": {
"reference": "http://www.BenefitsInc.com/fhir/eligibility/225476332402"
"reference": "http://www.BenefitsInc.com/fhir/ProcessRequest/225476332402"
},
"outcome": {
"coding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</priority>

<prescription>
<reference value="http://www.optdocs.com/prescription/12345"/>
<reference value="http://www.optdocs.com/VisionPrescription/12345"/>
</prescription>

<payee>
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/examples/xml/claimresponse-example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</requestOrganization>

<request>
<reference value="http://www.BenefitsInc.com/fhir/oralhealthclaim/15476332402"/>
<reference value="http://www.BenefitsInc.com/fhir/Claim/15476332402"/>
</request>

<outcome>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2530,9 +2530,7 @@
<sourceReference>
<reference value="http://hl7.org/fhir/ValueSet/v2-0487"/>
</sourceReference>
<targetReference>
<reference value="http://snomed.info/id?fhir_vs"/>
</targetReference>
<targetUri value="http://snomed.info/id?fhir_vs"/>
<group>
<source value="http://hl7.org/fhir/v2/0487"/>
<target value="http://snomed.info/sct"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<created value="2014-08-16"/>

<request>
<reference value="http://www.BenefitsInc.com/fhir/eligibility/225476332402"/>
<reference value="http://www.BenefitsInc.com/fhir/EligibilityRequest/225476332402"/>
</request>

<outcome>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-->

<request>
<reference value="http://www.BenefitsInc.com/fhir/eligibility/225476332402"/>
<reference value="http://www.BenefitsInc.com/fhir/EligibilityRequest/225476332402"/>
</request>

<outcome>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<status value="active"/>

<request>
<reference value="http://www.BenefitsInc.com/fhir/eligibility/225476332402"/>
<reference value="http://www.BenefitsInc.com/fhir/EnrollmentRequest/225476332402"/>
</request>

<outcome>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</organization>

<request>
<reference value="http://www.BenefitsInc.com/fhir/eligibility/225476332402"/>
<reference value="http://www.BenefitsInc.com/fhir/ProcessRequest/225476332402"/>
</request>

<outcome>
Expand Down
4 changes: 2 additions & 2 deletions lib/fhir_models/fhir/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module FHIR
'decimal' => {'type'=>'number', 'regex'=>'-?([0]|([1-9][0-9]*))(\\.[0-9]+)?'},
'xhtml' => {'type'=>'string'}
}
TYPES = ["Reference", "Quantity", "Period", "Attachment", "Duration", "Count", "Range", "Annotation", "Money", "Identifier", "Coding", "Signature", "SampledData", "Ratio", "Distance", "Age", "CodeableConcept", "Extension", "BackboneElement", "Narrative", "Element", "Meta", "Address", "TriggerDefinition", "Contributor", "DataRequirement", "RelatedArtifact", "ContactDetail", "HumanName", "ContactPoint", "UsageContext", "Timing", "ElementDefinition", "DosageInstruction", "ParameterDefinition"]
RESOURCES = ["CodeSystem", "ValueSet", "DomainResource", "Parameters", "Resource", "Account", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticReport", "DiagnosticRequest", "DocumentManifest", "DocumentReference", "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", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionRequest", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestReport", "TestScript", "VisionPrescription", "MetadataResource"]
TYPES = ['Reference', 'Quantity', 'Period', 'Attachment', 'Duration', 'Count', 'Range', 'Annotation', 'Money', 'Identifier', 'Coding', 'Signature', 'SampledData', 'Ratio', 'Distance', 'Age', 'CodeableConcept', 'Extension', 'BackboneElement', 'Narrative', 'Element', 'Meta', 'Address', 'TriggerDefinition', 'Contributor', 'DataRequirement', 'RelatedArtifact', 'ContactDetail', 'HumanName', 'ContactPoint', 'UsageContext', 'Timing', 'ElementDefinition', 'DosageInstruction', 'ParameterDefinition']
RESOURCES = ['CodeSystem', 'ValueSet', 'DomainResource', 'Parameters', 'Resource', 'Account', 'ActivityDefinition', 'AllergyIntolerance', 'Appointment', 'AppointmentResponse', 'AuditEvent', 'Basic', 'Binary', 'BodySite', 'Bundle', 'CapabilityStatement', 'CarePlan', 'CareTeam', 'Claim', 'ClaimResponse', 'ClinicalImpression', 'Communication', 'CommunicationRequest', 'CompartmentDefinition', 'Composition', 'ConceptMap', 'Condition', 'Consent', 'Contract', 'Coverage', 'DataElement', 'DetectedIssue', 'Device', 'DeviceComponent', 'DeviceMetric', 'DeviceUseRequest', 'DeviceUseStatement', 'DiagnosticReport', 'DiagnosticRequest', 'DocumentManifest', 'DocumentReference', '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', 'MedicationRequest', 'MedicationStatement', 'MessageDefinition', 'MessageHeader', 'NamingSystem', 'NutritionRequest', 'Observation', 'OperationDefinition', 'OperationOutcome', 'Organization', 'Patient', 'PaymentNotice', 'PaymentReconciliation', 'Person', 'PlanDefinition', 'Practitioner', 'PractitionerRole', 'Procedure', 'ProcedureRequest', 'ProcessRequest', 'ProcessResponse', 'Provenance', 'Questionnaire', 'QuestionnaireResponse', 'ReferralRequest', 'RelatedPerson', 'RequestGroup', 'ResearchStudy', 'ResearchSubject', 'RiskAssessment', 'Schedule', 'SearchParameter', 'Sequence', 'ServiceDefinition', 'Slot', 'Specimen', 'StructureDefinition', 'StructureMap', 'Subscription', 'Substance', 'SupplyDelivery', 'SupplyRequest', 'Task', 'TestReport', 'TestScript', 'VisionPrescription', 'MetadataResource']

end
18 changes: 9 additions & 9 deletions lib/fhir_models/fhir/resources/Account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Account < FHIR::Model
include FHIR::Json
include FHIR::Xml

SEARCH_PARAMS = []
SEARCH_PARAMS = ['balance', 'identifier', 'name', 'owner', 'patient', 'period', 'status', 'subject', 'type']
METADATA = {
'id' => {'type'=>'id', 'path'=>'Account.id', 'min'=>0, 'max'=>1},
'meta' => {'type'=>'Meta', 'path'=>'Account.meta', 'min'=>0, 'max'=>1},
Expand All @@ -21,10 +21,10 @@ class Account < FHIR::Model
'active' => {'type'=>'Period', 'path'=>'Account.active', 'min'=>0, 'max'=>1},
'currency' => {'type'=>'Coding', 'path'=>'Account.currency', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'example', 'uri'=>'http://www.iso.org/iso/home/standards/currency_codes'}},
'balance' => {'type'=>'Money', 'path'=>'Account.balance', 'min'=>0, 'max'=>1},
'coverage' => {'type'=>'Reference', 'path'=>'Account.coverage', 'min'=>0, 'max'=>Float::INFINITY},
'coverage' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Coverage'], 'type'=>'Reference', 'path'=>'Account.coverage', 'min'=>0, 'max'=>Float::INFINITY},
'coveragePeriod' => {'type'=>'Period', 'path'=>'Account.coveragePeriod', 'min'=>0, 'max'=>1},
'subject' => {'type'=>'Reference', 'path'=>'Account.subject', 'min'=>0, 'max'=>1},
'owner' => {'type'=>'Reference', 'path'=>'Account.owner', 'min'=>0, 'max'=>1},
'subject' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Patient', 'http://hl7.org/fhir/StructureDefinition/Device', 'http://hl7.org/fhir/StructureDefinition/Practitioner', 'http://hl7.org/fhir/StructureDefinition/Location', 'http://hl7.org/fhir/StructureDefinition/HealthcareService', 'http://hl7.org/fhir/StructureDefinition/Organization'], 'type'=>'Reference', 'path'=>'Account.subject', 'min'=>0, 'max'=>1},
'owner' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Organization'], 'type'=>'Reference', 'path'=>'Account.owner', 'min'=>0, 'max'=>1},
'description' => {'type'=>'string', 'path'=>'Account.description', 'min'=>0, 'max'=>1},
'guarantor' => {'type'=>'Account::Guarantor', 'path'=>'Account.guarantor', 'min'=>0, 'max'=>Float::INFINITY}
}
Expand All @@ -38,15 +38,15 @@ class Guarantor < FHIR::Model
'id' => {'type'=>'string', 'path'=>'Guarantor.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Guarantor.extension', 'min'=>0, 'max'=>Float::INFINITY},
'modifierExtension' => {'type'=>'Extension', 'path'=>'Guarantor.modifierExtension', 'min'=>0, 'max'=>Float::INFINITY},
'party' => {'type'=>'Reference', 'path'=>'Guarantor.party', 'min'=>1, 'max'=>1},
'party' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Patient', 'http://hl7.org/fhir/StructureDefinition/RelatedPerson', 'http://hl7.org/fhir/StructureDefinition/Organization'], 'type'=>'Reference', 'path'=>'Guarantor.party', 'min'=>1, 'max'=>1},
'onHold' => {'type'=>'boolean', 'path'=>'Guarantor.onHold', 'min'=>0, 'max'=>1},
'period' => {'type'=>'Period', 'path'=>'Guarantor.period', 'min'=>0, 'max'=>1}
}

attr_accessor :id # 0-1 string
attr_accessor :extension # 0-* [ Extension ]
attr_accessor :modifierExtension # 0-* [ Extension ]
attr_accessor :party # 1-1 Reference()
attr_accessor :party # 1-1 Reference(Patient|RelatedPerson|Organization)
attr_accessor :onHold # 0-1 boolean
attr_accessor :period # 0-1 Period
end
Expand All @@ -66,10 +66,10 @@ class Guarantor < FHIR::Model
attr_accessor :active # 0-1 Period
attr_accessor :currency # 0-1 Coding
attr_accessor :balance # 0-1 Money
attr_accessor :coverage # 0-* [ Reference() ]
attr_accessor :coverage # 0-* [ Reference(Coverage) ]
attr_accessor :coveragePeriod # 0-1 Period
attr_accessor :subject # 0-1 Reference()
attr_accessor :owner # 0-1 Reference()
attr_accessor :subject # 0-1 Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)
attr_accessor :owner # 0-1 Reference(Organization)
attr_accessor :description # 0-1 string
attr_accessor :guarantor # 0-* [ Account::Guarantor ]

Expand Down
18 changes: 9 additions & 9 deletions lib/fhir_models/fhir/resources/ActivityDefinition.rb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions lib/fhir_models/fhir/resources/AllergyIntolerance.rb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions lib/fhir_models/fhir/resources/Appointment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Appointment < FHIR::Model
include FHIR::Json
include FHIR::Xml

SEARCH_PARAMS = []
SEARCH_PARAMS = ['actor', 'appointment-type', 'date', 'identifier', 'location', 'part-status', 'patient', 'practitioner', 'service-type', 'status']
METADATA = {
'id' => {'type'=>'id', 'path'=>'Appointment.id', 'min'=>0, 'max'=>1},
'meta' => {'type'=>'Meta', 'path'=>'Appointment.meta', 'min'=>0, 'max'=>1},
Expand All @@ -26,7 +26,7 @@ class Appointment < FHIR::Model
'start' => {'type'=>'instant', 'path'=>'Appointment.start', 'min'=>0, 'max'=>1},
'end' => {'type'=>'instant', 'path'=>'Appointment.end', 'min'=>0, 'max'=>1},
'minutesDuration' => {'type'=>'positiveInt', 'path'=>'Appointment.minutesDuration', 'min'=>0, 'max'=>1},
'slot' => {'type'=>'Reference', 'path'=>'Appointment.slot', 'min'=>0, 'max'=>Float::INFINITY},
'slot' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Slot'], 'type'=>'Reference', 'path'=>'Appointment.slot', 'min'=>0, 'max'=>Float::INFINITY},
'created' => {'type'=>'dateTime', 'path'=>'Appointment.created', 'min'=>0, 'max'=>1},
'comment' => {'type'=>'string', 'path'=>'Appointment.comment', 'min'=>0, 'max'=>1},
'participant' => {'type'=>'Appointment::Participant', 'path'=>'Appointment.participant', 'min'=>1, 'max'=>Float::INFINITY},
Expand All @@ -43,7 +43,7 @@ class Participant < FHIR::Model
'extension' => {'type'=>'Extension', 'path'=>'Participant.extension', 'min'=>0, 'max'=>Float::INFINITY},
'modifierExtension' => {'type'=>'Extension', 'path'=>'Participant.modifierExtension', 'min'=>0, 'max'=>Float::INFINITY},
'type' => {'valid_codes'=>{'http://hl7.org/fhir/v3/ParticipationType'=>['ADM', 'ATND', 'CALLBCK', 'CON', 'DIS', 'ESC', 'REF', 'SPRF', 'PPRF', 'PART'], 'http://hl7.org/fhir/participant-type'=>['translator', 'emergency', 'translator', 'emergency']}, 'type'=>'CodeableConcept', 'path'=>'Participant.type', 'min'=>0, 'max'=>Float::INFINITY, 'binding'=>{'strength'=>'extensible', 'uri'=>'http://hl7.org/fhir/ValueSet/encounter-participant-type'}},
'actor' => {'type'=>'Reference', 'path'=>'Participant.actor', 'min'=>0, 'max'=>1},
'actor' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Patient', 'http://hl7.org/fhir/StructureDefinition/Practitioner', 'http://hl7.org/fhir/StructureDefinition/RelatedPerson', 'http://hl7.org/fhir/StructureDefinition/Device', 'http://hl7.org/fhir/StructureDefinition/HealthcareService', 'http://hl7.org/fhir/StructureDefinition/Location'], 'type'=>'Reference', 'path'=>'Participant.actor', 'min'=>0, 'max'=>1},
'required' => {'valid_codes'=>{'http://hl7.org/fhir/participantrequired'=>['required', 'optional', 'information-only', 'required', 'optional', 'information-only']}, 'type'=>'code', 'path'=>'Participant.required', 'min'=>0, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/participantrequired'}},
'status' => {'valid_codes'=>{'http://hl7.org/fhir/participationstatus'=>['accepted', 'declined', 'tentative', 'needs-action', 'accepted', 'declined', 'tentative', 'needs-action']}, 'type'=>'code', 'path'=>'Participant.status', 'min'=>1, 'max'=>1, 'binding'=>{'strength'=>'required', 'uri'=>'http://hl7.org/fhir/ValueSet/participationstatus'}}
}
Expand All @@ -52,7 +52,7 @@ class Participant < FHIR::Model
attr_accessor :extension # 0-* [ Extension ]
attr_accessor :modifierExtension # 0-* [ Extension ]
attr_accessor :type # 0-* [ CodeableConcept ]
attr_accessor :actor # 0-1 Reference()
attr_accessor :actor # 0-1 Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)
attr_accessor :required # 0-1 code
attr_accessor :status # 1-1 code
end
Expand All @@ -77,7 +77,7 @@ class Participant < FHIR::Model
attr_accessor :start # 0-1 instant
attr_accessor :end # 0-1 instant
attr_accessor :minutesDuration # 0-1 positiveInt
attr_accessor :slot # 0-* [ Reference() ]
attr_accessor :slot # 0-* [ Reference(Slot) ]
attr_accessor :created # 0-1 dateTime
attr_accessor :comment # 0-1 string
attr_accessor :participant # 1-* [ Appointment::Participant ]
Expand Down
Loading

0 comments on commit 8b5da70

Please sign in to comment.