All consume the machineid->assetid crosswalk from the assets hub. Verified against the scratch target, zero endpoint errors: - communications: 435 primary IPs folded onto assets. No bulk endpoint exists, so this is the plan's documented direct-ORM gap (reads the source communications table where comstypeid=1 AND isprimary=1, not machines.ipaddress1 which is empty). - applications: supportteams 45, applications 121 (colliding names dedup via the unique-appname 409-resolve), appversions 47, installs 653 (machineid -> assetid -> computerid; only computer assets take installs). - warranties: 424 linked, vendor hardcoded Dell (source has none). - notifications: types 6, notifications 261 (2099 sentinel endtime clamped). - knowledgebase: 341 (appid resolved through the applications name map). Inactive rows skipped everywhere per the decisions. Remaining loader stages: locations (the 158 LocationOnly rows), relationships (301 active edges), subnets/VLANs, usb (cmmc pairing), verify. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
WJ classic-ASP import loader (reference implementation)
This is site-specific reference glue, not product code. It maps West
Jefferson's classic-ASP shopdb / cmmc_usb / wjf_employees schema onto the
maintained, schema-agnostic import contract in docs/IMPORT-API.md.
Every adopting site has its own source database. Nobody else runs this loader. Instead, copy the pattern:
- Point the harness at your source DB(s) (edit
harness.Source). - Write per-entity stages that read your tables and POST to the same
docs/IMPORT-API.mdendpoints withAuthorization: Bearer <admin PAT>andX-Import-Mode: true. - Persist legacy-id -> new-id crosswalks (see
harness.IdMap) so later stages resolve foreign keys and a crashed run resumes.
The import API is the stable contract; loaders are per-site. The mapping itself can be produced with the agent-assisted workflow (point Fable/Opus agents at a source DB + this contract -> they emit the mapping + a loader skeleton).
Running (against a THROWAWAY import database)
DATABASE_URL='mysql+pymysql://root:PW@127.0.0.1:3306/shopdb_flask_import?charset=utf8mb4' \
venv/bin/python -m scripts.site_imports.wjf.run --stages reference,employees
Prereqs: a fresh target DB built with flask db upgrade + flask plugin upgrade-all + flask seed permissions/settings/reference-data, and the three
source dumps loaded into scratch DBs (shopdb_src, cmmc_usb_src,
wjf_employees_src). See scratchpad/IMPORT-PLAN.md for the full mapping,
resolved decisions, and remaining stages.
Status
- Implemented + verified idempotent:
reference(vendors, businessunits, operatingsystems),employees(directory bulk upsert; photos deferred). - TODO stages:
models,applications,assets(the hub - fan machines out by type, persist the machineid->assetid crosswalk),dependents(installs, warranties, notifications, KB),network(+ subnets/VLANs),usb(cmmc device + checkinout pairing),verify.
The harness (PAT auth, import-mode, id-map persistence, endpoint error capture)
is proven; the remaining stages are additional stage_* functions in run.py
following the same shape.