Arif commited on
Commit
d112890
Β·
2 Parent(s): 25a24b9 b9ed695

Merge branch 'backend' into mvp

Browse files
Files changed (1) hide show
  1. backend/app/api/v1/router.py +9 -4
backend/app/api/v1/router.py CHANGED
@@ -128,20 +128,24 @@ async def analyze_data(request: AnalysisRequest):
128
 
129
  logger.info(f"πŸ“Š Analysis: {request.analysis_type} on {len(request.data)} rows")
130
 
131
- # βœ… KEY FIX 1: Add await - analyzer.analyze() is async
132
  results = await analyzer.analyze(
133
  request.data,
134
  request.analysis_type,
135
  request.columns
136
  )
137
 
138
- # βœ… KEY FIX 2: Remove this line - generate_summary() doesn't exist
139
- # Don't call: summary = analyzer.generate_summary(results)
 
 
 
140
 
141
- # βœ… KEY FIX 3: Return without summary field
142
  return AnalysisResponse(
143
  analysis_type=request.analysis_type,
144
  results=results,
 
 
145
  timestamp=datetime.now()
146
  )
147
  except ValueError as e:
@@ -153,6 +157,7 @@ async def analyze_data(request: AnalysisRequest):
153
 
154
 
155
 
 
156
  # ============ ML Suggestions Endpoint ============
157
 
158
  @router.post("/suggestions", response_model=SuggestionsResponse)
 
128
 
129
  logger.info(f"πŸ“Š Analysis: {request.analysis_type} on {len(request.data)} rows")
130
 
131
+ # Call analyzer with await
132
  results = await analyzer.analyze(
133
  request.data,
134
  request.analysis_type,
135
  request.columns
136
  )
137
 
138
+ summary = f"Analysis complete: {request.analysis_type} on {len(request.data)} rows"
139
+
140
+ import pandas as pd
141
+ df = pd.DataFrame(request.data)
142
+ data_shape = df.shape
143
 
 
144
  return AnalysisResponse(
145
  analysis_type=request.analysis_type,
146
  results=results,
147
+ summary=summary,
148
+ data_shape=data_shape,
149
  timestamp=datetime.now()
150
  )
151
  except ValueError as e:
 
157
 
158
 
159
 
160
+
161
  # ============ ML Suggestions Endpoint ============
162
 
163
  @router.post("/suggestions", response_model=SuggestionsResponse)