utils directory for helper modules:# In your project rootmkdir scripts/utils
# Save the logger code asscripts/utils/preprocessing_logger.py
LEGALTEXTANALYSIS/
├── data/
│ ├── legal_text_classification.csv
│ └── legal_text.db
├── docs/
│ └── report001/
├── notebooks/
│ ├── data_analysis_and_feature_optimization.ipynb
│ ├── feature_engineering.ipynb
│ └── initial_data_exploration.ipynb
├── scripts/
│ ├── utils/
│ │ └── preprocessing_logger.py # New location
│ ├── create_tables.sql
│ └── import_data.py
└── requirements.txt
# At the top of your notebookimport sys
sys.path.append('../scripts/utils')
from preprocessing_logger import PreprocessingLogger
# Initialize loggerlogger = PreprocessingLogger(log_dir='../logs')
# Use in your preprocessing stepstry:
logger.log_preprocessing_step(
"initial_exploration",
"all_cases",
{"total_cases": len(df), "unique_outcomes": df['case_outcome'].nunique()}
)
except Exception as e:
logger.log_error(e)
This structure: