Last active
June 3, 2025 17:32
-
-
Save pgwillia/89cd3a70427a78336c0c7f4105002983 to your computer and use it in GitHub Desktop.
Parsing PMPY preservation_event.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # There are some example of scripts in /var/pushmi_pullyu/bin on middlesbrough. Can we do the same kind of thing on prod? | |
| PushmiPullyu::AIP.create(uuid: <uuid>, type: 'items') do |aip_filename, aip_directory| | |
| puts "HENRY: aip_filename=#{aip_filename}" | |
| puts "HENRY: aip_directory=#{aip_directory}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| CSV.open('failure.csv', 'wb') do |csv| | |
| csv << ['event_time','entity_type','entity_uuid', 'error_message'] | |
| data.each do |datum| | |
| csv << [datum['event_time'], datum['entity_type'], datum['entity_uuid'], datum['error_message']] if datum['event_type'] == "fail_and_retry" && datum['try_attempt'] == 16 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'json' | |
| file = File.read('./preservation_events_manipulated.json') | |
| file.each_line do |line| | |
| data << JSON.parse(line) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| CSV.open('success.csv', 'wb') do |csv| | |
| csv << ['event_time','entity_type','entity_uuid'] | |
| data.each do |datum| | |
| csv << [datum['event_time'], datum['entity_type'], datum['entity_uuid']] if datum['event_type'] == "success" | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Request Entity Too Lar'
Request Entity Too Lar'
Request Entity Too Lar'
Request Entity Too Lar'
Unprocessable Entity</'
Request Entity Too Lar'