Python scripts that sync construction measurement orders (施工计量单) from a MySQL database to an external archive system. The pipeline: fetch from MySQL → cache in SQLite → generate EEP packages (DA/T 48-2009 standard) → upload to external API.
No formal test/lint/build framework exists. Run scripts directly:
# Full pipeline: fetch → cache → generate EEP → upload
python sync_measure_data.py
# Debug: check database schema
python check_schema.py
# Debug: check BQ (变清单) table for a specific order
python check_bq.py
# Debug: check attachment file IDs for a specific order
python debug_db_files.py
sync_measure_data.py — main pipeline (MySQL → SQLite → EEP → API upload)check_schema.py — inspects MySQL table schemas (mp_measure_order, mp_construction_measure_others, mp_contract)check_bq.py — inspects mp_construction_measure_bq tabledebug_db_files.py — inspects attachment records in mp_measure_attachments and tb_filedangan/ — sample/reference archive XML outputseep_packages/ — generated EEP output directorymeasure_data_cache.db — local SQLite cache (auto-created)mp_measure_order — main measure orders (status: 2=审计完成, 4=also completed)mp_construction_measure_others — other payment items (价格调整, 扣回材料设备预付款, etc.)mp_contract — contract info (section_id, employer, contractor_dept, jl_section)mp_measure_attachments — attachment linksmp_construction_measure_bq — BQ (变清单) itemstb_file — file storage (path = download URL)blade_user — user info (real_name)mysql.connector — MySQL accessrequests — HTTP uploadssqlite3, json, hashlib, zipfile, base64 — stdlibNo requirements.txt or pyproject.toml. Install manually: pip install mysql-connector-python requests
FILE_BASE_URL = "https://oss.dnnbuild.com" for relative pathsmeasure_data_cache.db) persists across runs; new orders only (skips existing){order_id}/说明文件.xml, {order_id}/文件目录.xml, {year}/{order_id}/文件元数据.xmlDB_CONFIG dictsync_measure_data.py has a LIMIT 1000 on the MySQL query for testing — remove for productiondebug_db_files.py has a hardcoded TARGET_ID — change it before runningeep_packages/ directory is created at runtime; dangan/ is reference data