MMOON commited on
Commit
c022521
·
verified ·
1 Parent(s): 3ba051e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -161,7 +161,7 @@ class PesticideDataFetcher:
161
  # Correctly join the BASE_URL with the relative nextLink
162
  url = urllib.parse.urljoin(self.BASE_URL, next_link)
163
  params = None # IMPORTANT: Don't send params again!
164
- data = self.fetch_data(url) # Fetch the next page of data
165
  if not data:
166
  break # Exit loop if data fetch fail
167
  else:
@@ -247,7 +247,7 @@ class PesticideDataFetcher:
247
  if next_link:
248
  # Correctly join the BASE_URL with the relative nextLink
249
  url = urllib.parse.urljoin(self.BASE_URL, next_link)
250
- params = None # IMPORTANT: Don't send params again!
251
  else:
252
  url = None
253
  logger.info(f"Products retrieved so far: {products_loaded}")
@@ -568,9 +568,9 @@ class PesticideApp:
568
  )
569
 
570
  substance_results.select( # Use .select() for interactive selection
571
- fn=lambda evt: evt.data[0] if evt.data else None, # Extract ID
572
- inputs=substance_results,
573
- outputs=substance_select
574
  )
575
 
576
 
 
161
  # Correctly join the BASE_URL with the relative nextLink
162
  url = urllib.parse.urljoin(self.BASE_URL, next_link)
163
  params = None # IMPORTANT: Don't send params again!
164
+ data = self.fetch_data(url) # Fetch the next page of data. NO PARAMS.
165
  if not data:
166
  break # Exit loop if data fetch fail
167
  else:
 
247
  if next_link:
248
  # Correctly join the BASE_URL with the relative nextLink
249
  url = urllib.parse.urljoin(self.BASE_URL, next_link)
250
+ params = None # IMPORTANT: Don't send params again! The nextLink ALREADY contains them.
251
  else:
252
  url = None
253
  logger.info(f"Products retrieved so far: {products_loaded}")
 
568
  )
569
 
570
  substance_results.select( # Use .select() for interactive selection
571
+ fn=lambda evt, data=substance_results: data.iloc[evt.index[0]]['ID'] if evt.index else None,
572
+ inputs=[],
573
+ outputs=substance_select
574
  )
575
 
576