FHIR Chat · CapabilityStatemen - profiles not matching annotations · hapi

Stream: hapi

Topic: CapabilityStatemen - profiles not matching annotations


view this post on Zulip Tobias Cervin (Nov 27 2019 at 06:54):

Can't seem to become friends with CapabilityStatement in our HAPI fhir-server/facade. Even though our Providers and Models have custom profile-urls and look like this:

@RegisterProfileClass(profile = CUSTOM_PROFILE_URL, model = EHMMedicationRequest.class)
@ResourceProviderQualifier(MedicationRequestResourceProvider.class)
public class MedicationRequestResourceProvider extends AbstractValidatingProvider<EHMMedicationRequest> implements IFhirResourceProvider<MedicationRequest> { ... }

@ResourceDef(name="MedicationRequest", profile=CUSTOM_PROFILE_URL)
public class EHMMedicationRequest extends MedicationRequest { ... }

The "GET [base]/metadata?mode=full" returns:

{
          "type": "MedicationRequest",
          "profile": "http://hl7.org/fhir/StructureDefinition/MedicationRequest",
          ...
}

I have tried debugging at the start of the application and found that RuntimeSourceDefinition has the correct custom myResourceProfile. Anyone else wrestled with this?

view this post on Zulip Jens Villadsen (Nov 27 2019 at 21:05):

This was part of https://github.com/jamesagnew/hapi-fhir/pull/1088 . If you run on 4.1.0, it should work for you (as it works for me ;) )

view this post on Zulip Tobias Cervin (Nov 28 2019 at 14:04):

This was part of https://github.com/jamesagnew/hapi-fhir/pull/1088 . If you run on 4.1.0, it should work for you (as it works for me ;) )

Thanks for reply!

We have bumped up to 4.1.0 but the same issue remains.

Debuging through:

if (nextEntry.getKey().isEmpty() == false) {
        Set<TypeRestfulInteraction> resourceOps = new HashSet<>();
        CapabilityStatementRestResourceComponent resource = rest.addResource();
        String resourceName = nextEntry.getKey();

        RuntimeResourceDefinition def;
        FhirContext context = configuration.getFhirContext();
        if (resourceNameToSharedSupertype.containsKey(resourceName)) {
          def = context.getResourceDefinition(resourceNameToSharedSupertype.get(resourceName));
        } else {
          def = context.getResourceDefinition(resourceName);
        }
        resource.getTypeElement().setValue(def.getName());
        resource.getProfileElement().setValue((def.getResourceProfile(serverBase)));

And the custom profiles are nowhere to be found...

view this post on Zulip Jens Villadsen (Nov 28 2019 at 20:20):

- just to be sure - we are talking about the need for a server to generate a capabilitystatement where it states that eg. the MedicationRequest is profiled according to what is stated in the @ResourceDef.profile annotation ?

view this post on Zulip Tobias Cervin (Nov 29 2019 at 06:06):

- just to be sure - we are talking about the need for a server to generate a capabilitystatement where it states that eg. the MedicationRequest is profiled according to what is stated in the @ResourceDef.profile annotation ?

Just so! :slight_smile:

view this post on Zulip Jens Villadsen (Dec 02 2019 at 13:31):

its hard to say then. It works for us

{
          "type": "Appointment",
          "profile": {
            "reference": "http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-appointment"
          }, ...
}

view this post on Zulip Tobias Cervin (Dec 03 2019 at 06:56):

its hard to say then. It works for us

{
"type": "Appointment",
"profile": {
"reference": "http://ehealth.sundhed.dk/fhir/StructureDefinition/ehealth-appointment"
}, ...
}


Hmm, but that looks different still? Your profile is not a string but an object with a reference (and other members as well?)?

view this post on Zulip Jens Villadsen (Dec 03 2019 at 07:12):

pasted image

view this post on Zulip Jens Villadsen (Dec 03 2019 at 07:13):

My profile is a reference - as required by the documentation (STU3)

view this post on Zulip Tobias Cervin (Dec 03 2019 at 07:16):

Ah I see, yeah ours is R4 so it's a canonical url only. Still really weird that it doesn't work...

view this post on Zulip Jens Villadsen (Dec 03 2019 at 07:38):

@James Agnew should using R4 be a problem?


Last updated: Apr 12 2022 at 19:14 UTC