forked from hakimel/reveal.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rulesAsCode_XJ.html
401 lines (359 loc) · 17.8 KB
/
rulesAsCode_XJ.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Rules As Code</title>
<meta name="description" content="What it means, and why we're doing it!">
<meta name="author" content="Sara Falamaki">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/sky.css" id="theme">
<link rel="stylesheet" href="lib/css/monokai.css">
<script src="plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
plugins: [ RevealHighlight ]
});
</script>
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/monokai.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Rules as Code</h1>
<h3>What it means, and why we're doing it</h3>
<p>
<small>Sara Falamaki, TJ Harrop, Liam McCann and Asghar Kazi</small>
</p>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h3>What are we doing?</h3>
<ul>
<li>Manually translating <em>prescriptive</em> rules into computer code</li>
<li>Publishing this translation, so computer systems can use it</li>
<li>Testing our interpretation of the rules with clear, reproducible test data</li>
</ul>
</section>
<section>
<h3>Why Code The Rules?</h3>
<p>Every computer system that interacts with rules, codes them</p>
</section>
<section>
<h3>Lets do it once</h3>
<p>So that everyone uses the same rules</p>
</section>
<section>
<p>Often the interaction between rules is incomprehensible to mere humans...</p>
<img width="40%" src="img/parking.jpg" alt="Down arrow">
</section>
<section>
<p>...when rules change, it becomes even more confusing!</p>
<img width="80%" src="img/ess_rule_change_research.jpg" alt="Down arrow">
</section>
<section>
<h3>Let's do rules better</h3>
<ul>
<li>By explaining our rules to a stupid computer, we can help ensure they make sense</li>
<li>Rules and computer systems become easier to integrate with, test, and modify</li>
<li>By reducing the burden of legislation, we improve our customer's experience</li>
</ul>
</section>
<section>
<h3>We promise to</h3>
<ul>
<li>Make life better</li>
<li>Save Money!</li>
<li>Save Effort</li>
<li>Help make better rules</li>
</ul>
<p>... for both our customers and staff</p>
</section>
</section>
<section>
<h3>What are we NOT doing?</h3>
<p class="fragment shrink">AI</p>
<p class="fragment shrink">Machine Learning</p>
<p class="fragment shrink">Law, equity, judgements</p>
<p class="fragment shrink">RoboCops</p>
<p class="fragment shrink">RoboJudges</p>
<p class="fragment shrink">RoboDebt</p>
<p class="fragment shrink">Automatic Anything</p>
<p class="fragment fade-in-then-semi-out">... Anything scary!</p>
</section>
<section>
<section>
<h3>Rules as Code is here TODAY</h3>
<ul>
<li>Senegal's Taxation System - entire system coded in 36 hour hackathon</li>
<li>Etax - prefilling, different UI for individuals and agents, etc</li>
<li>ESS - NABERS, BRD - Community Gaming Regulation 2020</li>
<li>France, Canada, New Zealand, Senegal, Tunisia... </li>
</ul>
</section>
<section data-background="img/ring.png" data-background-size="200px" style="display: block;;">
<h3>One ruleset</h3>
<p>... many different representations</p>
<ul>
<li>Web form</li>
<li>3rd Party app</li>
<li>Voice reader interface</li>
<li>System integration with 3rd party system (MYOB, XERO, etc)</li>
<li>Example: paid annual leave</li>
</ul>
</section>
<section>
<h3>Commbank's Benefits Search</h3>
<img width="20%" src="img/CBA/cba5.png" alt="covid benefits">
</section>
<section>
<h3>Commbank's Benefits Search</h3>
<img width="20%" src="img/CBA/cba5.png" alt="covid benefits">
</section>
</section>
<section>
<section>
<h3>How does doing Rules as Code work?</h3>
<ol>
<li>Choose legislation to translate, or co-author new legislation</li>
<li>Concept Modelling</li>
<li>Code Concepts</li>
<li>Test understanding and code with test scenarios</li>
<li>Review the code with legal experts</li>
<li>Deploy API, and integrate services with it</li>
</ol>
</section>
<section>
<h3>Let's use the example of the Energy Savings Scheme to explain how this process works</h3>
</section>
<section>
<h3>What is the Energy Savings Scheme?<br></h3>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">In a sentence, the Energy Savings Scheme (Scheme) provides financial incentives to create energy savings, through conducting energy savings activities.</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">The aim of the Scheme is to encourage investment in energy efficiency, lower energy usage and lower energy costs, across households, business and industry.</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">The Scheme is coordinated by DPIE and administered by the Independent Pricing and Regulatory Tribunal (IPART), who sit within DCS. </span></p>
</section>
<section>
<h3>Success of the Scheme to date<br></h3>
<p style="test-align:left;"><span style="position: left; font-size:0.75em">Since the beginning of the Scheme in July 2009, it has achieved:</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em"><b>28,000 GWh</b> of energy savings (through to 2028)</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em"><b>$6.2 billion</b> in energy bill savings (through to 2028)</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em"><b>29 million</b> Energy Savings Certificates (since 2009)</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.25em"><i>Statistics current to 26 May 2020.</i></span></p>
</section>
<section>
<h3>In context of NSW's overall energy savings targets...<br></h3>
<img width="90%" alt="Down arrow" data-lazy-loaded="" data-src="img/ESS_targets.jpg">
</section>
<section>
<h3>The ESS and Rules<br></h3>
<p style="test-align:left;"><span style="position: left; font-size:0.75em">The activities eligible for ESS incentives are defined within the Energy Savings Scheme Rule (ESS Rule).</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.75em">DPIE updates the Rule approximately yearly, to continue incentivising better than best practice.</span></p>
</section>
<section>
<h3>A quick view of how the Rule has evolved over time<br></h3>
<img width="120%" alt="Down arrow" data-lazy-loaded="" data-src="img/ess_rule_length.png">
</section>
<section>
<h3>The future of the ESS<br></h3>
<p style="test-align:left;"><span style="position: centre; font-size:0.75em">The Energy Security Safeguard (Safeguard) was announced in late 2019, with two major components:</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">An expansion of the existing efficiency Scheme, with increased energy savings targets</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">The introduction of a new demand reduction scheme, with a new Rule for incentivising demand reduction activities</span></p>
<p><span style="position: left; font-size:0.3em"><a href="https://energy.nsw.gov.au/media/1921/download" target="_blank">Read more about the Safeguard in the NSW Electricity Strategy.</a></span></p>
</section>
<section>
<h3>In summary<br></h3>
<p style="test-align:left;"><span style="position: centre; font-size:0.50em">The Scheme incentivises energy savings activities which improve energy efficiency</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">It makes significant contributions to NSW's energy savings targets</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">There's a lengthy, complex Rule which defines what's eligible for incentives</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">The new Safeguard is going to expand the scope of the Scheme</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">Continuing current Scheme delivery makes it difficult for us to achieve our new targets - which means we need to make it easier to access the Scheme</span></p>
<p style="test-align:left;"><span style="position: left; font-size:0.50em">Reducing the complexity involved with the Rules, and enabling digital delivery of the Rules eases access to the Scheme!</span></p>
</section>
</section>
<section>
<section>
<h3>What we've done so far</h3>
<ul span style="font-size:0.7em">
<li>Worked with DCS to learn how to build a <em>Rules as Code</em> coding environment.</li>
<li>Coded the NABERS method of the Rule (for Offices and Apartments).</li>
<li>Built test cases for the use of this method.</li>
<li>Reviewed the code with Legal.</li>
<li>Started the process of building a proof of concept webform.</li>
<li>Started planning the next sections of the ESS to code.</li>
</ul>
</section>
<section>
<h3>A simple example of the value of our current work</h3>
<p span style="font-size:0.7em">There's a term <em>Counted Energy Savings</em> in the NABERS method of the ESS.</p>
<p span style="font-size:0.7em">It appears twice - and it's defined slightly differently both times it appears.</p>
</section>
<section>
<p> The difference in meanings is summarised below.<p>
<img width="80%" alt="Down arrow" data-lazy-loaded="" data-src="img/counted_energy_ savings_definitions.jpg">
</section>
<section>
<p>Strictly following the existing definitions of <em>Counted Energy Savings</em> within the Rule, it would be impossible to calculate ESCs within NABERS because of this ambiguity</p>
<p>The machine would be unsure of what definition to use at this point of the calculation, and refuse to finish it.</p>
</section>
<section>
<h3>What's so special about months?</h3>
<p>A month is a common concept that appears everywhere.</p>
<p>It appears in the ESS a few times, such as in 8.8.8:</p>
<img width="100%" alt="Down arrow" data-lazy-loaded="" data-src="img/section_8_8_8.png">
</section>
<section>
<h3>Let's try an example.</h3>
<p>How many months are between 29 May 2020, and 29 June 2021?</p>
<p>Write down your answer, based on your current understanding.</p>
</section>
<section>
<p>But what exactly <em>is</em> a month?</p>
<p>Let's see what the law says.</p>
</section>
<section data-background-iframe="https://www.legislation.nsw.gov.au/#/view/act/1987/15/part2/sec21" data-background-interactive>
<div style="position: absolute; width: 20%; left: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.5), 0 5px 25px rgba(0,0,0,0.2); background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px; font-size: 20px; text-align: left;">
<p>This is the definition of months in the Interpretations Act.</p>
</section>
<section>
<h3> The legal interpretation of this definition. </h3>
<p> So for (a), <p>
<p><span style="position: left; font-size:0.5em">a month begins on 12:00:01am on 15 July, and ends on 11:59:59pm on 14 August. Next month begins at 12:00:01am on 15 August, etc.</p>
<p> For (b), <p>
<p><span style="position: left; font-size:0.5em">a month begins on 12:00:01am on 31 August, and ends on 11:59:59pm on 30 September. Next month begins at 12:00:01am on 1 October, ends 11:59:59pm on 31 October, etc.</p>
<p> This functionality is difficult to replicate in code.</p>
</section>
<section>
<h3> What we did with this information. </h3>
<p> We built a function to replicate this definition.</p>
<p> There's an interesting finding we found, in codifying the strict legal interpretation of a common term and applying test cases to it. </p>
</section>
<section>
<p> Here's a test case that looks at 8.8.8, specifically at leap years.<p>
<img width="100%" alt="Down arrow" data-lazy-loaded="" data-src="img/months_example.jpg">
</section>
<section>
<h3>The value is stronger rules</h3>
<p>By removing ambiguity, finding loopholes and then building a rule development process around <em>Rules as Code</em>.</p>
</section>
<section>
<h3>Months and Active Kids</h3>
<p>Age children become eligible for <em>Active Kids</em> vouchers in NSW is defined as:</p>
<p>
<pre><code data-trim>
Active kids voucher eligibility: 4.5 to 18 years old
</code></pre>
</p>
</section>
<section>
<h3>Months and Active Kids</h3>
<p>Half a year can be defined in many different ways:
<small>
<ul>
<li>6 months</li>
<li>182.5 or 183 days</li>
<li>4380 hours, or 4392 hours (from their date of birth)</li>
<li>... and we need to know what time they were born!
</ul>
</small>
<p>This means that some children who would be eligible may miss out just because of our interpretation of the rules</p>
</section>
</section>
<section>
<section>
<h3>Better Rules</h3>
<p>Because we've got increasing targets, a second new Rule coming into effect and significant existing complexity which could scale into unworkable complexity, we're integrating Rules as Code into our rule development processes.</p>
</section>
<section>
<h3>Better Rules</h3>
<p>The Better Rules framework provides a template for how we can do rule changes</p>
<p><em>and</em></p>
<p>Coding the rules will transform how the rules operate and are implemented.</p>
</section>
<section>
<h3>The current rule change process is very linear.</h3>
<p>Here's a simplified version of the current process.</p>
<img width="85%" alt="Down arrow" data-lazy-loaded="" data-src="img/current_rule_change_process.jpg">
</section>
<section>
<h4>The end goal is to use an integrated Better Rules approach to build a better end product.</h4>
<img width="85%" alt="Down arrow" data-lazy-loaded="" data-src="img/better_rules_process.jpg">
</section>
<section>
<h3>There's three keys to building Better Rules for the ESS</h3>
<ul span style="position: left; font-size:0.6em">
<li>Integrating the perspectives and knowledge of <strong><em>different</em></strong> experts, such as legal experts, subject matter experts and digital specialists</li>
<li>Engaging in a process of continuous iteration - prototyping Better Rules approaches and learning from development</li>
<li>Designing rules with digital service delivery, and strong outcomes for the user in mind</li>
</ul>
</section>
</section>
<section>
<section>
<h3>One example of prototyping digital delivery with the ESS.</h3>
<img width="100%" alt="Down arrow" data-lazy-loaded="" data-src="img/ess_dynamic_form.png">
</section>
<section>
<h3>BRD Community Gaming Regulation prototype</h3>
<img width="50%" alt="Down arrow" data-lazy-loaded="" data-src="img/gaming.png">
</section>
</section>
<section>
<section>
<h3>Good Candidates for RaC</h3>
<p>Are rules/regulations/policies that:</p>
<ul>
<li>Are used by other organisations, agencies or partners</li>
<li>Change frequently or programmatically</li>
<li>Create the most queries from customers</li>
<li>Are about to be drafted</li>
</ul>
</section>
<section>
<h3>Let us know how we can help you make Better Rules </h3>
</section>
</section>
<section>
<h3>Questions?</h3>
</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
center: true,
hash: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js' },
{ src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>