Skip to content

Commit

Permalink
Merge pull request #1816 from FirelyTeam/feature/add-ireadonlydict-im…
Browse files Browse the repository at this point in the history
…plementation-r3

Adding IReadOnlyDictionary support (for R3)
  • Loading branch information
ewoutkramer authored Dec 7, 2021
2 parents 35cd21e + 660bd17 commit 7d2d908
Show file tree
Hide file tree
Showing 132 changed files with 20,564 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common
2 changes: 2 additions & 0 deletions contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ This library was a collective effort by the following developers:
* Tilo Christ (Siemens)
* Henley Devereux (Artisan Technology Group)
* Kenneth Myhra (Kufu)
* Gino Canessa (Microsoft)

Thanks to:
* The Azure API for FHIR team at Microsoft for their PRs
* HSCIC (NHS Digital) for their financial support
* Max Hauser (https://github.com/maxhauser/semver) for the Semver parsing library
* Nicholas Blumhardt (https://github.com/sprache/Sprache) for the Sprache general parsing library
113 changes: 113 additions & 0 deletions src/Hl7.Fhir.Core/Model/Generated/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,29 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "coverage":
value = Coverage;
return Coverage is not null;
case "priority":
value = PriorityElement;
return PriorityElement is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Coverage is not null) yield return new KeyValuePair<string,object>("coverage",Coverage);
if (PriorityElement is not null) yield return new KeyValuePair<string,object>("priority",PriorityElement);
}

}

/// <summary>
Expand Down Expand Up @@ -357,6 +380,33 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "party":
value = Party;
return Party is not null;
case "onHold":
value = OnHoldElement;
return OnHoldElement is not null;
case "period":
value = Period;
return Period is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Party is not null) yield return new KeyValuePair<string,object>("party",Party);
if (OnHoldElement is not null) yield return new KeyValuePair<string,object>("onHold",OnHoldElement);
if (Period is not null) yield return new KeyValuePair<string,object>("period",Period);
}

}

/// <summary>
Expand Down Expand Up @@ -694,6 +744,69 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "identifier":
value = Identifier;
return Identifier?.Any() == true;
case "status":
value = StatusElement;
return StatusElement is not null;
case "type":
value = Type;
return Type is not null;
case "name":
value = NameElement;
return NameElement is not null;
case "subject":
value = Subject;
return Subject is not null;
case "period":
value = Period;
return Period is not null;
case "active":
value = Active;
return Active is not null;
case "balance":
value = Balance;
return Balance is not null;
case "coverage":
value = Coverage;
return Coverage?.Any() == true;
case "owner":
value = Owner;
return Owner is not null;
case "description":
value = DescriptionElement;
return DescriptionElement is not null;
case "guarantor":
value = Guarantor;
return Guarantor?.Any() == true;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Identifier?.Any() == true) yield return new KeyValuePair<string,object>("identifier",Identifier);
if (StatusElement is not null) yield return new KeyValuePair<string,object>("status",StatusElement);
if (Type is not null) yield return new KeyValuePair<string,object>("type",Type);
if (NameElement is not null) yield return new KeyValuePair<string,object>("name",NameElement);
if (Subject is not null) yield return new KeyValuePair<string,object>("subject",Subject);
if (Period is not null) yield return new KeyValuePair<string,object>("period",Period);
if (Active is not null) yield return new KeyValuePair<string,object>("active",Active);
if (Balance is not null) yield return new KeyValuePair<string,object>("balance",Balance);
if (Coverage?.Any() == true) yield return new KeyValuePair<string,object>("coverage",Coverage);
if (Owner is not null) yield return new KeyValuePair<string,object>("owner",Owner);
if (DescriptionElement is not null) yield return new KeyValuePair<string,object>("description",DescriptionElement);
if (Guarantor?.Any() == true) yield return new KeyValuePair<string,object>("guarantor",Guarantor);
}

}

}
Expand Down
205 changes: 205 additions & 0 deletions src/Hl7.Fhir.Core/Model/Generated/ActivityDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,29 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "type":
value = TypeElement;
return TypeElement is not null;
case "role":
value = Role;
return Role is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (TypeElement is not null) yield return new KeyValuePair<string,object>("type",TypeElement);
if (Role is not null) yield return new KeyValuePair<string,object>("role",Role);
}

}

/// <summary>
Expand Down Expand Up @@ -397,6 +420,37 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "description":
value = DescriptionElement;
return DescriptionElement is not null;
case "path":
value = PathElement;
return PathElement is not null;
case "language":
value = LanguageElement;
return LanguageElement is not null;
case "expression":
value = ExpressionElement;
return ExpressionElement is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (DescriptionElement is not null) yield return new KeyValuePair<string,object>("description",DescriptionElement);
if (PathElement is not null) yield return new KeyValuePair<string,object>("path",PathElement);
if (LanguageElement is not null) yield return new KeyValuePair<string,object>("language",LanguageElement);
if (ExpressionElement is not null) yield return new KeyValuePair<string,object>("expression",ExpressionElement);
}

}

/// <summary>
Expand Down Expand Up @@ -1310,6 +1364,157 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "url":
value = UrlElement;
return UrlElement is not null;
case "identifier":
value = Identifier;
return Identifier?.Any() == true;
case "version":
value = VersionElement;
return VersionElement is not null;
case "name":
value = NameElement;
return NameElement is not null;
case "title":
value = TitleElement;
return TitleElement is not null;
case "status":
value = StatusElement;
return StatusElement is not null;
case "experimental":
value = ExperimentalElement;
return ExperimentalElement is not null;
case "date":
value = DateElement;
return DateElement is not null;
case "publisher":
value = PublisherElement;
return PublisherElement is not null;
case "description":
value = Description;
return Description is not null;
case "purpose":
value = Purpose;
return Purpose is not null;
case "usage":
value = UsageElement;
return UsageElement is not null;
case "approvalDate":
value = ApprovalDateElement;
return ApprovalDateElement is not null;
case "lastReviewDate":
value = LastReviewDateElement;
return LastReviewDateElement is not null;
case "effectivePeriod":
value = EffectivePeriod;
return EffectivePeriod is not null;
case "useContext":
value = UseContext;
return UseContext?.Any() == true;
case "jurisdiction":
value = Jurisdiction;
return Jurisdiction?.Any() == true;
case "topic":
value = Topic;
return Topic?.Any() == true;
case "contributor":
value = Contributor;
return Contributor?.Any() == true;
case "contact":
value = Contact;
return Contact?.Any() == true;
case "copyright":
value = Copyright;
return Copyright is not null;
case "relatedArtifact":
value = RelatedArtifact;
return RelatedArtifact?.Any() == true;
case "library":
value = Library;
return Library?.Any() == true;
case "kind":
value = KindElement;
return KindElement is not null;
case "code":
value = Code;
return Code is not null;
case "timing":
value = Timing;
return Timing is not null;
case "location":
value = Location;
return Location is not null;
case "participant":
value = Participant;
return Participant?.Any() == true;
case "product":
value = Product;
return Product is not null;
case "quantity":
value = Quantity;
return Quantity is not null;
case "dosage":
value = Dosage;
return Dosage?.Any() == true;
case "bodySite":
value = BodySite;
return BodySite?.Any() == true;
case "transform":
value = Transform;
return Transform is not null;
case "dynamicValue":
value = DynamicValue;
return DynamicValue?.Any() == true;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (UrlElement is not null) yield return new KeyValuePair<string,object>("url",UrlElement);
if (Identifier?.Any() == true) yield return new KeyValuePair<string,object>("identifier",Identifier);
if (VersionElement is not null) yield return new KeyValuePair<string,object>("version",VersionElement);
if (NameElement is not null) yield return new KeyValuePair<string,object>("name",NameElement);
if (TitleElement is not null) yield return new KeyValuePair<string,object>("title",TitleElement);
if (StatusElement is not null) yield return new KeyValuePair<string,object>("status",StatusElement);
if (ExperimentalElement is not null) yield return new KeyValuePair<string,object>("experimental",ExperimentalElement);
if (DateElement is not null) yield return new KeyValuePair<string,object>("date",DateElement);
if (PublisherElement is not null) yield return new KeyValuePair<string,object>("publisher",PublisherElement);
if (Description is not null) yield return new KeyValuePair<string,object>("description",Description);
if (Purpose is not null) yield return new KeyValuePair<string,object>("purpose",Purpose);
if (UsageElement is not null) yield return new KeyValuePair<string,object>("usage",UsageElement);
if (ApprovalDateElement is not null) yield return new KeyValuePair<string,object>("approvalDate",ApprovalDateElement);
if (LastReviewDateElement is not null) yield return new KeyValuePair<string,object>("lastReviewDate",LastReviewDateElement);
if (EffectivePeriod is not null) yield return new KeyValuePair<string,object>("effectivePeriod",EffectivePeriod);
if (UseContext?.Any() == true) yield return new KeyValuePair<string,object>("useContext",UseContext);
if (Jurisdiction?.Any() == true) yield return new KeyValuePair<string,object>("jurisdiction",Jurisdiction);
if (Topic?.Any() == true) yield return new KeyValuePair<string,object>("topic",Topic);
if (Contributor?.Any() == true) yield return new KeyValuePair<string,object>("contributor",Contributor);
if (Contact?.Any() == true) yield return new KeyValuePair<string,object>("contact",Contact);
if (Copyright is not null) yield return new KeyValuePair<string,object>("copyright",Copyright);
if (RelatedArtifact?.Any() == true) yield return new KeyValuePair<string,object>("relatedArtifact",RelatedArtifact);
if (Library?.Any() == true) yield return new KeyValuePair<string,object>("library",Library);
if (KindElement is not null) yield return new KeyValuePair<string,object>("kind",KindElement);
if (Code is not null) yield return new KeyValuePair<string,object>("code",Code);
if (Timing is not null) yield return new KeyValuePair<string,object>("timing",Timing);
if (Location is not null) yield return new KeyValuePair<string,object>("location",Location);
if (Participant?.Any() == true) yield return new KeyValuePair<string,object>("participant",Participant);
if (Product is not null) yield return new KeyValuePair<string,object>("product",Product);
if (Quantity is not null) yield return new KeyValuePair<string,object>("quantity",Quantity);
if (Dosage?.Any() == true) yield return new KeyValuePair<string,object>("dosage",Dosage);
if (BodySite?.Any() == true) yield return new KeyValuePair<string,object>("bodySite",BodySite);
if (Transform is not null) yield return new KeyValuePair<string,object>("transform",Transform);
if (DynamicValue?.Any() == true) yield return new KeyValuePair<string,object>("dynamicValue",DynamicValue);
}

}

}
Expand Down
Loading

0 comments on commit 7d2d908

Please sign in to comment.