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

ADaM Date Format Issue #1827

Closed
3 tasks
kanagd03 opened this issue Mar 17, 2023 · 17 comments
Closed
3 tasks

ADaM Date Format Issue #1827

kanagd03 opened this issue Mar 17, 2023 · 17 comments
Labels
enhancement New feature or request good first issue Good for newcomers programming

Comments

@kanagd03
Copy link

kanagd03 commented Mar 17, 2023

Feature Idea

Seems like all the date variables in ADaM(like ADT) are in ISO format similar to SDTM but generally it should be DATE9. format as per ADaM IG.
eg: ISO format 2023-07-25
Date9 format 25JUL2023

Is there any specific reason for not displaying dates in DATE9. format in ADaM datasets in admiral? Yes - See below discussion on why this is kept in ISO format rather than DATE9. format

Proposed Update/Definition of Done

  • Identify vignettes and function documentation discussing/showing ISO format
  • Identify code solution to convert ISO to DATE9 like format
  • In a new branch, include a footnote or snippet of code that shows how to convert to DATE9. format for each identified vignette or function documentation where this change makes sense.
@kanagd03 kanagd03 added enhancement New feature or request programming labels Mar 17, 2023
@bundfussr
Copy link
Collaborator

@kanagd03 , thanks for creating this issue.

admiral does not use any specific formatting for date and datetime variables. The lubridate package is used to create these variables.

I could not find any guidance in the ADaM IG regarding formatting of dates except

Numeric date, time, and datetime variables should be formatted, so as to be human-readable with no loss of precision.

The ISO formats used in the ADaM Date Value column are for the purposes of illustration, and are not intended to imply any type of display standard or requirement. The DT variable is numeric and the producer will determine the appropriate display format.

Did I miss it?

@bms63
Copy link
Collaborator

bms63 commented Mar 30, 2023

Hi @kanagd03 I think @bundfussr has answered this question sufficiently. Perhaps we can make a recommendation in our guidance documentation on how to format like a DATE9?

@pharmaverse/admiral any thoughts?

@jeffreyad
Copy link
Collaborator

Yes, I was thinking it would be good to mention how to apply formats like date9 in xportr

@bundfussr
Copy link
Collaborator

The tricky question is where we should add this information.

At the end of our vignettes ("Add Labels and Attributes") section we are referring to xportr but we do not mention formats explicitly. Maybe we should replace "associate all metadata information" with something like "associate label, length, and format metadata information".

We could also add a paragraph to the functions which create date and datetime variables (derive_vars_dt() and derive_vars_dtm()).

@kanagd03
Copy link
Author

kanagd03 commented Mar 31, 2023 via email

@bms63
Copy link
Collaborator

bms63 commented Mar 31, 2023

@kanagd03 thank you for bringing this up - could you open a second issue for ATMF? That way we can keep this issue focused on the formatting issue you brought to our attention

@kanagd03
Copy link
Author

kanagd03 commented Apr 3, 2023 via email

@bms63
Copy link
Collaborator

bms63 commented Apr 10, 2023

Can this just be made into a footnote in the documentation/vignette for these functions showing how to use lubridate::function to make this into date9.?

@kanagd03
Copy link
Author

kanagd03 commented Apr 11, 2023 via email

@bms63 bms63 added the good first issue Good for newcomers label Apr 11, 2023
@bms63
Copy link
Collaborator

bms63 commented Apr 11, 2023

Hi all. I updated the original question to include a proposal on how to address this issue identified. Please give feedback if it is unclear.

@bundfussr
Copy link
Collaborator

@bms63 , what do you mean by "Identify code solution to convert ISO to DATE9 like format"? Do you want to change the way how date and datetime variables are displayed in the console or in the dataset viewer or do you want to add how to call xportr_format()?

@bms63
Copy link
Collaborator

bms63 commented Apr 14, 2023

@bms63 , what do you mean by "Identify code solution to convert ISO to DATE9 like format"? Do you want to change the way how date and datetime variables are displayed in the console or in the dataset viewer or do you want to add how to call xportr_format()?

I was thinking just in the console/dataset viewer.

@bundfussr
Copy link
Collaborator

@bms63 , what do you mean by "Identify code solution to convert ISO to DATE9 like format"? Do you want to change the way how date and datetime variables are displayed in the console or in the dataset viewer or do you want to add how to call xportr_format()?

I was thinking just in the console/dataset viewer.

@bms63 , I am not sure if this is a good idea. We tried something similar in the beginning. For datetime variables time is not displayed if it is "00:00:00". We added some code to force displaying "00:00:00". But it caused a lot of issues. At the end we removed it.

@bms63
Copy link
Collaborator

bms63 commented Apr 14, 2023

Oh

@bms63 , what do you mean by "Identify code solution to convert ISO to DATE9 like format"? Do you want to change the way how date and datetime variables are displayed in the console or in the dataset viewer or do you want to add how to call xportr_format()?

I was thinking just in the console/dataset viewer.

@bms63 , I am not sure if this is a good idea. We tried something similar in the beginning. For datetime variables time is not displayed if it is "00:00:00". We added some code to force displaying "00:00:00". But it caused a lot of issues. At the end we removed it.

Sorry this is for 2023-07-25 to 25JUL2023

@bundfussr
Copy link
Collaborator

Oh

@bms63 , what do you mean by "Identify code solution to convert ISO to DATE9 like format"? Do you want to change the way how date and datetime variables are displayed in the console or in the dataset viewer or do you want to add how to call xportr_format()?

I was thinking just in the console/dataset viewer.

@bms63 , I am not sure if this is a good idea. We tried something similar in the beginning. For datetime variables time is not displayed if it is "00:00:00". We added some code to force displaying "00:00:00". But it caused a lot of issues. At the end we removed it.

Sorry this is for 2023-07-25 to 25JUL2023

Yes, but I would expect the same issues. As far as I remember we added a class to the datetime variables and defined for this class how it should be displayed. You could do something similar for displaying 2023-07-25 as 25JUL2023. The challenging part is to add this class at all places where a date/datetime variable is created and keep it whenever it is modified.

@kaz462
Copy link
Collaborator

kaz462 commented Apr 18, 2023

Just curious why do we need to display a specific date format in the R console/dataset viewer? Is it sufficient to only display the proper date format in the XPT file based on format.sas attribute?

> attributes(adsl$TRTSDT)
$label
[1] "Date of First Exposure to Treatment"

$class
[1] "Date"

$format.sas
[1] "DATE9"

@bms63
Copy link
Collaborator

bms63 commented Apr 24, 2023

After some more discussion with core team, we have decided that this issue will not be pursued/addressed. We feel that this issue would require some significant updates to admiral codebase which would fall outside of our scope with using formats in R versus SAS. The compromise solution around providing example code for converting to DATE9. would also requite a lot of updates to all our documentation, templates and vignettes that we don't think is worthwhile.

Perhaps enhancements to Bayer's https://bayer-group.github.io/sas2r/index.html could be helpful to address this issue - as other SAS programmers have brought this up. @kaz462 what do you think?

@bms63 bms63 closed this as completed Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers programming
Development

No branches or pull requests

5 participants