← Your Files (uploads & deliverables) · source: dunchau-report-engines-handoff/01-source-code/audit-engine/README.md

aeoauditscriptswebsiteyour-files

AEO Audit Engine — v1 modules built so far

The back end that turns a Free Audit form submission into Dun's AI Visibility Report, built to the specification in ../aeo-audit-engine-spec.md. This folder currently holds 2 of the spec's 9 v1 modules (build order §15): the website crawler (module 2) and the scoring engine (module 8), plus a worked sample. Everything else is listed honestly under "Not built yet" below.

Honesty rule (spec §16): every module reports only what it actually collected. Unmeasured items are labelled "Not measured" / "Not verified" — never estimated.


crawl.py — website technical checker (spec module 2, pipeline stage 3a)

Fetches a site and outputs JSON where every check is {"status": ..., "evidence": ...} — the evidence is what the fetch showed.

python3 crawl.py https://foaminggraphics.com
python3 crawl.py https://foaminggraphics.com --out result.json

What it checks, and which spec line items it fills:

Output key What it does Spec items filled
http Final status code after redirects, HTTPS yes/no, final URL §3.6 (website verified live), D3 (HTTPS half)
robots_txt Fetches /robots.txt, keeps the raw contents, and gives a per-bot verdict — blocked / allowed / not mentioned — for GPTBot, ClaudeBot, PerplexityBot and Google-Extended, each with the rule that decided it D1 (robots half)
bot_fetch_test Re-fetches the homepage under a GPTBot user-agent — a firewall can block what robots.txt allows D1 (fetch half)
sitemap Whether /sitemap.xml resolves to a real sitemap (redirects followed) D6
schema Parses every JSON-LD block on the homepage, lists each block's @types, and for the LocalBusiness node reports which of name / address / phone / hours / geo / areaServed are present vs missing D4, §6.2 head-to-head row "Structured data on website"
key_facts_text Whether a phone number and a street address appear as real text in the page (not only in images/scripts), with the matched text as evidence D7
service_pages Internal service-named pages discoverable from homepage/nav links — counted and listed (media files, upload paths and dated blog archives excluded; labelled candidates — the operator confirms them against the core service list before E2 is scored) E2 (evidence), §6.2 row "Separate page per service"
faq FAQ page/section presence E4 (evidence half)

Runs on the Python standard library alone; uses requests if installed. Timeouts and failed fetches are reported as evidence, never raised as crashes and never guessed around.

score.py — scoring engine (spec module 8, pipeline stage 4)

Reads a foundation checks file (areas A–F; every check has points earned/available, a status and a finding) plus a visibility value, and computes the report's derived numbers with the spec §1 model:

python3 score.py foaming-graphics-checks.json --visibility-index 0
python3 score.py checks.json --mention-rate 9 --leader-mention-rate 41

foaming-graphics-checks.json — worked sample

The Foaming Graphics free audit (2026-11-23, Mode E) in scoring format: the 25 checks actually performed, with the exact per-check points, statuses and findings published in that report's Section 8 (source data: ../audits/foaming-graphics-expanded-audit-data-2026-11-23.md). Running score.py on it with visibility 0 reproduces the published result — Foundation 31/100 (A 6/20, B 2/20, C 5/15, D 11/15, E 5/15, F 2/15), Overall 19, Invisible.

Note the spec's full model has 45 checks (§10); the free run honestly scored the 25 it performed. As the remaining modules land, the checks files grow to the full set — the cover's check count rises with them (spec §10.1 note).


Verified 2026-11-23

Not built yet (honest status)

Spec module Status
1. Job record + intake checklist (form → stored job) Not built. The FormSubmit alert email is still the only record of a lead.
3. Places API profile puller (rating, review count, categories, hours, newest review — business + 3 competitors) Not built. Needs a Google Places API key. Fills A2/A3/A5/A6/A11, B1/B2/B3, snapshot fields.
4. PageSpeed API hookup (mobile-friendly + speed) Not built. Completes D3, fills D5.
5. Yelp API lookup Not built. Fills B6 (half), C3, one NAP row.
6. Evidence-run worksheet (Mode E prompt/evidence grid, stored) Not built as code. The Foaming Graphics run was done by hand; the worksheet formalises it.
7. Listing-check worksheets (Bing, Apple, BBB, Facebook, directories) Not built. These stay human reads; the worksheets store what the operator enters.
9. Report renderer + delivery (.docx from the store, email to prospect) Not built. Reports are still produced through the document tools.
Phase 2: live prompt harness (Mode L — Perplexity API first) Not started. Until it exists, visibility is Mode E evidence-layer only and reports must say so.
Phase 3: review-history depth, 90-day re-test automation Not started. B4 (review pace) and the 90-day review count stay "Not measured" until then (spec §16 G1/G2).

Also not yet wired: crawl.py output does not yet feed score.py automatically — today the operator (Simon) reads the crawl JSON and writes the D/E-area checks into a checks file. Joining them is a small step once the Places puller exists, since several D/E checks also need profile data.