added fccs_report.py this generates a report of all the errors in a clean html format
This commit is contained in:
@@ -229,6 +229,25 @@ def exported_doc_name(filename):
|
||||
return stem[anchors[-1].end():]
|
||||
|
||||
|
||||
def client_name_from_files(files):
|
||||
"""Best-effort client name from a drawer's export filenames, or None.
|
||||
|
||||
Filenames are '{drawer}_{client}_{folder}_{MM-DD-YYYY}_{doc}.ext', so the
|
||||
client name is the second underscore-delimited token. Client names carry
|
||||
commas/spaces but not underscores; the most common value across the drawer's
|
||||
files is returned to shrug off any oddball filename.
|
||||
"""
|
||||
counts = {}
|
||||
for f in files:
|
||||
parts = f.split("_")
|
||||
if len(parts) >= 2 and parts[1].strip():
|
||||
name = parts[1].strip()
|
||||
counts[name] = counts.get(name, 0) + 1
|
||||
if not counts:
|
||||
return None
|
||||
return max(counts, key=counts.get)
|
||||
|
||||
|
||||
def index_files_by_drawer(export_dir):
|
||||
"""Map each export file to its leading drawer-ID token (before first '_').
|
||||
|
||||
|
||||
Reference in New Issue
Block a user