Stream: dotnet
Topic: Validation code issue
Torben M. Hagensen (Feb 09 2021 at 14:43):
Hi, I am trying to validate a bundle resource against profiles defined in an implementation guide with dependencies. I have created the following code (takes file name of the resource and a list of zip file names for the definitions, but it cannot resolve the valuesets given in the definitions (no fhir server is involved for now).
Does someone have a hint what I might be missing?
using (var streamReader = new StreamReader(fileName))
{
var jsonReader = new JsonTextReader(streamReader);
var jsonParser = new FhirJsonParser();
try
{
var content = jsonParser.Parse(jsonReader);
var resolvers = new List<IAsyncResourceResolver>();
resolvers.Add(new CachedResolver(ZipSource.CreateValidationSource()));
foreach (var zipFile in profileZipFiles)
resolvers.Add(new CachedResolver(new ZipSource(zipFile)));
var settings = ValidationSettings.CreateDefault();
var multiResolver = new MultiResolver(resolvers);
settings.ResourceResolver = multiResolver;
settings.GenerateSnapshot = true;
var validator = new Hl7.Fhir.Validation.Validator(settings);
var outcome = validator.Validate(content);
if (outcome.Success)
Console.WriteLine("File successfully validated");
else
{
Console.WriteLine(outcome.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Torben M. Hagensen (Feb 12 2021 at 07:33):
Torben M. Hagensen said:
Does someone have a hint what I might be missing?
@Mirjam Baltus - Is it not possible to resolve valuesets provided in a zipfile using the API?
Ewout Kramer (Feb 16 2021 at 12:08):
One missing feature in our Local terminology service and resolvers is that they won't be able to find ValueSets that are defined implicitly by a CodeSystem. See https://github.com/FirelyTeam/firely-net-sdk/issues/1570.
Maybe this is the case?
Torben M. Hagensen (Feb 19 2021 at 07:30):
Ewout Kramer said:
One missing feature in our Local terminology service and resolvers is that they won't be able to find ValueSets that are defined implicitly by a CodeSystem. See https://github.com/FirelyTeam/firely-net-sdk/issues/1570.
Maybe this is the case?
Yes, that is probably the case. I guess I will have to establish a server with the valuesets to make it work.
Last updated: Apr 12 2022 at 19:14 UTC