-
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
Repackage (rename) zip files with old filename #188
Conversation
@teknofire this is the old message file format, I noticed theres no {
"id": "10009",
"filename": "10009.zip",
"path": "KEA/events/2024-01/KOTZ-735-GEN_07",
"data_type": "events"
} |
We should definitely fix the id/event_id and update the filename. For the path, I'm not sure we should actually have that now. That was something we needed when the mqtt message was being pushed from the kea side but now that the message is being transferred with the file the script that will read it in should determine the path to use itself instead. Also can we add the md5sum of the zip file in the message. |
Okay great, I created this issue for it and will work on that! |
I've updated the scripts to updated the message files/content, it handles three different file versions: For V1 file, the script repackages (unzips, renames, zips, creates new message file) according to the new naming convention. Message File Versions/Formats V1 {
"id": "10009",
"filename": "kea-events-sel00-202406-10009.zip",
"path": "kea/events/2024-06/sel00/10009",
"data_type": "events"
} V2 {
"event_id": "10009",
"filename": "kea-events-sel00-202406-10009.zip",
"path": "kea/events/2024-06/sel00/10009",
"data_type": "events"
} V3 {
"event_id": "10009",
"filename": "kea-events-sel00-202406-10009.zip",
"md5sum": "12345678901234567890qwerty",
"data_type": "events"
} Testing |
b6beb79
to
34aed51
Compare
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.
…ole/repackage-level0-files
Added summary (tested on different data sets) Summary of Processed Message Formats:
Version Count
------- -----
V1 35
V2 18
V3 (skipped) 64 Summary of Processed Message Formats:
Version Count
------- -----
V1 35
V2 0
V3 (skipped) 82 Summary of Processed Message Formats:
Version Count
------- -----
V1 0
V2 0
V3 (skipped) 117 |
This PR introduces a new script,
repackage-event-files.sh
, designed to repackage event files with the old filenames in (event_id.zip
andevent_id.zip.message
) system by unzipping, renaming, and re-zipping them according to a new naming convention. The script also includes a feature to skip files that already follow the new naming convention, allowing it to be run on directories that may contain both old and new file formats.New Naming Convention:
location-data_type-meter-YYYYMM-id
^.*/[^/]+-[^/]+-[^/]+-[0-9]{6}-[0-9]+\.zip\.message$
. If a file matches this pattern, it is skipped, preventing unnecessary processing and allowing the script to be run on both file name formats.Usage:
./repackage-event-files.sh <BASE_DIR>
BASE_DIR
: camio-meter-stream/kea/events/level0Testing:
I copy the data from
camio-psi-streams
toot-dev
and ran the script on it to rename/repackage and it was successful.