ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Redgrave/RelativityAuditReportJsonInspector.py
Revision: 957
Committed: Mon Dec 8 21:08:12 2025 UTC (3 months, 2 weeks ago) by nino.borges
Content type: text/x-python
File size: 1109 byte(s)
Log Message:
First version of this program to try to inspect the JSON schema on a Relativity audit history report.

File Contents

# Content
1 """
2
3 RelativityAuditReportJsonInspector
4
5 Created by:
6 Emanuel Borges
7 12.08.2025
8
9 Using my JSON inspector library to possibly take a Relativity Audit report and understand its schema.
10
11 """
12
13
14 def inspect_details_schema_from_csv(csv_path: str, limit: Optional[int] = None) -> None:
15 """
16 Read the 'Details' column from a Relativity audit CSV and infer the JSON schema
17 across all rows (or up to 'limit' rows if provided).
18 """
19 inspector = JsonSchemaInspector()
20
21 count = 0
22 with open(csv_path, newline="", encoding="utf-8-sig") as f:
23 reader = csv.DictReader(f)
24 for row in reader:
25 details_str = row.get("Details") or ""
26 inspector.add_json_str(details_str)
27
28 count += 1
29 if limit is not None and count >= limit:
30 break
31
32 print(f"Processed {count} CSV rows.")
33 print("Inferred Details JSON schema:\n")
34 inspector.print_schema()
35
36
37 if __name__ == "__main__":
38 # Example usage:
39 csv_path = r"C:\path\to\RelativityAuditReport.csv"
40 inspect_details_schema_from_csv(csv_path, limit=500) # limit optional