aboutsummaryrefslogtreecommitdiff
path: root/scripts/common/__init__.py
blob: f06ee26a07c71a413961ab4af41e50dc19753e39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Shared infrastructure for the 990 data pipeline (v2).

This package provides the single authoritative implementation of
normalization, XML helpers, DB access, and ingest tracking for
all parsers under scripts/parse/, scripts/fetch/, and scripts/extract/.

Old parsers in scripts/ still use scripts/parse_common.py directly.
"""

import zipfile_deflate64  # noqa: F401

from scripts.common.db import (
    execute, execute_scalar, execute_all, execute_transaction, copy_rows,
    # Legacy (shell-based, for old parsers)
    psql, psql_scalar, psql_query_values, insert_rows,
)
from scripts.common.normalize import normalize_ein, parse_numeric, map_form_type, is_placeholder
from scripts.common.xml import (
    text, strip_ns, leaf_paths, extract_filing_metadata,
    derive_source_document_id,
)
from scripts.common.ingest import (
    start_ingest_run, finish_ingest_run, fail_ingest_run, log_ingest_error,
)
from scripts.common.filing import (
    upsert_raw_filing, record_raw_filing_source,
)