-
Notifications
You must be signed in to change notification settings - Fork 65
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
Decoupled Tracab dat / json from meta data file types #364
base: master
Are you sure you want to change the base?
Conversation
It seems my local version and the GitHub tests don't agree on what UTC time is... |
Does anyone have any idea what could be causing this timezone/conversion mismatch? When I test it locally this asserting is true:
But here the automated tests seems to be in disagreement by 1 hour and want it to be
|
I think it is this line: parse(meta_data.match.attrib["dtDate"]).astimezone(timezone.utc) You first parse the date using your local timezone, then the I think the correct implementation is parse(meta_data.match.attrib["dtDate"]).replace(tzinfo=timezone.utc) |
Thanks, totally didn't notice that! |
FWIW, this should now be fixed |
I noticed in the Tracab data-loader we were enforcing that whenever a
.dat
file was provided we could only provide a.xml
meta data file, and when we provide a.json
tracking file this would always need to be paired with a.json
meta data file.I found a situation where this was not the case (ie. we had
.dat
and.json
meta data), and thus the parser broke.Concretely this means:
tracab.load
(more specifically insideidentify_deserializer
) we no longer use the combination ofmeta_data_extension
andraw_data_extension
to see which Deserializer we need. This is now only dependents on theraw_data_extension
meta_data_extension
to the deserializer. I chose to do this by adding a new parameter to bothTRACABDatDeserializer
andTRACABJSONDeserializer
calledmeta_data_extension
. (Note: I tried to do this differently, but because we already open the meta data insideload
and pass it directly to the deserializer as theTRACABInputs()
we can't retrieve themeta_data_extension
after that step.load_meta_data
which takesself.meta_data_extension
andinputs.meta_data
and returns this ugly thing. (I can clean this up by return a dictionary with these values or something, but not sure if that's necessary.load_meta_data
step made me realize that Enriched metadata with date, game_week and game_id #340 had an oversight and did not include UTC date and game_id in the TracabDATDeserializer. This means I had to edit line 176 inkloppy/tests/test_tracab.py
to make the test reflect UTC time. (This is the test that currently fails though)load_meta_data
lives in a newly createdhelpers.py
file insidekloppy/infa/serializers/tracking/tracab/
and it acts a a simple switching board to grab eitherload_meta_data_xml
orload_meta_data_json
based themeta_data_extension
. (This could be done differently, but not sure if that's necessary).helpers.py
file also contains both functions for parsing the correct meta data file.meta_tracking_assertions
. I did this because we're running the same asserts 4 times on 4 different combinations of tracking and meta data.