london ruby user group - application example based on gov.uk public code

19
@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

Upload: jairo-diaz

Post on 14-Aug-2015

24 views

Category:

Technology


0 download

TRANSCRIPT

@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

@codescrum

Requirement

● Implement a pension advice tool:

StartQuestion

1

Question2

Oucome1

Question4

Oucome2

Oucome3

Oucome4

@codescrum

GOV.UK

● https://www.gov.uk/which-finance-is-right-for-your-business/

@codescrum

Can we reuse?

1. Spike: Install and implement a simple flow

2. Review code

3. Reuse code

@codescrum

Step 1. Test Simple Flow

● Github project: alphagov / smart-answers-stack● Check Readme.md

@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

@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

@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”

@codescrum

Step 2. Review Code

CodeClimate Metrics: Duplication / Complex Method / Complex Class

@codescrum

Test Coverage

@codescrum

Rails App

SmartAnswersController

SmartAnswersPresenter

Show.html.erb

Look up translationsControls UI elements

Find FlowControl user interaction

Controls Display for amultiple choice question with “options”

MultipleChoiceQuestionPresenter

Renders UI

@codescrum

Library Interface

SmartAnswersPresenter

FlowRegistry

MultipleChoiceMultipleChoiceQuestionPresenter

Method instanceMethod find

Flow

Method nameMethod processMethod nodeMethod path

SmartAnswersController

Method nameMethod processMethod nodeMethod path

Method nameMethod optionsMethod to_response

@codescrum

Library Implementation

State

Node

Question::Base

SmartAnswersPresenter

FlowRegistry

MultipleChoiceMultipleChoiceQuestionPresenter

Flow

SmartAnswersController

@codescrum

Step 3. Reuse Code

FlowStatePresenter

QuestionPresenter

FlowsController

SmartAnswersPresenter

MultipleChoiceQuestionPresenter

SmartAnswersController

FlowRegistry

MultipleChoice

Flow

@codescrum

Additional elements

● Custom Javascript application● Localisation for an additional language● Cucumber / RSpec testbed ● Google Analytics configuration● Deployment ● Service monitoring

@codescrum

Workplace pension advice tool

https://www.moneyadviceservice.org.uk/en/tools/workplace-pension-advice-tool

@codescrum

The new budget tool

https://www.moneyadviceservice.org.uk/en/tools/the-budget-and-you

@codescrum

Other Interesting Projects

● Smart-answers-builderfile://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

@codescrum

Thank you & Questions