Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong element cardinality #1824

Closed
Rob5045 opened this issue Jul 26, 2021 · 0 comments · Fixed by #1826
Closed

Wrong element cardinality #1824

Rob5045 opened this issue Jul 26, 2021 · 0 comments · Fixed by #1826
Assignees

Comments

@Rob5045
Copy link
Contributor

Rob5045 commented Jul 26, 2021

Derived profile contains wrong Min cardinality even though it was not changed in regards to the base profile.

Original bug was reported for Forge (https://firely.atlassian.net/browse/FOR-497). Additional information can be found there.

FHIR version: R4 (may also exist in other Fhir versions but not tested)
SDK version: 3.4.0

Unit test to reproduce error (directory source folder contents: resourceProfiles.zip):

    [TestMethod]
    public void TestObservationCodeCardinality()
    {
        // Arrange
        var zipSource = ZipSource.CreateValidationSource();
        var dirSource = new DirectorySource("resourceProfiles\\FOR-497");
        var resolver = new CachedResolver(new MultiResolver(zipSource, dirSource));
        var snapshotGenerator = new SnapshotGenerator(resolver, SnapshotGeneratorSettings.CreateDefault());
        var sd = resolver.ResolveByCanonicalUri("http://hl7.org/fhir/StructureDefinition/Observation") as StructureDefinition;
        var sut = resolver.ResolveByCanonicalUri("http://hl7.org/fhir/uv/ips/StructureDefinition/Observation-results-uv-ips") as StructureDefinition;

        // Act
        var elements = snapshotGenerator.Generate(sut);

        // Assert
        snapshotGenerator.Outcome.Should().BeNull();

        const string codeId = "Observation.code";

        var sdCode = sd.Snapshot.Element.Single(x => x.ElementId == codeId);
        var sutCode = elements.Single(x => x.ElementId == codeId);

        sutCode.Max.Should().Be(sdCode.Max);
        sutCode.Min.Should().Be(sdCode.Min);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants