Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Application Example based on Gov.uk public code.

Application Example based on Gov.uk public code.

This talk shows how we can implement a custom customer service flow based on the SmartAnswers module from the GOV.UK project.

Jairo Diaz

June 11, 2013
Tweet

More Decks by Jairo Diaz

Other Decks in Programming

Transcript

  1. @codescrum Application Example based on Gov.uk public code This talk

    shows how we can implement a custom customer service flow based on the SmartAnswers module from the GOV.UK project. Jairo Diaz @codescrum
  2. @codescrum Requirement • Implement a pension advice tool: Start Question

    1 Question 2 Oucome 1 Question 4 Oucome 2 Oucome 3 Oucome 4
  3. @codescrum Can we reuse? 1. Spike: Install and implement a

    simple flow 2. Review code 3. Reuse code
  4. @codescrum Step 1. Test Simple Flow • Github project: alphagov

    / smart-answers-stack • Check Readme.md
  5. @codescrum Dependencies for Smart-answers Smart-anwers (5001) Static (5000) GovUk_Content_API (5002)

    MongoDb (27017) Local URL: http://smartanswers.dev.gov.uk/which-finance-is-right-for-your-business
  6. @codescrum Smart-answers DSL (flow.rb) multiple_choice :have_you_got_a_letter? do option :yes =>

    :what_does_your_letter_say? option :no => :workplace_pension_good_idea end multiple_choice :what_does_your_letter_say? {...} outcome :workplace_pension_good_idea outcome :no_outcome
  7. @codescrum Smart-answers Text (flow.yml) en: test-flow: flow: have_you_got_a_letter?: title: Have

    you received a letter ... options: "yes": "Yes" "no": "No" workplace_pension_good_idea: body: “the advice is here”
  8. @codescrum Rails App SmartAnswers Controller SmartAnswers Presenter Show.html.erb Look up

    translations Controls UI elements Find Flow Control user interaction Controls Display for a multiple choice question with “options” MultipleChoice QuestionPresenter Renders UI
  9. @codescrum Library Interface SmartAnswers Presenter FlowRegistry MultipleChoice MultipleChoice QuestionPresenter Method

    instance Method find Flow Method name Method process Method node Method path SmartAnswers Controller Method name Method process Method node Method path Method name Method options Method to_response
  10. @codescrum Step 3. Reuse Code FlowStatePresenter QuestionPresenter Flows Controller SmartAnswers

    Presenter MultipleChoice QuestionPresenter SmartAnswers Controller FlowRegistry MultipleChoice Flow
  11. @codescrum Additional elements • Custom Javascript application • Localisation for

    an additional language • Cucumber / RSpec testbed • Google Analytics configuration • Deployment • Service monitoring
  12. @codescrum Other Interesting Projects • Smart-answers-builder file://localhost/Users/User/Github/smart-answer-builder/index.html • Performance management

    apps (backdrop) https://www.gov.uk/performance/dashboard • CMS: whitehall / publisher / frontend • Puppet modules