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

Proper C# classes for representation FHIR's date and datetime #2

Open
krvital opened this issue Apr 9, 2024 · 2 comments
Open

Proper C# classes for representation FHIR's date and datetime #2

krvital opened this issue Apr 9, 2024 · 2 comments
Assignees

Comments

@krvital
Copy link
Contributor

krvital commented Apr 9, 2024

As a developer using Aidbox .NET SDK, I want to have C# objects for date and datetime representations so that I can format dates and datetimes to strings without prior conversion.

For example, field Patient.BirthDate can be DateOnly object

@krvital
Copy link
Contributor Author

krvital commented Apr 15, 2024

@krvital krvital self-assigned this Apr 15, 2024
@krvital
Copy link
Contributor Author

krvital commented Apr 15, 2024

The problem here is that here is no direct correspondence between FHIR and C# types. In FHIR date type can be represented as year ("2000"), year month ("2000-01") or date.

So there are options of how to implement date and dateTime types conversion FHIR <=> C#

Option 1

Do not convert date and dateTimes. Use strings for dates

Option 2

Convert FHIR date and dateTime to C# DateTime object.

  • On read from FHIR database into C# we can use custom json serializers to convert year or year month to DateTime.
  • On write to FHIR database from C# we can force writing it as full date

Option 3

Provide a client option which will enable/disable date and dateTime serialization

Option 4

Use FHIR wrapper types for Date and DateTime instead of C# native types

@krvital krvital changed the title Use appropriate classes for date and datetime representation Proper C# classes for representation FHIR's date and datetime May 3, 2024
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

No branches or pull requests

1 participant