static void InitUserProfiles() { Console.WriteLine($"Fetch profiles in target location..."); var src = _dirSource = new DirectorySource(_targetPath, includeSubDirs); _cachedDirSource = new CachedResolver(src); var userProfiles = _userProfiles = src.ListResourceUris().ToList(); Console.WriteLine($"Found {userProfiles.Count} profiles."); Console.WriteLine($"Determine mappings..."); foreach (var profile in userProfiles) { var sd = _cachedDirSource.FindStructureDefinition(profile, false); if (EnsureSnapshot(sd)) { var key = ModelInfo.CanonicalUriForFhirCoreType(sd.Type); if (!_mappings.TryGetValue(key, out string existing)) { Console.WriteLine($"Map references of type '{sd.Type}' to user profile '{sd.Url}'"); _mappings.Add(key, sd.Url); } else { Console.WriteLine($"Warning! Ignore duplicate user profile '{sd.Url}' for reference target type '{sd.Type}'"); } } } }
static void Validate(string profileUrl) { Console.WriteLine($"Validate '{profileUrl}' ..."); var sd = _cachedDirSource.FindStructureDefinition(profileUrl, false); if (EnsureSnapshot(sd)) { foreach (var elem in sd.Snapshot.Element) { ValidateElement(elem, sd); } } }