[Python] Issue with Python Script - Pulling date from PDF "Inactive"

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    # Handle Inactive Summary header
    elif detected_header == "Inactive Summary by Asset Category and Acquisition Year with Factors" and numeric_parts:
    reported_cost = float(numeric_parts[0])
    rendered_value = None # Rendered Value might not exist for inactive summaries

    # Extract year from the text if not already found
    if assessment_date is None:
    year_match = re.search(r'\b(19\d{2}|20\d{2})\b', normalized_text)
    if year_match:
    assessment_date = year_match.group(1)
    logging.info(f"Extracted assessment date: {assessment_date}")

    # Add data row
    if reported_cost is not None:
    entry = {
    "Source": detected_header,
    "Assessor Account Number": assessor_account_number,
    "Assessment Date": assessment_date,
    "State Class": current_state_class,
    "Year": year,
    "Reported Cost": reported_cost,
    "Rendered Value": rendered_value
    }
    target_headers[detected_header].append(entry)
    logging.info("Data extraction completed successfully.")
    except Exception as e:
    logging.error(f"Error extracting data from PDF: {e}")
    return {}

    return target_headers


    Please note that it pulls fine from Summary by Asset Category and Acquisition Year with Factors, but not from Inactive Summary by Asset Category and Acquisition Year with Factors The table is different on both pages as Summary headers are State Class Year Reported Cost Current Value Factor Current Value Assessment Rate Rendered Value Assessor's Use and inactive are State Class Year Reported Cost Assessment Rate Assessor's Use

    The script will pull in the total from Inactive but not the date. I need to know what I can try to get it to pull in date.

    Continue reading...

Compartilhe esta Página