-
Notifications
You must be signed in to change notification settings - Fork 109
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
switch the type of Element.id from id to string for R4B #160
Conversation
@cybernop Thanks a lot for your PR. Please have a look here https://github.com/nazrulworld/fhir.resources?tab=readme-ov-file#resourceid-aka-fhirtypesid-constraint-extensibility Here is an example of patch https://github.com/nazrulworld/fhir.resources/blob/main/fhir/resources/core/patch/patch_r4b_test.py |
@nazrulworld Thanks for the reply. But I do not fully understand what you are trying to tell me. Do you want to tell me error is on the user side or should should I add a test case? I do not want to to change the length of Id nor do I want to create a patch for something. I just wanted to fix an error in the data type definition. In my opinion the type of |
I just want to stress that this is an issue of incorrect type and not the length of ID |
That's especially annoying since it's only the case for R4B, not for DSTU2, STU3 or R5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types have changed in f604fb1.
It is now StringType
636b992
to
f8e085d
Compare
Updated the type to use the new |
I want to stress how important this issue is, as in Germany we only use R4(B) at the moment and this issue prevents us to use the library for any StructureDefinition |
@cybernop This PR should be merged with the branch 7.X.X, right? |
I took the liberty to create a separate PR #165 for 7.x.x as it should be fixed in both 7.x.x and main, but the commits differ slightly. |
fhir/resources/R4B/element.py
Outdated
@@ -43,7 +43,7 @@ class Element(fhirabstractmodel.FHIRAbstractModel): | |||
}, | |||
) | |||
|
|||
id: fhirtypes.IdType | None = Field( # type: ignore | |||
id: fhirtypes.StringType = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My last comment was incomplete, sorry.
Comparing with fhir/resources/element.py, fhirtypes.StringType | None
is the correct type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right, I adjusted my PR
According to the FHIR documentation Element.id should be of type string. Before it was of type id which caused errors when parsing structure definitions with type scling what results the have `:` in their id. Which is allowed and supported for string but not for id.
f8e085d
to
a309dff
Compare
@nazrulworld This change should be merged into main. PR #165 by @Horstage covers my original modification compatible to 7.X.X and should be merged into that branch. |
This new release should have been your PR included https://pypi.org/project/fhir.resources/8.0.0b4/ |
According to the FHIR documentation
Element.id
should be of typestring
.StructureDefinitions with type slicing will have entries in the differential and snapshot part in the format like
Observation.category:VSCat
. This is valid according to the specification. But before the element was of typeid
which caused validation errors when parsing StructureDefinitions like this.