Skip to content

Latest commit

 

History

History

faq-site

title permalink
COVID FAQ Site Builder
/faq-site/

COVID FAQ Site Builder

Built With

Project Setup

  • Install Node.js & NPM
  • Run npm install in the project directory to install local dependencies
  • Run npm run serve to run in a local dev environment
  • Access dev copy of the site at localhost:8080

Environment Variables

Get the config info from someone who's worked on the project or from Azure

Create the environment files for any supported environment:

  • .env.<environment>
  • .env.test
  • .env.prod

Which has content like this, but replace with actual keys:

RuntimeEndpoint=https://***.azurewebsites.net
kbId=***
RuntimeApiKey=***
Endpoint=https://***.cognitiveservices.azure.com
OcpApimSubscriptionKey=***
environment=prod

Choose which environment file to use by setting an environment variable named AZURE_ENVIRONMENT before running. You can set the value in the following locations:

  • Debug - .vscode/launch.json
  • Run - package.json > scripts

NPM Scripts

# eleventy site
npm run clean
npm run build         # runs `npx eleventy` to build the site
npm run serve         # builds site + serves `_site` directory

# interactive cli
npm run faq-cli       # run interactive cli cmd with options
npm run cli-help      # get help info on available CLI commands

# knowledge base
npm run publish-kb    # publishes the knowledge base from edit index to bot index
npm run fetch-kb      # downloads the knowledge base from the targeted environment
npm run deploy-kb     # deploys knowledge base from one environment to another
npm run restore-kb    # makes incremental revisions to knowledge base from local faq file

# local data file
npm run archive-data  # moves local faq file into the archive file
npm run lint-data     # validates data and checks for common errors
npm run list-changes  # lists changes to questions - deleted, new, and title changes
npm run fix-data      # automatically fix inconsistencies in follow up prompts - upload via restore-kb

# publish site
npm run deploy-faq-test  # publish local _site folder to path on test
npm run deploy-faq-prod  # publish local _site folder to path on prod
npm run deploy-faq       # publish local _site to test and prod

Install the cli from the "bin" property in package.json with the following command:

npm i ./ -g

Then you can invoke via:

faq-cli

Deployment

FAQ Site

  1. Verify latest changes are pulled in from source control

    git checkout master
    git pull
  2. Ensure updates were published

    npm run publish-kb
  3. Get latest knowledge base updates

    npm run fetch-kb
  4. Archive previous data

    npm run archive-data
  5. Check for any common problems

    npm run lint-data
  6. Test site build and review differences in /diff.html

    npm run serve
  7. If there are validation issues, fix them in QnA maker and redo steps 3-6 until the toothpick comes out clean

  8. Deploy static files to test and prod environments

    npm run deploy-faq

Knowledge Base

Move the KB changes from the test environment to production

npm run deploy-kb

// TODO

  • script site publish
  • Don't display Empty subcategory
  • check for follow-up prompt generated duplicates (leviathan distance?)
  • only write synonyms if file's changed
  • #18 show revision history
  • #26 update timestamp from KB modified time, not build time #26
  • #37 add toggle for TOC on mobile
  • #17 expand / collapse all
  • #20 low-perf debouncing
  • add deep links to filter and each fragment URI
  • sort title vs body match & reset position when clearing filter
  • fix [tel:211]
  • social meta tags
  • determine multiple env for config (workaround comment out)
  • contain page action buttons to main area when scrolled to bottom
  • #49 add remove filter button
  • fix focus styles
  • #39 add back to top button
  • #40 guarantee unique IDs for subcategories
  • handle no js
  • subcategories sort override (symptoms, sick, monitor)
  • add tooltip to abbreviations
  • title case subcategories
  • rename category abbrev (VT -> Vermont)
  • #36 polyfill summary detail
  • #24 add linter
  • add subcategories
  • #25 add synonyms to mark.js
  • #18 add toc overview
  • #22 add telemetry from search terms
  • add VDH logo / branding
  • test for questions missing a category
  • add timestamp
  • add topics
  • filter out "This did not answer my question"
  • figure out async await for fs.writeFile
  • update data live api
  • fix mark.js failing
  • fix encoding ’
  • get primary question from answer markdown
  • conditionally hide alt phrasing when not search hits
  • research why links do not always go directly to question