/// <summary>Root location for organization.</summary> /// <param name="org">The organization.</param> /// <returns>A Location.</returns> public static Location RootLocationForOrg( Organization org) { if (org == null) { throw new ArgumentNullException(nameof(org)); } if ((org.Address == null) || (org.Address.Count == 0)) { #pragma warning disable CA1303 // Do not pass literals as localized parameters throw new ArgumentException("Organization Address is required!"); #pragma warning restore CA1303 // Do not pass literals as localized parameters } Location.PositionComponent position = null; if (HospitalManager.IsHospitalKnown(org.Id)) { position = HospitalManager.PositionForHospital(org.Id); } else if (GeoManager.IsPostalCodeKnown(org.Address[0].PostalCode)) { position = GeoManager.PositionForPostalCode(org.Address[0].PostalCode); } return(new Location() { Meta = new Hl7.Fhir.Model.Meta() { Security = FhirTriplet.SecurityTest.GetCodingList(), }, Id = IdForOrgRootLocation(org.Id), Address = org.Address[0], Status = GetLocationStatus(AvailabilityStatusActive), Mode = Location.LocationMode.Instance, PhysicalType = FhirTriplet.PhysicalTypeSite.GetConcept(), Position = position, ManagingOrganization = new ResourceReference($"{org.ResourceType}/{org.Id}"), Type = FhirGenerator.ConceptListForServiceLocationType(), Name = $"{org.Name} Building", }); }