reprocessMissing only date
This commit is contained in:
@@ -49,6 +49,7 @@ interface Args {
|
||||
dpi: number | "auto";
|
||||
maxPages: number;
|
||||
force: boolean;
|
||||
reprocessMissing: boolean;
|
||||
outDir: string;
|
||||
timeoutMs: number;
|
||||
}
|
||||
@@ -78,6 +79,7 @@ function parseArgs(): Args {
|
||||
// Nur PDFs mit HOECHSTENS so vielen Seiten werden per Vision gescannt.
|
||||
maxPages: parseInt(get("--max-pages", "10")!, 10) || 10,
|
||||
force: a.includes("--force"),
|
||||
reprocessMissing: a.includes("--reprocess-missing"),
|
||||
outDir: get("--out-dir", "out")!,
|
||||
timeoutMs: (parseInt(get("--timeout", "180")!, 10) || 180) * 1000,
|
||||
};
|
||||
@@ -588,10 +590,21 @@ async function main(): Promise<void> {
|
||||
});
|
||||
if (args.only) candidates = candidates.filter((r) => r.file_name === args.only);
|
||||
|
||||
// Resume-Skip VOR dem Limit: fehlerfrei mit echtem Vision-Ergebnis = fertig
|
||||
// Resume-Skip VOR dem Limit: fehlerfrei mit echtem Vision-Ergebnis = fertig.
|
||||
// Mit --reprocess-missing gelten Datensaetze OHNE Datum als unvollstaendig
|
||||
// und werden erneut verarbeitet (fuer gezielte Nachlaeufe, ohne JSON-Editieren).
|
||||
const isIncomplete = (r: Record<string, unknown>): boolean => {
|
||||
if (!args.reprocessMissing) return false;
|
||||
// buyer_sheet/ca_only ohne Datum gilt als unvollstaendig
|
||||
const dt = r["_doc_type"];
|
||||
if (dt === "other") return false;
|
||||
const hasDate = r["date_of_introduction"] != null && r["date_of_introduction"] !== "";
|
||||
return !hasDate;
|
||||
};
|
||||
const pending = candidates.filter((r) => {
|
||||
const prev = done.get(r.file_name);
|
||||
const hasResult = prev && prev["_parser"] === "vision" && !prev["_vision_error"];
|
||||
if (hasResult && prev && isIncomplete(prev)) return true; // unvollstaendig -> neu
|
||||
return !(hasResult && !args.force);
|
||||
});
|
||||
const skipped = candidates.length - pending.length;
|
||||
|
||||
Reference in New Issue
Block a user