-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathannotate_JSON_git.py
More file actions
31 lines (25 loc) · 968 Bytes
/
annotate_JSON_git.py
File metadata and controls
31 lines (25 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import numpy as np
import re
import csv
import os
#path = os.getcwd() #check
#print(path) #check
#Read File
list_UUID = list(pd.read_csv("./Documents/Tickets/ky14386/IDs.txt", names=['UUID'])['UUID'])
# Start writing file with the openin bracket
B19_JSON = open("./Documents/Tickets/ky14386/B19.json", "w")
B19_JSON.writelines("[")
B19_JSON.close()
# Appending the UUIDs (data shattered for compliance to confidentiality)
for i in list_UUID:
json_rec = '{"node_id": "' + i + '", "reason": "Duplicate item", "classification": "Notification", "category": "General"}'
if list_UUID.index(i) < len(list_UUID)-1 :
json_rec = json_rec + "," #skip comma for the last item
B19_JSON = open("./Documents/Tickets/ky14386/B19.json", "a") #append
B19_JSON.writelines(json_rec)
B19_JSON.close()
# Close bracket
B19_JSON = open("./Documents/Tickets/ky14386/B19.json", "a") #append
B19_JSON.writelines("]")
B19_JSON.close()