5.8 KiB
1C OData MVP Bridge
Read-only MVP bridge between 1C and AI assistant workflows:
- OData probe (
odata_probe/) - Canonical model and mappers (
canonical_layer/) - FastAPI layer (
canonical_layer/app.py) - Draft MCP configuration (
mcp/)
Quick start
cd X:\1C\NDC_1C
$Conda = Join-Path $env:USERPROFILE "miniconda3\Scripts\conda.exe"
if (-not (Test-Path $Conda)) { $Conda = Join-Path $env:USERPROFILE "Miniconda3\Scripts\conda.exe" }
& $Conda create -y -n ndc_1c_mvp python=3.11
$EnvPython = Join-Path $env:USERPROFILE "miniconda3\envs\ndc_1c_mvp\python.exe"
if (-not (Test-Path $EnvPython)) { $EnvPython = Join-Path $env:USERPROFILE "Miniconda3\envs\ndc_1c_mvp\python.exe" }
& $EnvPython -m pip install -r requirements.txt
copy .env.example .env
Run probe:
& $EnvPython -m odata_probe.fetch_metadata
& $EnvPython -m odata_probe.list_entity_sets
& $EnvPython -m odata_probe.probe_entities
& $EnvPython -m odata_probe.dump_sample_links
& $EnvPython scripts/deep_probe_subconto_join.py
& $EnvPython scripts/deep_probe_subconto.py
& $EnvPython scripts/recon_slot3_gap.py
& $EnvPython scripts/deep_probe_accounting_mvp_gate.py
& $EnvPython scripts/check_deeper_access_readiness.py
deep_probe_subconto_join.py is the regression check for the critical join:
Document lines (Ref_Key + LineNumber) <-> Accounting register (Recorder + LineNumber).
deep_probe_accounting_mvp_gate.py runs 3 hard MVP checks and writes a pass/fail verdict.
recon_slot3_gap.py focuses on slot 3 evidence quality and writes logs/slot3_recon_report.json.
check_deeper_access_readiness.py writes logs/deeper_access_readiness.json with one snapshot of gate/slot3/tool-artifact readiness.
scripts/run_probe.ps1 fails intentionally when the MVP gate verdict is not sufficient.
Run FoxyLink endpoint smoke probe:
& $EnvPython scripts/foxylink_probe_endpoint.py
& $EnvPython scripts/foxylink_probe_endpoint.py --strict
or:
powershell -ExecutionPolicy Bypass -File .\scripts\run_foxylink_probe.ps1
foxylink_probe_endpoint.py writes logs/foxylink_probe_report.json with URL,
status, classification (reachable, auth_failed, endpoint_not_found_or_not_published, etc.),
and response preview.
One-command run:
powershell -ExecutionPolicy Bypass -File .\scripts\run_probe.ps1
Run API:
& $EnvPython -m uvicorn canonical_layer.app:app --reload --host 127.0.0.1 --port 8000
Run canonical refresh (Layer 3 + Layer 4 MVP):
& $EnvPython scripts/run_refresh.py --mode historical --limit-per-set 200
& $EnvPython scripts/run_refresh.py --mode incremental --from-date 2026-01-01T00:00:00 --limit-per-set 200
& $EnvPython scripts/run_refresh.py --mode targeted --target-id 68.02 --limit-per-set 200
or one-command PowerShell wrapper:
powershell -ExecutionPolicy Bypass -File .\scripts\run_refresh.ps1 -Mode incremental -FromDate 2026-01-01T00:00:00
Refresh summary is written to logs/refresh_last_run.json.
Canonical store defaults to local sqlite:
CANONICAL_DB_URL=sqlite:///X:/1C/NDC_1C/data/canonical_store.db
and can be switched to PostgreSQL with a standard SQLAlchemy URL.
Run feature/anomaly engine (Layer 5 MVP):
& $EnvPython scripts/run_features.py --top-account-tokens 20
& $EnvPython scripts/run_features.py --strict
PowerShell wrapper:
powershell -ExecutionPolicy Bypass -File .\scripts\run_features.ps1 -Strict
Feature summary is written to logs/features_last_run.json.
API endpoints for the new layer:
POST /features/runGET /features/statsGET /features/runsGET /features/metricsGET /features/anomalies
Run risk engine (Layer 6 MVP):
& $EnvPython scripts/run_risk.py --strict
PowerShell wrapper:
powershell -ExecutionPolicy Bypass -File .\scripts\run_risk.ps1 -Strict
Risk summary is written to logs/risk_last_run.json.
API endpoints:
POST /risk/runGET /risk/statsGET /risk/runsGET /risk/patterns
Find busiest pre-reporting period and export dense snapshot (for example for 2020):
& $EnvPython scripts/run_pre_report_snapshot.py --year 2020 --strict
PowerShell wrapper:
powershell -ExecutionPolicy Bypass -File .\scripts\run_pre_report_snapshot.ps1 -Year 2020 -Strict
Default scan range:
- start:
2020-01-01T00:00:00Z - end (reporting deadline):
2021-03-31T23:59:59Z
Outputs:
- activity profile:
logs/pre_report_activity_2020.json - selected-period snapshot:
logs/pre_report_snapshot_2020_<window>.json
Run semantic mapper v2 remap on an existing snapshot and compare before/after:
& $EnvPython scripts/remap_snapshot_semantic_v2.py
Outputs:
- remapped snapshot:
logs/pre_report_snapshot_2020_2020-06_semantic_v2.json - metrics delta:
logs/pre_report_snapshot_2020_2020-06_semantic_v2_metrics.json
Run validation on remapped snapshot:
& $EnvPython scripts/run_validation_accounting_analytics.py --snapshot-path logs/pre_report_snapshot_2020_2020-06_semantic_v2.json --output-dir docs/ARCH/validation_run_2026-03-23_semantic_v2 --strict
Refresh 2020 export package (ontology, rules, focused samples):
& $EnvPython scripts/export_arch_2020_package.py
Output directory:
docs/ARCH/2020экспорт
Run router/orchestration fix benchmark profile:
& $EnvPython scripts/run_validation_accounting_analytics.py --snapshot-path logs/pre_report_snapshot_2020_2020-06_semantic_v2.json --output-dir docs/ARCH/validation_run_2026-03-23_router_fix --strict
Router fix report:
docs/ARCH/router_orchestration_fix_report_2026-03-23.md
Important
This project is designed for read-only 1C access. Write operations in OData must remain disabled by 1C roles and by integration policy.