Add documentation comments to codebase
Prioritize AI agent-friendly comments explaining: - Data model rationale (customers, cards, transactions relationships) - Business rules (anonymized cards, customer_number requirements) - Config file loading order and environment mapping - Import pipeline phases and CSV column mapping - Database operation behaviors (upsert, reset implications) - SQL query rationale and data filtering rules
This commit is contained in:
+13
@@ -18,6 +18,10 @@ fn fmt(v: f64) -> String {
|
||||
format!("{:.2}", v)
|
||||
}
|
||||
|
||||
/// Normalizes CSV date format and cleans the data.
|
||||
///
|
||||
/// AI AGENT NOTE: Input CSV may have dates in different formats (MM/DD/YYYY or YYYY-MM-DD).
|
||||
/// This function standardizes to YYYY-MM-DD HH:MM:SS format for consistent parsing.
|
||||
fn clean_csv_file(
|
||||
input_path: &Path,
|
||||
output_path: &Path,
|
||||
@@ -233,6 +237,11 @@ struct CustomerTemplate {
|
||||
generated_date: String,
|
||||
}
|
||||
|
||||
/// Parses the --env flag from CLI arguments.
|
||||
///
|
||||
/// AI AGENT NOTE: The --env flag can appear anywhere in the argument list.
|
||||
/// Returns the environment and the index of the "--env" flag (for removal).
|
||||
/// Defaults to Prod if not specified.
|
||||
fn parse_env_flag(args: &[String]) -> (Env, usize) {
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
if arg == "--env" && i + 1 < args.len() {
|
||||
@@ -248,6 +257,10 @@ fn parse_env_flag(args: &[String]) -> (Env, usize) {
|
||||
(Env::default(), 0)
|
||||
}
|
||||
|
||||
/// Removes --env and its value from argument list.
|
||||
///
|
||||
/// AI AGENT NOTE: This allows the --env flag to appear anywhere in the
|
||||
/// command without affecting positional argument parsing.
|
||||
fn remove_env_flags(args: &[String]) -> Vec<String> {
|
||||
let (_, env_idx) = parse_env_flag(args);
|
||||
let mut result = Vec::with_capacity(args.len());
|
||||
|
||||
Reference in New Issue
Block a user