AFL

Page scan data

Reference: the scan commands, the tables and views they fill, and the values each column can take.

How to run the scan is in Scan the live sites for widgets. How matches are made is in How the page scan works.

Commands

Run from apps/migration-tracker. Sites are the ids in data/sites.json; afl is matched against aflm-web and every other site against aflc-web.

CommandReadsWritesDatabase
fetch-pages <site...> [--type t] [--limit n] [--refetch]page itemsdata/html/<site>/read
build-crosswalk [parent-folder/]the two legacy reposdata/crosswalk.jsonnone
parse-pages <site...> [--limit n]data/html, data/crosswalk.jsondata/parsed/<site>.jsonlnone
import-scans <site...> [--keep]data/parsed, data/html manifests, data/crosswalk.jsonthe scan tableswrite
import-widget-mapping [--create-items] [csv]the mapping CSVlegacy_template_mappings, itemswrite

Tables

legacy_widgets: one row per legacy widget folder.

ColumnMeaning
idaflm:<folder> or aflc:<folder>
siteaflm or aflc
folderthe widget folder, or a React path for shared components
display_name, tech_era, api_dependency, data_patternfrom legacy_folders; aflm only
templatesthe folder's template files
has_scriptwhether the folder has JavaScript

page_fetches: the latest fetch per page item (item_id, fetched_at, status, final_url, bytes, sha1, content_type, error).

scan_runs: one per site import (id, site, crosswalk with the legacy commits, pages, started_at, finished_at). Views read only runs with finished_at set.

page_scans: one per page per run.

ColumnMeaning
item_id, run_id, scanned_at, html_sha1which page, which run
signalsJSON: title, canonical, ogType, bodyClass, mainClass, mainChildClass, articleVariants, templateEvidence, templateAlternatives
template_guess, template_confidence, template_methodthe template guess; confidence high, medium, low; method markup, url-path, shell-default
instance_count, widget_count, anchor_count, hash_linkstotals and the page's own # links

page_widgets: one per marker or React mount, in document order (scan_id, ord).

ColumnValues
sourcedata-widget, react
kindwidget, react, generic, shared, unresolved
confidencehigh, medium, low, or null
methoddeclared, react-class, js-handler, folder-name
legacy_widget_id, filethe matched widget and template (file is null when ambiguous)
regionheader, main, sidebar, footer, unknown
parent_ord, element_id, anchorthe enclosing widget, the element id, the anchor id
data_script, component_name, data_title, data_templateattributes on the element
evidence, candidatesJSON: why it matched, and the other templates still possible

page_anchors: scan_id, anchor_id, widget_ord (null when attached to no widget).

legacy_template_mappings: one per legacy template, keyed by legacy_path and legacy_name.

ColumnValues
legacy_widget_id, templatethe widget and the template path inside its folder
target_widgetthe widget it becomes, or null
dispositionmerge, own, defer, drop, out-of-family
wave, notesfree text
statusproposed, accepted, provisional, migrated
item_idthe item for the target widget
template_item_idan existing item already tracking exactly this template

Views

ViewGives
latest_page_scansthe newest finished scan per page
page_widget_usagereal widgets on pages from the latest scans
legacy_widget_usagepages and instances per legacy widget
legacy_widget_summaryeach legacy widget with its mapping, Pulse usage and scanned usage
item_page_usagethe pages an item's legacy widgets appear on, exact or possible
legacy_widget_page_usage, legacy_widget_site_usage, legacy_widget_type_usage, legacy_widget_file_usageone widget's usage by page, site, page type and template
scan_site_coveragepages and scanned pages per site

An item_page_usage match is exact when the page's template file equals the mapped template, and possible when the template is unknown or sits in a partial shared by the folder's templates.