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

Profile validation success against the not implemented profile with mandatory extensions #1109

Closed
leo9223 opened this issue Sep 12, 2019 · 2 comments
Assignees
Labels

Comments

@leo9223
Copy link

leo9223 commented Sep 12, 2019

FHIR chat link: FHIR Chat Link

Custom Profiles Link: Custom Profiles Link

ISSUE AND EXPECTED BEHAVIOR:

  1. I have not added the UsSsn extension (UsPatient profile referencing UsSsn extension) in the Patient resource

  2. I have added the PkCnic extension (PkPatient profile referencing PkCnic extension) in the patient resource.

  3. I am validating the resource against the UsPatient profile and it should give cardinality error because I have made 1..1 cardinality everywhere (in the extension for the value[x] and for the extension itself, in the custom patient profile for the extension and for the value[x])

  4. But it is giving "Overall Success" in the OperationOutcome object

HOW TO REPRODUCE:

  1. Download the custom profiles from the specified path
  2. give the path to specification.zip
  3. give the path to custom profiles directory
  4. create any type of .net core app and run the code

Here is my code.

            Patient patient = new Patient();
            patient.Id = "1";
            patient.Gender = AdministrativeGender.Male;
            patient.Active = true;
            HumanName hn = new HumanName();
            hn.Family = "Jhon";
            hn.Given = new List<string> { "Doe" };
            patient.Name.Add(hn);
            patient.AddExtension("http://example.org/fhir/StructureDefinition/PkCnic", new FhirString("123456789"));

            ZipSource zipSource = new ZipSource("<path to specification.zip>\\specification.zip");
            DirectorySource directorySource = new DirectorySource("<path to custom profiles directory>");

            MultiResolver mr = new MultiResolver(zipSource, directorySource);
            Validator validator = new Validator(new ValidationSettings
            {
                ResourceResolver = mr
            });

            OperationOutcome operationOutcome = validator.Validate(
                patient,
                "http://example.org/fhir/StructureDefinition/UsPatient");
@marcovisserFurore marcovisserFurore self-assigned this Oct 7, 2019
@marcovisserFurore
Copy link
Member

We have been working on slice validation lately. This update will be released in version 1.4.0, but that has not been released yet.
When I try this use case with the improved slice validation, I get the following error:

[FATAL] Internal logic failure: The value discriminator should have either a 'fixed[x]' or 'binding' element set on 'http://example.org/fhir/StructureDefinition/UsSsn#Extension.url'. (at Patient)

And that is correct because there is no fixed or binding used in the profiles. When you add fixedUri in UsSsn.StructureDefinition.xml then it will work:

    <element id="Extension.url">
      <path value="Extension.url" />
      <representation value="xmlAttr" />
      <short value="identifies the meaning of the extension" />
      <definition value="Source of the definition for the extension code - a logical name or a URL." />
      <comment value="The definition may point directly to a computable or human-readable definition of the extensibility codes, or it may be a logical URI as declared in some other specification. The definition SHALL be a URI for the Structure Definition defining the extension." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Extension.url" />
        <min value="1" />
        <max value="1" />
      </base>
      <fixedUri value="http://example.org/fhir/StructureDefinition/PkCnic"/>
      <type>
        ... etc..

@wmrutten
Copy link
Contributor

wmrutten commented Oct 9, 2019

Note: [...].extension.url elements in the StructureDefinition.snapshot component MUST specify a fixedUri value, otherwise the profile is invalid. We are about to publish a new Forge 23.0 release that contains logic to automatically generate required fixedUri values if missing. Once the new release is available, you can repair these errors by opening a profile in Forge and saving it back to disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants