Skip to content

Commit

Permalink
Add Versioned models
Browse files Browse the repository at this point in the history
  • Loading branch information
360dgries committed Sep 5, 2024
1 parent 6bfa142 commit fdce99c
Show file tree
Hide file tree
Showing 380 changed files with 1,347 additions and 12,124 deletions.
11 changes: 1 addition & 10 deletions lib/fhir_models/generator/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def to_s(offset = 0)
type = 'module'
type = 'class' if index == @name.length - 1
classdef = "#{space}#{type} #{name}"
classdef += ' < FHIR::Model' if type == 'class'
classdef += ' < Model' if type == 'class'
s << classdef
end

Expand All @@ -73,15 +73,6 @@ def to_s(offset = 0)
s << "#{space}include FHIR::Xml" unless @name.empty?
s << ''

s << "#{space}def fhir_version_string"
s << "#{space} '#{fhir_version}'"
s << "#{space}end"
s << ''
s << "#{space}def versioned_fhir_module"
s << "#{space} FHIR::#{fhir_version}"
s << "#{space}end"
s << ''

# add mandatory METADATA constant
@constants['METADATA'] = metadata unless metadata.empty?

Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_models/r4/fhir_ext/element_definition.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module FHIR
module R4
class ElementDefinition < FHIR::Model
class ElementDefinition < Model
include FHIR::CommonElementDefinition

def self.fhir_version_string
Expand Down
8 changes: 0 additions & 8 deletions lib/fhir_models/r4/generated/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
module FHIR
module R4

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

PRIMITIVES = {
'base64Binary' => {'type'=>'string', 'regex'=>'(\\s*([0-9a-zA-Z\\+/=]){4}\\s*)+'},
'boolean' => {'type'=>'boolean', 'regex'=>'true|false'},
Expand Down
30 changes: 3 additions & 27 deletions lib/fhir_models/r4/generated/resources/Account.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class Account < FHIR::Model
class Account < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

SEARCH_PARAMS = ['identifier', 'name', 'owner', 'patient', 'period', 'status', 'subject', 'type']
METADATA = {
'id' => {'type'=>'id', 'path'=>'Account.id', 'min'=>0, 'max'=>1},
Expand All @@ -36,19 +28,11 @@ def versioned_fhir_module
'partOf' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/Account'], 'type'=>'Reference', 'path'=>'Account.partOf', 'min'=>0, 'max'=>1}
}

class Coverage < FHIR::Model
class Coverage < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Coverage.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Coverage.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand All @@ -64,19 +48,11 @@ def versioned_fhir_module
attr_accessor :priority # 0-1 positiveInt
end

class Guarantor < FHIR::Model
class Guarantor < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Guarantor.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Guarantor.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand Down
30 changes: 3 additions & 27 deletions lib/fhir_models/r4/generated/resources/ActivityDefinition.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class ActivityDefinition < FHIR::Model
class ActivityDefinition < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

MULTIPLE_TYPES = {
'subject' => ['CodeableConcept', 'Reference'],
'timing' => ['Timing', 'dateTime', 'Age', 'Period', 'Range', 'Duration'],
Expand Down Expand Up @@ -83,19 +75,11 @@ def versioned_fhir_module
'dynamicValue' => {'type'=>'ActivityDefinition::DynamicValue', 'path'=>'ActivityDefinition.dynamicValue', 'min'=>0, 'max'=>Float::INFINITY}
}

class Participant < FHIR::Model
class Participant < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Participant.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Participant.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand All @@ -111,19 +95,11 @@ def versioned_fhir_module
attr_accessor :role # 0-1 CodeableConcept
end

class DynamicValue < FHIR::Model
class DynamicValue < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'DynamicValue.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'DynamicValue.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand Down
30 changes: 3 additions & 27 deletions lib/fhir_models/r4/generated/resources/AdverseEvent.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class AdverseEvent < FHIR::Model
class AdverseEvent < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

SEARCH_PARAMS = ['actuality', 'category', 'date', 'event', 'location', 'recorder', 'resultingcondition', 'seriousness', 'severity', 'study', 'subject', 'substance']
METADATA = {
'id' => {'type'=>'id', 'path'=>'AdverseEvent.id', 'min'=>0, 'max'=>1},
Expand Down Expand Up @@ -45,19 +37,11 @@ def versioned_fhir_module
'study' => {'type_profiles'=>['http://hl7.org/fhir/StructureDefinition/ResearchStudy'], 'type'=>'Reference', 'path'=>'AdverseEvent.study', 'min'=>0, 'max'=>Float::INFINITY}
}

class SuspectEntity < FHIR::Model
class SuspectEntity < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'SuspectEntity.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'SuspectEntity.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand All @@ -66,19 +50,11 @@ def versioned_fhir_module
'causality' => {'type'=>'AdverseEvent::SuspectEntity::Causality', 'path'=>'SuspectEntity.causality', 'min'=>0, 'max'=>Float::INFINITY}
}

class Causality < FHIR::Model
class Causality < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Causality.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Causality.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand Down
20 changes: 2 additions & 18 deletions lib/fhir_models/r4/generated/resources/AllergyIntolerance.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class AllergyIntolerance < FHIR::Model
class AllergyIntolerance < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

MULTIPLE_TYPES = {
'onset' => ['dateTime', 'Age', 'Period', 'Range', 'string']
}
Expand Down Expand Up @@ -48,19 +40,11 @@ def versioned_fhir_module
'reaction' => {'type'=>'AllergyIntolerance::Reaction', 'path'=>'AllergyIntolerance.reaction', 'min'=>0, 'max'=>Float::INFINITY}
}

class Reaction < FHIR::Model
class Reaction < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Reaction.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Reaction.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand Down
20 changes: 2 additions & 18 deletions lib/fhir_models/r4/generated/resources/Appointment.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class Appointment < FHIR::Model
class Appointment < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

SEARCH_PARAMS = ['actor', 'appointment-type', 'based-on', 'date', 'identifier', 'location', 'part-status', 'patient', 'practitioner', 'reason-code', 'reason-reference', 'service-category', 'service-type', 'slot', 'specialty', 'status', 'supporting-info']
METADATA = {
'id' => {'type'=>'id', 'path'=>'Appointment.id', 'min'=>0, 'max'=>1},
Expand Down Expand Up @@ -47,19 +39,11 @@ def versioned_fhir_module
'requestedPeriod' => {'type'=>'Period', 'path'=>'Appointment.requestedPeriod', 'min'=>0, 'max'=>Float::INFINITY}
}

class Participant < FHIR::Model
class Participant < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

METADATA = {
'id' => {'type'=>'string', 'path'=>'Participant.id', 'min'=>0, 'max'=>1},
'extension' => {'type'=>'Extension', 'path'=>'Participant.extension', 'min'=>0, 'max'=>Float::INFINITY},
Expand Down
10 changes: 1 addition & 9 deletions lib/fhir_models/r4/generated/resources/AppointmentResponse.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module FHIR
module R4
class AppointmentResponse < FHIR::Model
class AppointmentResponse < Model
include FHIR::Hashable
include FHIR::Json
include FHIR::Xml

def fhir_version_string
'R4'
end

def versioned_fhir_module
FHIR::R4
end

SEARCH_PARAMS = ['actor', 'appointment', 'identifier', 'location', 'part-status', 'patient', 'practitioner']
METADATA = {
'id' => {'type'=>'id', 'path'=>'AppointmentResponse.id', 'min'=>0, 'max'=>1},
Expand Down
Loading

0 comments on commit fdce99c

Please sign in to comment.