Пример #1
0
        internal static HealthcareLinkingProperties DeserializeHealthcareLinkingProperties(JsonElement element)
        {
            Optional <HealthcareAssertion> assertion = default;
            Optional <string> name = default;
            Optional <IReadOnlyList <HealthcareEntityLink> > links = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("assertion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("links"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <HealthcareEntityLink> array = new List <HealthcareEntityLink>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item));
                    }
                    links = array;
                    continue;
                }
            }
            return(new HealthcareLinkingProperties(assertion.Value, name.Value, Optional.ToList(links)));
        }
 internal HealthcareLinkingProperties(HealthcareAssertion assertion, string name, IReadOnlyList <HealthcareEntityLink> links)
 {
     Assertion = assertion;
     Name      = name;
     Links     = links;
 }
Пример #3
0
 internal HealthcareEntity(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareAssertion assertion, string name, IReadOnlyList <HealthcareEntityLink> links) : base(text, category, subcategory, offset, length, confidenceScore)
 {
     Assertion = assertion;
     Name      = name;
     Links     = links;
 }
        internal static HealthcareEntity DeserializeHealthcareEntity(JsonElement element)
        {
            Optional <HealthcareAssertion> assertion = default;
            Optional <string> name = default;
            Optional <IReadOnlyList <HealthcareEntityLink> > links = default;
            string text = default;
            HealthcareEntityCategory category    = default;
            Optional <string>        subcategory = default;
            int    offset          = default;
            int    length          = default;
            double confidenceScore = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("assertion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value);
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("links"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <HealthcareEntityLink> array = new List <HealthcareEntityLink>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item));
                    }
                    links = array;
                    continue;
                }
                if (property.NameEquals("text"))
                {
                    text = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("category"))
                {
                    category = new HealthcareEntityCategory(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("subcategory"))
                {
                    subcategory = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("offset"))
                {
                    offset = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("length"))
                {
                    length = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("confidenceScore"))
                {
                    confidenceScore = property.Value.GetDouble();
                    continue;
                }
            }
            return(new HealthcareEntity(text, category, subcategory.Value, offset, length, confidenceScore, assertion.Value, name.Value, Optional.ToList(links)));
        }