GovGraph (GOV.UK Knowledge Graph)
The GOV.UK Knowledge Graph, also known as GovGraph, is a collection of BigQuery tables containing information about GOV.UK content.
The tables can be used for analytical work such as:
- finding current GOV.UK content
- analysing content by document type, publishing application or language
- examining relationships between content items
- identifying redirects, withdrawn content and content that is no longer available
- examining previous editions of content
Source of the data
Most GovGraph content data comes from the GOV.UK Publishing API. The Publishing API represents content using three related concepts:
- a content item is a piece of GOV.UK content and has a
content_id - a document is a content item in a particular locale
- an edition is a version of a document
A content item can therefore have more than one document, for example an English document and a Welsh document. A document can have multiple editions recording how it has changed over time.
Some GovGraph tables contain data copied from source systems. Others are derived tables designed to make common analytical tasks easier.
Read how to query the Knowledge Graph for more information about the data model.
Access
Access to the BigQuery dataset is limited to GDS staff.
For access, contact the #data-engineering community.
Location
The data is located in BigQuery in the govuk-knowledge-graph project.
Tables use fully qualified names in this format:
govuk-knowledge-graph.dataset_name.table_name
For example: govuk-knowledge-graph.public.publishing_api_editions_current
Choose a table
Different GovGraph tables represent GOV.UK content at different levels.
| Table | What it contains | Suitable for |
|---|---|---|
search.page |
An analysis-ready view of GOV.UK pages used by GovSearch | Most analysis requiring one row per searchable GOV.UK page |
public.publishing_api_editions_current |
The current non-draft, publicly available edition of each document | Current Publishing API content and lower-level content metadata |
publishing_api.editions |
Editions held in the Publishing API source data | Content history and previous versions |
public.publishing_api_links_current |
Relationships involving current editions | Relationships between content items, including publishing organisations and taxonomy |
public.publishing_api_unpublishings_current |
Relevant unpublishing records for current content | Redirect, gone and withdrawal analysis |
public.organisations |
Current English-language GOV.UK organisation records, including organisation attributes and hierarchy and succession relationships | Organisation type, status, acronym, and relationships between organisations |
publisher.editions |
Current and historical edition records from the GOV.UK Mainstream Publisher application | Analysing Publisher content versions, editorial workflow states, assignments and audit information |
publisher.actions |
Workflow actions and requests associated with Mainstream Publisher editions | Analysing Publisher review, fact-checking, assignment, approval, scheduling and publishing activity |
This list is not exhaustive.
Read how to use the Knowledge Graph data for more information on how to use the tables.
Important concepts
A document is not always a web page
A GovGraph document may:
- represent content that has its own GOV.UK URL
- be embedded in another item of content
- contain several chapters or parts displayed at different URLs
- represent a translation of a content item
This means that a row in a GovGraph table does not always correspond to one URL displayed in a browser.
Current and historical data
Tables whose names end in _current are intended to represent the current state of relevant content.
Use the source tables in the publishing_api dataset if you need previous editions or want to analyse how content has changed over time.
JSON data
Some tables contain a details field. This is a JSON object whose structure varies according to the content schema.
Querying large JSON fields can use more BigQuery processing than selecting standard columns. Select only the fields required for your analysis.
Set-up
The GovGraph Google Cloud Projects also include infrastructure for the GovSearch app, which uses data from GovGraph.
Read the documentation in the GitHub repository.
Table schemas
Tables
The schemas of some of the more heavily used Knowledge Graph tables are detailed below.
search.page
The govuk-knowledge-graph.search.page table includes everything that is in GovSearch.
In this table, different sections or chapters of a content item are kept as separate ‘pages’, instead of being grouped as content items under the contentId.
‘Gone’ and ‘redirect’ pages are excluded from this table.
| field name | mode | type | description | notes |
|---|---|---|---|---|
| url | NULLABLE | STRING | URL of a page | Includes hostname and protocol, e.g. https://www.gov.uk/government/publications/low-pay-commission-research-2024 |
| documentType | REQUIRED | STRING | The kind of thing that a page is about | |
| contentId | REQUIRED | STRING | The ID of the content item of a page | Multiple URLs can have the same contentId |
| locale | REQUIRED | STRING | The ISO 639-1 two-letter code of the language of an edition on GOV.UK | |
| publishing_app | REQUIRED | STRING | The application that published a content item on GOV.UK | |
| first_published_at | NULLABLE | TIMESTAMP | The date that a page was first published. Automatically determined by the publishing-api, unless overridden by the publishing application. | |
| public_updated_at | NULLABLE | TIMESTAMP | When a page was last significantly changed (a major update). Shown to users. Automatically determined by the publishing-api, unless overridden by the publishing application. | |
| publisher_updated_at | NULLABLE | TIMESTAMP | When a page was last changed in the Publisher app. More meaningful than ‘updated_at’ in the Publishing API and Content API, which is polluted by editions that are created for techy reasons rather than editing reasons, and editors of mainstream pages tend not to use ‘public_updated_at’. | |
| withdrawn_at | NULLABLE | TIMESTAMP | The date the page was withdrawn. | |
| withdrawn_explanation | NULLABLE | STRING | The explanation for withdrawing a page | |
| page_views | NULLABLE | INTEGER | Number of page views from GA4 over 7 recent days | |
| title | NULLABLE | STRING | The title of a page | |
| description | NULLABLE | STRING | Description of a page | |
| text | NULLABLE | STRING | The content of the page as plain text extracted from the HTML | Null for certain document types, such as contact pages, due to the way the content is generated |
| taxons | REPEATED | STRING | Array of titles of taxons that the page is tagged to, and their ancestors | |
| primary_organisation | NULLABLE | STRING | Title of the primary organisation that published the page | |
| organisations | REPEATED | STRING | Array of titles of organisations that published the page | |
| people | REPEATED | STRING | Array of names of people who are associated with the page | |
| organisations_ancestry | REPEATED | STRING | Array of titles of organisations (and any parent organisations) that published the page | |
| hyperlinks | REPEATED | RECORD | Array of hyperlinks from the body of the page | |
| phone_numbers | REPEATED | STRING | Array of phone numbers from the body and metadata of the page | |
| is_political | NULLABLE | BOOLEAN | Indicator of whether the page is political. Pages where this is true, and that were published by a previous government, are displayed in ‘history mode’ with a prominent message drawing attention to the fact. | |
| government | NULLABLE | STRING | Title of the government that published the page, if the page is political. | |
| hyperlinks.link_url | STRING | Link URL | ||
| hyperlinks.link_type | STRING | Type of link |
public.publishing_api_editions_current
This table contains the most recent non-draft edition of each document that is publicly available through the GOV.UK website and in the Content API. It is derived primarily from publishing_api.editions and is enriched with:
content_idandlocalefrompublishing_api.documentsunpublishing_typefrompublishing_api.unpublishings
Some fields are removed or modified for redirect and gone items.
| Field name | Type | Mode | Description |
|---|---|---|---|
| content_id | STRING | NULLABLE | The unique identifier of the content item. A content item may have one document for each locale, with each document having one or more editions. |
| locale | STRING | NULLABLE | The locale of the document, such as ‘en’ for English or ‘cy’ for Welsh. Together, content_id and locale identify a document. |
| id | INTEGER | NULLABLE | The internal identifier assigned to this edition by the Publishing API. |
| title | STRING | NULLABLE | The title of the content item. Set to NULL for ‘redirect’ and ‘gone’ items in this table. |
| public_updated_at | TIMESTAMP | NULLABLE | Date and time when the content item was last significantly changed by a major update. It is automatically determined by the Publishing API unless overridden by the publishing application. |
| publishing_app | STRING | NULLABLE | The publishing application that supplied the content item to the Publishing API, recorded as the application’s hostname. |
| rendering_app | STRING | NULLABLE | The hostname of the frontend application that renders the content item. Set to NULL for ‘redirect’ and ‘gone’ items in this table. |
| update_type | STRING | NULLABLE | Classification of the update to the edition. Accepted Publishing API values are ‘major’, ‘minor’ and ‘republish’. A major update changes public_updated_at when the edition is published and may include a change note. A republish may result from technical or bulk processing rather than an editorial change to the content. |
| phase | STRING | NULLABLE | The phase assigned to the edition. Accepted Publishing API values are alpha, beta and live. |
| analytics_identifier | STRING | NULLABLE | Identifier used to track the content item in analytics software. Set to NULL for ‘redirect’ and ‘gone’ items in this table |
| updated_at | TIMESTAMP | NULLABLE | Date and time when this edition was last updated in the Publishing API data. This field is used to select the most recent edition for each document. An update may reflect technical processing or republishing rather than an editorial change. |
| document_type | STRING | NULLABLE | The type of content represented by this edition, used to distinguish content that may share the same schema. If the ‘unpublishing_type’ field is ‘redirect’ or ‘gone’, the value will be replaced by the unpublishing type. |
| schema_name | STRING | NULLABLE | Name of the content schema e.g. ‘publication’, ‘news_article’, ‘speech’. If the ‘unpublishing_type’ field is ‘redirect’ or ‘gone’, the value will be replaced by the unpublishing type. |
| first_published_at | TIMESTAMP | NULLABLE | Date and time recorded as the first publication of the content item. It is automatically determined by the Publishing API unless a value is supplied by the publishing application. Set to NULL for ‘redirect’ and ‘gone’ items in this table. |
| base_path | STRING | NULLABLE | The path used by the content item on GOV.UK, excluding the hostname, protocol and query string. |
| document_id | INTEGER | NULLABLE | The internal identifier assigned by the Publishing API to the document to which this edition belongs. Multiple editions of the same document share the same document_id. |
| description | STRING | NULLABLE | A description of the content item. Set to NULL for ‘redirect’ and ‘gone’ items in this table. |
| published_at | TIMESTAMP | NULLABLE | Date and time associated with the publication of this edition. This is an edition-level timestamp and may differ from first_published_at, public_updated_at and updated_at. |
| details | JSON | NULLABLE | JSON object containing data specific to the content item’s document_type. Its structure varies according to the applicable content schema. Set to NULL for ‘redirect’ and ‘gone’ items in this table. |
| routes | JSON | NULLABLE | Paths and route types used to make the content item available through GOV.UK. |
| redirects | JSON | NULLABLE | Redirect destination information associated with an unpublished content item. |
| unpublishing_type | STRING | NULLABLE | Type of unpublishing action associated with the edition, such as ‘withdrawal’, ‘redirect’ or ‘gone’. A NULL value indicates that no matching unpublishing record was found. |
public.organisations
This table contains one row for each current English-language GOV.UK organisation edition. It includes selected organisation attributes and arrays representing hierarchy and succession relationships between organisations. The parents and immediate_successors fields contain directly linked organisations, while ancestors and all_successors contain relationships across the wider hierarchy or succession chain.
| Field name | Type | Mode | Description |
|---|---|---|---|
| edition_id | INTEGER | REQUIRED | The identifier assigned by the Publishing API to the current English-language edition representing the organisation. |
| acronym | STRING | NULLABLE | The organisation’s acronym, if it has one. |
| brand | STRING | NULLABLE | The organisation’s brand class name, which is mapped to a colour in the GOV.UK frontend. |
| organisation_type | STRING | REQUIRED | The type assigned to the organisation in the Publishing API, for example executive_ndpb, ministerial_department or devolved_administration. |
| foi_exempt | BOOLEAN | REQUIRED | Indicates whether the organisation is exempt from Freedom of Information requests. |
| organisation_status | STRING | REQUIRED | The organisation’s status on GOV.UK. Permitted values include changed_name, merged and no_longer_exists. |
| organisation_status_updated_at | TIMESTAMP | NULLABLE | The date and time associated with an update to the organisation’s GOV.UK status, where recorded. |
| organisation_status_url | STRING | NULLABLE | A URL associated with the organisation’s GOV.UK status, where recorded. |
| parents | INTEGER | REPEATED | The edition IDs of organisations recorded directly above this organisation in the GOV.UK organisation hierarchy. |
| immediate_successors | INTEGER | REPEATED | The edition IDs of organisations recorded as directly succeeding this organisation. |
| ancestors | INTEGER | REPEATED | The edition IDs of organisations recorded at any level above this organisation in the GOV.UK organisation hierarchy. The array also includes this organisation’s own edition_id. |
| all_successors | INTEGER | REPEATED | The edition IDs of organisations in the recorded succession chain for this organisation, including direct and later successors. The array also includes this organisation’s own edition_id. |
publisher.editions
This table contains current and historical edition records from the GOV.UK Mainstream Publisher application. Each row represents a version of content created or managed in Publisher and includes common content, workflow, assignment and audit information. Earlier editions are retained, with most records in the table having an archived workflow state.
| field name | mode | type | description | notes |
|---|---|---|---|---|
| id | REQUIRED | STRING | The UUID identifying the Publisher edition record in the PostgreSQL database. | |
| panopticon_id | NULLABLE | STRING | The legacy Panopticon identifier that groups Publisher editions belonging to the same underlying GOV.UK content. | Multiple editions of the same content can share a panopticon_id. |
| version_number | REQUIRED | INTEGER | The sequential version number of the edition within the same underlying Publisher content. | |
| sibling_in_progress | NULLABLE | INTEGER | The version number of another edition of the same underlying Publisher content that was recorded as being in progress. | The value is stored on a published or archived edition and can remain after the sibling stops being in progress or disappears from the table. |
| title | NULLABLE | STRING | The title recorded for the Publisher edition. | |
| in_beta | REQUIRED | BOOLEAN | Indicates whether the edition is marked as beta in Publisher. | |
| publish_at | NULLABLE | TIMESTAMP | The date and time at which the edition is scheduled to be published. | The value may be retained after the edition moves to another workflow state. |
| overview | NULLABLE | STRING | The summary or overview text recorded for the edition. | |
| slug | NULLABLE | STRING | The slug recorded for the content in Publisher, used as the human-readable part of its GOV.UK path. | |
| rejected_count | REQUIRED | INTEGER | The number of times the edition has been rejected or returned for amendments during the Publisher editorial workflow. | A value greater than zero can remain after the edition progresses to a later workflow state. |
| asignee | NULLABLE | STRING | The name of the Publisher user who was assigned to the edition. | The field name is spelled asignee in the source table. |
| reviewer | NULLABLE | STRING | Legacy or unused reviewer field. | No populated values were found in the table. |
| creator | NULLABLE | STRING | The name of the Publisher user who created the edition. | |
| publisher | NULLABLE | STRING | The name of the Publisher user who published the edition, where recorded. | |
| archiver | NULLABLE | STRING | The name of the Publisher user who archived the edition, where recorded. | |
| major_change | REQUIRED | BOOLEAN | Indicates whether the edition is marked as a major change. | |
| change_note | NULLABLE | STRING | The note describing the change made in this edition, where provided. | A major change should always be accompanied by a change note. |
| state | REQUIRED | STRING | The editorial workflow state of the Publisher edition. | Observed values are draft, fact_check, in_review, amends_needed, ready, scheduled_for_publishing, published and archived. |
| review_requested_at | NULLABLE | TIMESTAMP | The date and time when review or fact checking was requested for the edition, where recorded. | The value can remain populated after the edition has progressed to a later workflow state. |
| auth_bypass_id | REQUIRED | STRING | A unique identifier for the edition that can be used to allow access to non-public content without authentication. | |
| owning_org_content_ids | NULLABLE | STRING | The content IDs of government organisations recorded as owning the edition’s content, stored as a string representation of an array. | An empty array ({}) indicates that no owning organisation is recorded. |
| mongo_id | NULLABLE | STRING | The identifier of the corresponding edition record in Publisher’s former MongoDB database, retained to correlate migrated PostgreSQL editions with their original records. | Null where no former MongoDB edition identifier is recorded. |
| created_at | REQUIRED | TIMESTAMP | The date and time when the Publisher edition record was created. | |
| updated_at | REQUIRED | TIMESTAMP | The date and time when the Publisher edition record was last updated. | |
| editionable_type | REQUIRED | STRING | The type of content-specific Publisher record associated with the edition, such as GuideEdition, AnswerEdition or TransactionEdition. |
|
| editionable_id | REQUIRED | INTEGER | The identifier of the content-specific record associated with the edition. | The value is unique within an editionable_type and must be used together with editionable_type to identify the record. |
| assigned_to_id | NULLABLE | INTEGER | The identifier of the Publisher user who was assigned to the edition. | Corresponds to the person named in asignee. |
publisher.actions
This table contains workflow actions associated with editions managed in the GOV.UK Mainstream Publisher application. Each row represents an action or request relating to an edition, such as requesting review or fact checking, recording an approval, or sending a workflow message. The table includes information about the request type, users involved, comments, timestamps and request-specific details.
| field name | mode | type | description | notes |
|---|---|---|---|---|
| id | REQUIRED | INTEGER | The unique identifier of the Publisher action record. | |
| approver_id | NULLABLE | INTEGER | The identifier of the Publisher user who approved the edition, where the action records an approval. | |
| approved_timestamp | NULLABLE | TIMESTAMP | The date and time when the approval was recorded, where the action records an approval. | |
| comment_character | NULLABLE | STRING | The free-text comment or message associated with the workflow action, where provided. | Can contain user-entered text or standard system-generated messages. |
| comment_sanitized | REQUIRED | BOOLEAN | Comment-sanitisation flag. | All observed values are FALSE. |
| request_type | REQUIRED | STRING | The type of Publisher workflow action recorded. | Observed values cover assignment, review, fact checking, amendment requests, notes, version creation, scheduling, publishing and archiving. |
| request_details | REQUIRED | JSON | For schedule_for_publishing actions, the JSON contains scheduled_time and the scheduled publication time; other actions contain an empty JSON object. |
|
| email_address | NULLABLE | STRING | The email address to which the fact-check request was sent, where recorded. | Populated only for send_fact_check and fact_check_requested actions in the observed data. |
| customised_message | NULLABLE | STRING | The message included with the fact-check request, where provided. | Can contain instructions for reviewing the content and responding with factual corrections. |
| mongo_id | NULLABLE | STRING | The identifier of the corresponding action record in Publisher’s former MongoDB database, retained to correlate migrated action records with their PostgreSQL records. | Null where no former MongoDB action identifier is recorded. |
| create_at | REQUIRED | TIMESTAMP | The date and time when the Publisher action record was created. | The source field is named create_at, not created_at. |
| updated_at | REQUIRED | TIMESTAMP | The date and time when the Publisher action record was last updated. | |
| edition_id | NULLABLE | STRING | The identifier of the Publisher edition to which the action relates. | Joins to id in publisher.editions; all observed values matched. |
| requester_id | NULLABLE | INTEGER | The identifier of the Publisher user who initiated the workflow action or request, where recorded. | requester_id and requester_name were not populated together in the observed data. |
| recipient_id | NULLABLE | INTEGER | The identifier of the Publisher user to whom the edition was assigned, where recorded. | Populated exclusively for assign actions in the observed data. |
| requester_name | NULLABLE | STRING | The name of the person who submitted the fact-check response, where recorded. | Populated only on receive_fact_check actions in the observed data. |
Technical documentation
For more technical information, see:
- the GovGraph GitHub repository
- the Knowledge Graph query guide
- the Publishing API documentation
- the Publishing API reference