Skip to content

Instantly share code, notes, and snippets.

@fukubaya
Created July 27, 2022 14:58
Show Gist options
  • Save fukubaya/89d349678ebf435724256f78e4e167f6 to your computer and use it in GitHub Desktop.
Save fukubaya/89d349678ebf435724256f78e4e167f6 to your computer and use it in GitHub Desktop.
COCOA exposure_data.json の集計
import json
import datetime
with open("exposure_data.json") as f:
exposure = json.load(f)
result = {}
for x in exposure["exposure_windows"]:
t = int(x['DateMillisSinceEpoch']) / 1000
if t not in result:
result[t] = 0
# COCOAログチェッカーは ScanInstances の数は見てなさそう
# result[t] += 1
result[t] += len(x["ScanInstances"])
for t in sorted(result.keys()):
dt = datetime.datetime.fromtimestamp(t)
print(f"{dt},{result[t]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment