Skip to content

Commit

Permalink
adding date of parsing (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolassaw authored Sep 15, 2024
1 parent 2722fc4 commit 66f1f46
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/cleaner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import json, argparse, os, datetime as dt, xxhash
from azure.cosmos import CosmosClient, exceptions
from dotenv import load_dotenv
import json
import os
import datetime as dt
import xxhash

class Cleaner:

def __init__(self, county):
self.county = county.lower()

def add_parsing_date(self, input_dict: dict, out_file: dict) -> dict:
# This will add the date of parsing to the final cleaned json file
today_date = dt.datetime.today().strftime('%Y-%m-%d')
out_file['parsing_date'] = today_date
return out_file

def clean(self):

case_json_folder_path = os.path.join(
Expand Down Expand Up @@ -112,6 +119,9 @@ def contains_good_motion(motion, event):
def_atty_hash = xxhash.xxh64(str(def_atty_unique_str)).hexdigest()
out_file["defense attorney"] = def_atty_hash

# This adds the date of parsing to the final cleaned json
out_file = self.add_parsing_date(input_dict, out_file)

# Original Format
out_filepath = os.path.join(
os.path.dirname(__file__), "..", "..", "data", self.county, "case_json_cleaned",case_json
Expand Down

0 comments on commit 66f1f46

Please sign in to comment.