def extract(page) -> dict:
    # --- site_name, city, state ---
    # "Site: | Durham's Meatpacking | Chicago, Ill."
    # right(until='text') captures just the site name element; right() captures all remaining text
    site_label = page.find('text:bold:contains("Site:")')
    site_name = site_label.right(until='text').extract_text().strip()
    city_state = site_label.right().extract_text().strip()[len(site_name):].strip()
    city, state = [s.strip() for s in city_state.split(',', 1)]

    # --- inspection_date ---
    inspection_date = page.find('text:bold:contains("Date:")').right().extract_text().strip()

    # --- violation_count ---
    violation_count = int(
        page.find('text:bold:contains("Violation Count:")').right(until='text').extract_text().strip()
    )

    # --- summary ---
    # First line is to the right of the label; continuation flows below until the Violations header
    summary_label = page.find('text:bold:contains("Summary:")')
    first_line = summary_label.right().extract_text().strip()
    continuation = summary_label.below(
        until='text:bold:contains("Violations")',
        include_endpoint=False
    ).extract_text().strip()
    summary = f'{first_line} {continuation}'.strip() if continuation else first_line

    # --- violations table ---
    # detect_checkboxes() injects [CHECKED]/[UNCHECKED] markers into the Repeat? column
    page.detect_checkboxes()
    violations_header = page.find('text:bold:contains("Violations")')
    df = violations_header.below().extract_table().to_df(header='first')
    violations = (
        df.assign(Repeat=df['Repeat?'].str.contains(r'\[CHECKED\]', na=False))
          .drop(columns=['Repeat?'])
          [['Statute', 'Description', 'Level', 'Repeat']]
          .to_dict(orient='records')
    )

    return {
        'site_name': site_name,
        'city': city,
        'state': state,
        'inspection_date': inspection_date,
        'violation_count': violation_count,
        'summary': summary,
        'violations': violations,
    }
