debug outputs

This commit is contained in:
lelo 2025-06-18 13:02:36 +02:00
parent 2b8d7c9865
commit 4b5f6ab85b
4 changed files with 9 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
app/__pycache__/
app/.flask_session/
.flask_session/
venv/
.env

View File

@ -27,7 +27,7 @@ def get_dataframe(key):
return df
def get_merged_df(table_name):
def get_merged_df(table_name): # return table_name: str
"""
Return a DataFrame for the given table_name based on Stripe and Raisenow inputs,
enforcing strict one-to-one matching with:
@ -36,7 +36,7 @@ def get_merged_df(table_name):
- no pandas merge suffixes at all
- all original columns (including Raisenow's norm_zweck) preserved
"""
print('calculated DataFrame')
# --- load & normalize Stripe ---
stripe_import = get_dataframe('stripe_import')
@ -311,10 +311,12 @@ def upload():
return jsonify({'error': 'No files uploaded'}), 400
for f in files:
print('uploading file:', f.filename)
raw = (
pd.read_csv(f) if f.filename.lower().endswith('.csv') else pd.read_excel(f)
)
raw = raw.dropna(how='all').dropna(axis=1, how='all')
print('number of rows:', len(raw))
raw = raw.astype(object).replace({np.nan: None})
cols = list(raw.columns)
if cols[:len(STRIPE_STARTING_COLS)] == STRIPE_STARTING_COLS:
@ -339,9 +341,9 @@ def upload():
@app.route('/get_table')
def get_table():
table = request.args.get('table')
print('get_table:', table)
df = get_merged_df(table)
print('number of rows:', len(df))
df = df.astype(object).where(pd.notnull(df), None)
return jsonify({
'columns': list(df.columns),

View File

@ -45,7 +45,7 @@
<label for="table-select" class="form-label me-2 mb-0">Table:</label>
<select id="table-select" class="form-select form-select-sm">
<option value="stripe_import">Stripe Import</option>
<option value="raiseNow_import">RaiseNow Import</option>
<option value="raisenow_import">RaiseNow Import</option>
<option value="merged">Merged</option>
<option value="stripe_only">Stripe Only</option>
<option value="raisenow_only">RaiseNow Only</option>