SuffolkLITLab / docassemble-AssemblyLine

Quickly go from a paper court form to a runnable, guided, step-by-step web application powered by Docassemble. Swap out branding and pre-built questions to meet your needs.
https://suffolklitlab.org/docassemble-AssemblyLine-documentation/
MIT License
41 stars 5 forks source link

Add a way to filter the court by two matching columns with different search values #839

Open nonprofittechy opened 5 months ago

nonprofittechy commented 5 months ago

Here's a potential example for Vermont:

---
code: |
  df = all_courts._load_courts()

  trial_court_index_tmp = df[(df['division_abbr'] == trial_court_division_abbr) & (df['address_county'] == trial_court_county) ].index

  if len(trial_court_index_tmp) == 0:
    log(f"Trial court not found: {trial_court_division_abbr} {trial_court_county}", "error")
    trial_court_index = None
  elif len(trial_court_index_tmp) > 1:
    log(f"Multiple trial courts found: {trial_court_division_abbr} {trial_court_county}", "error")
    trial_court_index = None
  else:
    trial_court_index = trial_court_index_tmp[0]

  del df

The idea is to let people, e.g., say the name of the county and the name of the division. In many/most cases, that should lead to a unique matching court.