Decoupled Tracab dat / json from meta data file types #364
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.