-
Couldn't load subscription status.
- Fork 354
Overview of the POCO classes and interfaces
classDiagram
direction LR
class IDeepCopyable{
DeepCopy() IDeepCopyable
CopyTo(IDeepCopyable) IDeepCopyable
}
Base --|> IDeepCopyable
class IDeepComparable{
IsExactly(IDeepComparable) bool
Matches(IDeepComparable) bool
}
Base --|> IDeepComparable
class IAnnotated{
Annotations(Type) IEnumerable<object>
}
Base --|> IAnnotated
class IAnnotatable{
AddAnnotation(object) void
RemoveAnnotations(Type) void
}
Base --|> IAnnotatable
namespace System-ComponentModel{
class INotifyPropertyChanged{
PropertyChangedEventHandler PropertyChanged
}
class IValidatableObject{
Validate(ValidationContext) IEnumerable~ValidationResult~
}
}
Base --|> INotifyPropertyChanged
Base --|> IValidatableObject
namespace System-Collections{
class IReadOnlyDictionary~string,object~{
Count
Keys
Values
TryGetValue()
}
}
Base --|> IReadOnlyDictionary
class Base{
<<abstract>>
string TypeName
IEnumerable~Base~ Children()
IEnumerable~ElementValue~ NamedChildren()
IROD AsReadOnlyDictionary()
bool TryGetValue(string, out object)
IEnumerable~KVP~ GetElementPairs()
}
class DataType{
<<abstract>>
}
DataType --|> Element
class PrimitiveType{
<<abstract>>
object ObjectValue
bool HasElements
OnObjectValueChanged() void
ToString() string
}
PrimitiveType --|> DataType
class IExtendable{
List<Extension> Extension
}
class IModifierExtendable{
List<Extension> ModifierExtension
}
IModifierExtendable --|> IExtendable
class Element{
<<abstract>>
string ElementId
}
Element --|> IExtendable
Element --|> Base
class BackboneElement{
<<abstract>>
}
BackboneElement --|> Element
class BackboneType{
<<abstract>>
}
class DomainResource{
<<abstract>>
FindContainedResource() Resource
}
BackboneElement --|> IModifierExtendable
BackboneType --|> IModifierExtendable
DomainResource --|> IModifierExtendable
class Resource{
<<abstract>>
Uri ResourceBase
object SyncLock
}
Resource --|> Base
DomainResource --|> Resource
class ISystemAndCode{
string System
string Code
}
class Code~T~{
ToSystemCode() System.Code
}
class IValue~T~{
T Value
}
class INullableValue~T~
INullableValue --|> IValue
Code --|> ISystemAndCode
Code --|> PrimitiveType
Code --|> INullableValue
-
Maybe getting the TypeName prop should throw on abstract types.
-
PrimitiveTypemakes sure the IROD returns theObjectValuewhen we access thevalueelement. -
Some datatypes have a static
IsValidValue(string)that validates the verbatim string representation:- Base64Binary
- Code
- Date
- FhirBoolean
- FhirDateTime
- FhirDecimal
- FhirString
- FhirUri
- FhirUrl
- Id
- Instant
- Integer
- Integer64
- Markdown
- Oid
- Time
- UnsignedInt
- Uuid
- XHtml (multiple)
-
Some datatypes have conversion methods to convert to CQL types:
- Code
- CodeableConcept
- Code<T>
- Coding
- Date
- FhirDateTime
- Time
-
Why has
Instantno conversion to a CQL type? -
Date,FhirDateTime,TimeandInstanthave lots of comparators and conversions functions. -
Bundlehas all kinds of helper methods to find, resolve and filter child resources. Note that we should have these onParametertoo probably. Convert these methods to an interface on both + extension methods? -
DomainResourcehasFindContainedResource(). -
Canonicalhas helpers to split versions and fragments. -
We have a
Bindableattribute on classes that are bindable according to the FHIR spec. -
IValue<T>is used by primitives where the Value is a reference type (Code, Data, Canonical, etc),INullableValue<T>is used by non-reference types (FhirInteger, FhirBoolean etc.) -
ISystemAndCodeis only used byCode<T>, but is useful to check whether we are dealing with "aCode<T>" (would require something likeGetGenericDefinition()etc to check against it otherwise). Why doesn't theCodingPOCO implement this interface as well? Are we dependent on this being one-on-one withCode<T>? -
There are additional interfaces
IConformanceResource,IVersionableConformanceResource,IIdentifiable,ICoded<T>,IPatientimplemented by the appropriate resources. -
Remember,
BackboneElementis used as the base class for nested classes (likePatient.Contact), whileBackboneTypeis used by data types that may have modifier extensions. -
Confusingly,
Code<T>represents a FHIRCoding: its enum value has both a system+code encoded in the attributes. This is probably why this is a subclass of PrimitiveType (since it has aValueof type enum), but it is not a FHIR Primitive datatype.
- Make
IAnnotatablea subclass ofIAnnotated. - We should implement most of the interfaces explicitly, so we don't clutter the surface of the POCO's too much.
- We should remove
IDeepComparablein favor of anSystem.Collections.Generic.EqualityComparer<Base>(e.g. aExactlyEqualityComparerand aPatternEqualityComparer) There are several different kinds of equality defined, so this matches the usescases better. It also can be based on any of the functions to traverse the tree, it does not have to be on the class itself. -
ElementValueshould be a record, and the fields should become properties. -
Resourcehas a pretty uselessVersionIdproperty that gets/sets theMeta.Versiondand alsoHasVersionId. I think we should remove it. - We should unify FhirTypeConstants and FhirTypeNames, they do the same.
- There are lots of places where we deal with Canonicals, HL7 base urls, analyzing references. We could unify these unto one or two classes.
- Find out why we have
INullableValue<T>andIValue<T>, since it does not seem to be used by us. It does provide typed access to theValueproperty of a primitive, unlikePrimitiveType.INullableValuedoes not seem to have a use, beyond being a shorthand for doingIValue<T?>? - We could move all the comparison logic to the Cql types that correspond to the primitives, so we only have one set. The POCO datatypes could then just invoke the Cql-based comparators etc.