-
Notifications
You must be signed in to change notification settings - Fork 0
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
DIG-1671: Adding date format to manifest #66
Conversation
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.
If I change the template line to
DONOR.INDEX.date_of_birth, {date_interval(Donor.date_of_birth, date_format="MDY")}
I don't think the date_format gets passed in? If I add a print statement to the top of date_interval
in mappings.py, like
def date_interval(data_values, date_format=None):
print(f"hello {date_format}")
I get a lot of "hello None" in the output.
I don't think that you can pass in extra arguments like this into the template file, at least not as I've written it.
I appreciate the idea behind making it more flexible for date formats, but I'm not sure that it's possible to do it this way. I think you might have to write a wrapper method in your own .py file that parses the date with a format.
Re-submitting PR, DIG-1671 What's new
How to test
|
I added some try catch blocks to the part that is reading the manifest so that if the fields are blank, the script exits as well as if the manifest doesn't have those specified at all, also added a catch to ensure the date format is some form of 'DMY/MDY/YDM' |
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.
Looks good to me and works as expected
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.
Tiny changes
@daisieh I addressed the changes and Marion's fix is working |
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.
Looks good to me! Thanks to both @yavyx and @mshadbolt for taking over so much of the coding in this project!
What's new
How to test
Previously:
Added adate_format
parameter to thedate_interval
mapping function to specify the order of day, month and year to parse ambiguous dates properly.How to test- Adddate_format
to any date field in the templateDONOR.INDEX.date_of_birth, {date_interval(Donor.date_of_birth, date_format="DMY")}- RunCSVConvert.py
using a dataset with ambiguous dates for that field and try different patterns in the template to confirm they are parsed as indicated.