Error when sending StructureDefinition own profile
# support
a
Hello everybody! I need help creating a Profile and inserting it into Medplum. I'm currently trying to insert a custom profile, based on the ImmunizationResource, but I'm getting a server error. The payload is attached to this message. (It is very extensive) And I'm getting the following message from Medplum: "details": { "text": "Constraint sdf-8a not met: In any differential, all the elements must start with the StructureDefinition's specified type for non-logical models, or with the same type name for logical models" }, "expression": [ "StructureDefinition.differential" ], "diagnostics": "{\"fhirpath\":\"(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().empty() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\\\\\..*','')&'.')))\"}" } Anyone who can help me, I'm lost without knowing what the problem is with the profile. If I remove all elements and only keep Immunization.meta and Immunization.meta.profile, it accepts. If I add Immunization.status, it starts giving the error. Help me please! 😩 😫
w
Hello guys. I'm working with @Adriano Freitas in this project. We are adopting FHIR in Health Department of Goiás (state of Brazil) and Medplum was our choice as FHIR Server. Debbuging, we discovered that if we add on payload the following element, it works!
Copy code
"differential": {
    "element": [
        {
        "id": "Immunization",
        "path": "Immunization"
      }
So, since this isn't neccessary in HAPI FHIR, would be nice if we can understand this behavior. Can anyone help us? @rahul1 @reshma
r
Thanks for this @wanderson.marques - can you explain the exact difference between this and HAPI? Like share both the profiles? I'm not sure I understand the delta. Are these standard profiles?
r
HI @Adriano Freitas - sorry about this. In my experience, many profiles in the wild have a bug in their StructureDefinition that causes them to fail validation. This is a bug in the underylying tool that generates these profiles: https://github.com/FHIR/sushi
I believe Medplum has a stricter validator that HAPI FHIR in this respect
We'll be filing a bug against SUSHI, but for the time being you can delete the entire "differential" from StructureDefinition and itshould work fine
a
Firstly, thank you very much for your quick response @rahul1 and @reshma ! Well, from what little I've researched, it seems to me that the StructureDefinition, within elements such as Snapshot or Differential, must contain an element that references the profile by which that StructureDefinition was defined. For example, if I create my own StructureDefinition, but referencing a Resource of type Patient, I must inform this within the Snapshot or Differential: "snapshot": { "element": [{ "id": "Patient", "path": "Patient", "short": "Dados demográficos do indivíduo", "definition": "Demographics and other administrative information about an individual or animal receiving care or other health-related services.", "alias": [ "SubjectOfCare Client Resident" ], "min": 0, "max": "*", "base": { "path": "Patient", "min": 0, "max": "*" }, In our case, when we included this element in the Profile, which was based on an Immunization, Medplum accepted the inclusion of the Structure Definition. Wanderson insisted and evaluated the code exhaustively and ended up finding this detail. Then we add the following code: "differential": { "element": [ { "id": "Immunization", "path": "Immunization", "short": "Vacina Administrada", "definition": "Dados de aplicação da vacina em determinado indivíduo ou cidadão identificado." }, Worked perfectly. Thank you once again for your time and speed of response, and I thank Wanderson for his patience and insistence in resolving the problem!
w
Thank you guys. As Rahul said, it seems that Medplum is stricter than HAPI FHIR. So, all structure definition snapshot or differential must have the first element referencing the Resource Type in path. We added "path": "Immunization" and it worked.
It's a profile created by us. Without the element that I said, it fails on Medplum but was accepted in HAPI.
r
Yes, that also works - you correctly identified that you first element must have the same path as the resourceType. Therefore, your solution works as well 🙂 We're not sure why HAPI is not validating this contraint
151 Views