Skip to content

Conversation

louispt1
Copy link

Comment on lines +71 to +96
df = pd.read_csv(io.StringIO(csv_text), index_col=0)
except Exception as e:
return ServiceResult.fail([f"Failed to parse bulk CSV: {e}"])

results: Dict[str, io.StringIO] = {}
warnings: list[str] = []

groups: Dict[str, list[str]] = {}
for col in df.columns:
base = str(col)
for sep in (":", "/"):
if sep in base:
base = base.split(sep, 1)[0]
break
groups.setdefault(base, []).append(col)

for base, cols in groups.items():
try:
sub = df[cols].dropna(how="all")
buf = io.StringIO()
sub.to_csv(buf, index=True)
buf.seek(0)
results[base] = buf
except Exception as e:
warnings.append(f"{base}: Failed to prepare CSV: {e}")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic does not belong here unfortunately. But we can fix it later.

@louispt1
Copy link
Author

@noracato I think with the new async approach this is an unnecessary change - it is 5 seconds slower than the async approach. If you agree I would close this PR and the Engine one as they are unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants