alphagov / govuk-knowledge-graph-gcp

GOV.UK content data and cloud infrastructure for the GovSearch app.
https://docs.data-community.publishing.service.gov.uk/tools/govgraph/
MIT License
8 stars 1 forks source link

Fetch content of smart answers from GitHub #685

Open nacnudus opened 3 months ago

nacnudus commented 3 months ago

Users continue to request that all Smart Answer content be included in GovSearch.

Smart answers (aka GitHub smart answers) are composed in , and only their initial page is sent to the Publishing API, son only their initial page is currently available in GovSearch.

The content could be included in GovSearch by

  1. Fetch the HEAD of the repository
  2. Iterate through the `app/flows/smart_answer_slug_flow/*/.erb
  3. Extract plain text from the .erb files (write a simple state machine parser according to https://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html)
  4. Append that text to the content of the initial page, which will have the slug /smart-answer-slug (dashes instead of underscores)

Example: https://www.gov.uk/calculate-agricultural-holiday-entitlement