Logic without Flowcharts:

Slides:



Advertisements
Similar presentations
Bending Zen Intro Using Zen Themes functionality, but bending it into your own theme.
Advertisements

Using “So what is the Truth” Template Copy the presentation to your hard drive. Open the slides using slide sorter and copy slides #3, 4, and 5 for each.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Advanced Civil Litigation Class 4Slide 1 The Complaint: General Points The Purpose of the complaint under the federal system and many state systems is.
Advanced Civil Litigation Class 6Slide 1 Steps in Filing a Complaint First, the necessary complaint must be prepared. Make sure you attach the: First,
Conditional Statements Introduction to Computing Science and Programming I.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
LHCbPR V2 Sasha Mazurov, Amine Ben Hammou, Ben Couturier 5th LHCb Computing Workshop
Automation Repository - QTP Tutorials Made Easy The Zero th Step TEST AUTOMATION AND QTP.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Plone vs The New Guy The Initial Struggles of a Beginning Plone Developer John Hren University Wisconsin - Oshkosh.
Using the Multiple Choice Template Copy this presentation to your hard drive. Open up slide sorter, copy slides #3, 4, and 5 each time you are going to.
SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS AngularJS is a client-side JavaScript Framework for adding interactivity to HTML.
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
Microsoft ® Office Access ™ 2007 Training Choose between Access and Excel ICT Staff Development presents:
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
17. Python Exceptions Handling Python provides two very important features to handle any unexpected error in your Python programs and to add debugging.
Programming Training Main Points: - Python Statements - Problems with selections.
The Evils of Copy and Paste Presented by Daniel Daugherty
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Writing Scala Programs. Command Line There are three common operating systems: Windows (various flavors; I recommend Windows 7) UNIX or Linux (basically.
Chapter 4 Selection Structures: Making Decisions.
By the end of this session you should be able to...
Introduction to MATLAB Session 3 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2011.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Beginning Fortran Fortran (77) Advanced 29 October 2009 *Black text on white background provided for easy printing.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Python: Building Geoprocessing Tools David Wynne, Ghislain Prince.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
More on Functions Intro to Computer Science CS1510 Dr. Sarah Diesburg.
HTML LAYOUTS. CONTENTS Layouts Example Layout Using Element Example Using Table Example Output Summary Exercise.
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
Information Screen Different options to realize. Idea one – You want this if: It should be easy to provide information ◦ Even for non-technical advanced.
Using the Correct Order Template Copy the presentation to your hard drive. Open the slides using slide sorter and copy slides #3, 4, and 5 for each question.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
Tips & Tricks with Multiple Skins
How to use the Jeopardy Template
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Based on slides by Shawn.
Dreamweaver – Setting up a Site and Page Layouts
Laravel vs CodeIgniter: Best of 2017
Indication rules and set filtering Harvard University April 18-19
Main Points: - Python Statements - Problems with selections.
Physical Changes That Don’t Change the Logical Design
QDE FORMS (Quick Data Entry)
Microsoft Visual Basic 2005 BASICS
Lecturer: Mukhtar Mohamed Ali “Hakaale”
File Handling Programming Guides.
Diagram It! When you wish to visually render a process, variables or components that are part of a larger system, Diagram It! is your game!
Javascript Game Assessment
Coding Concepts (Sub- Programs)
Understanding the Three Basic Structures
Data Science with Python
Programming We have seen various examples of programming languages
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Spreadsheets, Modelling & Databases
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
IDE’s and Debugging.
Indication rules and set filtering
Planning a Group Policy Management and Implementation Strategy
Generalizing Similar Functions
Review of Previous Lesson
Designing Docassemble Interviews for Maintainability
Presentation transcript:

Logic without Flowcharts: Taming complex interviews in docassemble Docacon, June 22, 2018

Promise

Reality

Option A Option B

COMPLEXITY SUCKS But you can manage.

1. Give your interview autonomy

Too much freedom mandatory: True question: | Here is your pleading. attachment: name: Answer docx template file: answer.docx --- <100 non-mandatory questions>

Too little freedom mandatory: True code: | start_page user.name.first user.name.last user.monthly_income user.birthplace user.is_plaintiff user.is_in_military <400 similar lines> end_page

Reasonable autonomy mandatory: True code: | start_page user.name.full() if not jurisdiction_proper: explain_that_jurisdiction_is_improper summary_of_damages_incurred summary_of_available_relief end_page

2. Use one question block instead of many Friends don't let friends copy and paste

question: | How much do you wish to claim in damages for property damage? fields: - Amount: property_damage datatype: currency --- in damages for back rent? - Amount: back_rent objects: - damages: DADict --- question: | How much do you wish to claim in damages for ${i}? fields: - Amount: damages[i] datatype: currency

question: | Summary of claim subquestion: | You are asking for ${ currency(sum(damages.values())) } from defendant. Proceed? yesno: ok_to_file

Question variations: conditional expressions How much do you wish to claim in damages for ${i}? subquestion: | % if i == 'attorney fees': Be reasonable. % endif fields: - Amount: damages[i] datatype: currency - Reason for fine: fines_reason show if: code: i == 'fines' Question variations: conditional expressions Mako show if code

Question variations: general rule & exception How much do you wish to claim in damages for ${i}? fields: - Amount: damages[i] datatype: currency --- if: i == "back rent" Back rent amount? - Amount due: damages[i] General rule Exception

3. Embrace the framework Don't micromanage

Don't do this Do this instead mandatory: True question: ... --- question: ... --- mandatory: True code: | end_result

How do I integrate React.js and a Java servlet farm with docassemble? How about you use Bootstrap and Python?

Don't do this Do this instead features: javascript: myfuncs.js css: myclasses.css --- question: | <span class="megabig"> Are you doing well? </span> under: | <div id="logo"></div> script: | <script> animate($("#logo")); </script> features: bootstrap theme: nice.css --- question: | Are you doing well? yesno: doing_well

4. Don't use advanced features when the simple features are sufficient

Mercedes S class, or . . . Ford Fusion?

5. Use multiple question files

--- include: - contact_info.yml - marital_property.yml - fault.yml - non_fault.yml

6. Use a proper text editor Along with Google Drive.

Sublime Text

Notepad++

Search, don’t sort. GMail, 2004

Emacs

Vim

7. Keep a diary

8. Optimize for readability

Use descriptive variable names Instead of this: % if sLawClaim: Do: % if case.claim.arises_under_state_law:

There are only two hard things in computer science: cache invalidation and naming things. – Phil Karlton

Keep question blocks short Instead of doing this: Do this: question: | Do you wish to file the complaint? help text: | Bear in mind that by filing this complaint, you will expose yourself to potential expenses <100 more lines> yesno: ok_to_proceed question: | Do you wish to file the complaint? help text: | ${ help_for_complaint } yesno: ok_to_proceed --- template: help_for_complaint content: | Bear in mind that by ...

Isolate complicated blocks include: - definitions.yml --- modules: - .functions question: | Was the complaint served? yesno: complaint_served Put code in modules Then the rest is easier to read...

Ugh, looks like gobbledygook! code: | p_states = set([y.address.state for y in plaintiff]) d_states = set([y.address.state for y in defendant]) if len(p_states & d_states): state_diversity = False else: state_diversity = True

Put it in a module def state_diversity_exists(a, b): a_states = set([y.address.state for y in a]) b_states = set([y.address.state for y in b]) return False if len(a_states & b_states) else True functions.py

Now this is readable code: | if state_diversity_exists(plaintiff, defendant) \ and amount_in_controversy > 75000: diversity_jurisdiction_is_proper = True else: diversity_jurisdiction_is_proper = False

9. Build libraries

Make your blocks reusable Custody Divorce include: - common.yml - custody_law.yml include: - common.yml - divorce_law.yml question: | Before I can proceed with your ${ case_type } case, I have some questions. field: intro_given common.yml

10. Legal objects

objects: - case: TortCase --- question: | In which court would you like to file your claim? choices: code: case.courts_with_jurisdiction() field: case.court interview.yml

from docassemble.base.legal import Case class TortCase(Case): def courts_with_jurisdiction(self): if self.amount_in_controversy > 10000: ... if self.cause_of_action in federal_questions: objects.py

question: All done attachment: - name: Personal Injury Complaint - content: | ${ case.caption() } ${ case.plaintiff.as_noun(capitalize=True) } ${ case.plaintiff.does_verb('bring') } this action against ${ case.defendant } for heinous misdeeds and egregious omissions related to

😸 Jonathan Pyle @jpyle @docassemble Thanks! 😸 Jonathan Pyle @jpyle @docassemble