Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 17:39:34 +00:00
co-authored by renee-png
parent 95fc6ace13
commit 750b41e8cd
+14 -2
View File
@@ -234,16 +234,28 @@ const IMPORTERS: ImporterConfig[] = [
soldate: "statute_of_limitations",
archived: "_archived", isarchived: "_archived",
},
numeric: ["claim_amount", "settlement_amount", "default_hourly_rate"],
numeric: ["claim_amount", "settlement_amount", "default_hourly_rate", "flat_fee_amount"],
dateCols: ["opened_at", "closed_at", "filing_date", "next_hearing_date", "statute_of_limitations"],
transform: (r, ctx) => {
const cid = r._clientext ? ctx.clientByExt.get(String(r._clientext)) : null;
const cidByName = r._clientname ? ctx.clientByName.get(String(r._clientname).toLowerCase()) : null;
r.client_id = cid ?? cidByName ?? null;
delete r._clientext; delete r._clientname;
delete r._assignedname; delete r._originatingname;
if (!r.client_id) return null;
const closedFlag = String(r._closedflag ?? "").toLowerCase();
delete r._closedflag;
const s = String(r.status ?? "").toLowerCase();
r.status = s.includes("close") ? "closed" : s.includes("hold") ? "on_hold" : s.includes("intake") ? "intake" : "active";
if (closedFlag === "yes" || closedFlag === "true" || closedFlag === "1") {
r.status = "closed";
} else {
r.status = s.includes("close") ? "closed" : s.includes("hold") ? "on_hold" : s.includes("intake") ? "intake" : "active";
}
// Normalise billing method
if (r.billing_method) {
const bm = String(r.billing_method).toLowerCase();
r.billing_method = bm.includes("flat") ? "flat" : bm.includes("contingency") ? "contingency" : bm.includes("hour") ? "hourly" : null;
}
if (!r.case_number) r.case_number = `CASE-${Date.now()}-${Math.floor(Math.random() * 1000)}`;
if (!r.title) r.title = r.case_number;
return r;