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

WIP: Use fhirdatetime instead of Pydantic's datetime #68

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmabey
Copy link
Contributor

@mmabey mmabey commented Apr 27, 2021

Re: #29

I tried to be very light-handed with changing the existing validators. It's possible that some of the remaining checks aren't necessary, but I didn't feel like that was my call. I've used the changes to fhir.resources in my own code with success. It's still possible that fhirdatetime has some issues (in fact, I can see that many STU3 and R4 tests are failing with these changes), which is why I've created this as a draft PR. Looking forward to getting some feedback!

@nazrulworld
Copy link
Owner

Thanks a lot for your amazing work!
The major issue, I see the same class is used for three types of data. Date, DateTime, Instant. It is literally possible to provide datetime value for Date type which should not.
for example

dt = fhirdatetime.FhirDateTime.now()
Date.validate(dt)

I think better would be we add two more classes in that package.
I will add details here https://github.com/mmabey/fhirdatetime

@Healthedata1
Copy link

after working with both the smart FHIRClient.py models and fhir.resources. I find that using python's datetime natively works so much better that always converting dates, datetime to a FHIRDate. So I would prefer to keep and I imagine ( no proof ) it works much better with Pydantic and fastAPI.

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 this pull request may close these issues.

None yet

3 participants