From e657220256161026a8a673d60a6816912cfa89bb Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Sun, 28 Apr 2024 10:04:01 -0400 Subject: [PATCH 1/4] WIP add new metadata fields and questions --- .../ALWeaver/data/questions/assembly_line.yml | 41 ++++++++++++++++--- .../ALWeaver/data/templates/output.mako | 35 ++++++++++++++++ 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/docassemble/ALWeaver/data/questions/assembly_line.yml b/docassemble/ALWeaver/data/questions/assembly_line.yml index 79e868f8..35b4b6b5 100644 --- a/docassemble/ALWeaver/data/questions/assembly_line.yml +++ b/docassemble/ALWeaver/data/questions/assembly_line.yml @@ -375,6 +375,9 @@ fields: required: False validate: | lambda y: (not y or is_url(y)) or validation_error("Write a valid URL, like: https://masslegalhelp.org/my_form") + - Date original form was last published (optional): interview.original_form_published_on + datatype: date + required: False - Web page with related resources (optional): interview.help_page_url help: | Include a link to a resource that explains the topic of this form. For example, @@ -498,7 +501,10 @@ fields: states_list(country_code=interview.default_country_code) if pycountry.subdivisions.get(country_code=interview.default_country_code) else () default: ${ "MA" if interview.default_country_code == 'US' else '' } required: False - + - Jurisdiction: interview.jurisdiction + default: NAM-US-US+MA + help: | + Use the [LMSS](https://www.sali.org/) standard for jurisdiction codes. For example, "NAM-US-US+MA" for Massachusetts. - note: | ---

Optional packages to include

@@ -602,6 +608,13 @@ fields: - Custom filename: interview_label_draft show if: interview.customize_file_name default: ${ varname(interview.short_filename_with_spaces[:35]) } + - Court-assigned form number (optional): interview.form_number + required: False + help: | + For example, "CJ-P 1234" + - Filing fee (optional): interview.filing_fee + datatype: currency + required: False - Description of the form for metadata: interview.description default: | This interview helps someone in ${ state_name(interview.state, country_code=interview.default_country_code) } ${ interview.intro_prompt[0:1].lower() }${ interview.intro_prompt[1:] }. @@ -610,6 +623,14 @@ fields: help: | This description can help people find your form. It is not displayed inside the interview. + - "Answer this question: you can use this form if": interview.can_I_use_this_form + datatype: area + rows: 2 + default: | + If you are a _____________, you can use this interview to ____________. + help: | + It's important to explain to the user when they can and cannot use + your form. Write any conditions, such as age, status of their case, etc. - label: | What does your user need to know before they start this interview? field: interview.getting_started @@ -625,17 +646,27 @@ fields: When you are finished, you will need to: 1. - 1. - - Most people take about _______ minutes to finish this interview. + 1. datatype: area - rows: 17 + rows: 14 help: | Tell your user what they need to know before they start the form. This helps your user feel prepared and prevents frustration later in your interview, especially for longer forms. You can use Markdown lists (1. ) and bullets (*) at the beginning of a line to add formatting. + - To complete this form, most people take about: interview.estimated_completion_minutes + grid: 2 + datatype: integer + under text: | + minutes + default: 10 + - plus or minus: interview.estimated_completion_delta + grid: 2 + datatype: integer + default: 5 + under text: | + minutes --- code: | interview_label_draft = interview.title[:35] diff --git a/docassemble/ALWeaver/data/templates/output.mako b/docassemble/ALWeaver/data/templates/output.mako index c3bf59ee..6aac0819 100644 --- a/docassemble/ALWeaver/data/templates/output.mako +++ b/docassemble/ALWeaver/data/templates/output.mako @@ -15,7 +15,22 @@ metadata: ${ interview.short_title } description: |- ${ indent(interview.description, by=4) } + can_I_use_this_form: | + before_you_start: | +${ indent(interview.getting_started, by=4 } + maturity: production + estimated_completion_minutes: 60 + estimated_completion_delta: 30 % if interview.categories.any_true(): + LIST_topics: + % for category in sorted(set(interview.categories.true_values())): + - "${ escape_double_quoted_yaml(oneline(category)).strip() }" + % endfor + % if interview.has_other_categories: + % for category in interview.other_categories.split(','): + - "${ escape_double_quoted_yaml(oneline(category)).strip() }" + % endfor + % endif tags: % for category in sorted(set(interview.categories.true_values())): - "${ escape_double_quoted_yaml(oneline(category)).strip() }" @@ -35,7 +50,10 @@ ${ indent(interview.description, by=4) } % if interview.original_form: original_form: - ${ interview.original_form } + % else: + original_form: [] % endif + original_form_published_on: ${ interview.original_form_published_on.format("yyyy-MM-dd") or '""'} % if interview.help_page_url: help_page_url: >- ${ indent(interview.help_page_url, by=4) } @@ -55,6 +73,23 @@ ${ indent(interview.help_page_title, by=4) } % endif al_weaver_version: "${ package_version_number }" generated_on: "${ today().format("yyyy-MM-dd") }" + languages: + - en + jurisdiction: ${ interview.jurisdiction } + review_date: ${ today().format("yyyy-MM-dd")} + form_titles: + - ${ interview.title } + % if interview.form_number: + form_numbers: + - ${ interview.form_number } + % else: + form_numbers: [] + % endif + % if interview.filing_fee: + fees: + - Filing fee: ${ currency(interview.filing_fee) } + % endif + update_notes: | --- code: | # This controls the default country and list of states in address field questions From 20e194aece2ef13ae221b9097276575c97bab3b7 Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Sun, 28 Apr 2024 15:45:41 -0400 Subject: [PATCH 2/4] Fix typo, finish work to address https://github.com/SuffolkLITLab/courtformsonline.org/issues/8 fix #924 --- docassemble/ALWeaver/data/templates/output.mako | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docassemble/ALWeaver/data/templates/output.mako b/docassemble/ALWeaver/data/templates/output.mako index 6aac0819..41266245 100644 --- a/docassemble/ALWeaver/data/templates/output.mako +++ b/docassemble/ALWeaver/data/templates/output.mako @@ -16,8 +16,13 @@ metadata: description: |- ${ indent(interview.description, by=4) } can_I_use_this_form: | +% if interview.can_I_use_this_form: +${ indent(interview.can_I_use_this_form, by=4) } +% endif before_you_start: | -${ indent(interview.getting_started, by=4 } +% if interview.getting_started: +${ indent(interview.getting_started, by=4) } +% endif maturity: production estimated_completion_minutes: 60 estimated_completion_delta: 30 @@ -189,14 +194,16 @@ code: | - just use interview_label instead of varname(interview.title) \ --- -comment: | - This question is used to introduce your interview. Please customize id: ${ varname(interview.title) } continue button field: ${ interview.interview_label }_intro question: | ${ interview.title } subquestion: | ${ indent(interview.getting_started, 2) } + +${ indent(interview.can_I_use_this_form, by=2)} + + Most people take about ${ interview.estimated_completion_minutes or "_______________"} minutes to complete this interview. <%doc> Main question loop \ From fbd6baf9d7b20bfe6bd4a5655bd9357fdab9b19e Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Sun, 28 Apr 2024 15:51:30 -0400 Subject: [PATCH 3/4] Upgrade to new Black formatting --- docassemble/ALWeaver/generator_constants.py | 1 + docassemble/ALWeaver/interview_generator.py | 24 +++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docassemble/ALWeaver/generator_constants.py b/docassemble/ALWeaver/generator_constants.py index 74ac0aab..fa6cae8c 100644 --- a/docassemble/ALWeaver/generator_constants.py +++ b/docassemble/ALWeaver/generator_constants.py @@ -1,6 +1,7 @@ """ Constants for interview_generator.py """ + from typing import Dict, List diff --git a/docassemble/ALWeaver/interview_generator.py b/docassemble/ALWeaver/interview_generator.py index 681db182..43b57dc1 100644 --- a/docassemble/ALWeaver/interview_generator.py +++ b/docassemble/ALWeaver/interview_generator.py @@ -487,9 +487,9 @@ def user_ask_about_field(self): "label above field": True, "grid": 3, "code": "field_type_options()", - "default": self.field_type_guess - if hasattr(self, "field_type_guess") - else None, + "default": ( + self.field_type_guess if hasattr(self, "field_type_guess") else None + ), } ) field_questions.append( @@ -517,14 +517,16 @@ def user_ask_about_field(self): "field": self.attr_name("choices"), "datatype": "area", "js show if": f"['multiple choice dropdown','multiple choice combobox','multiselect', 'multiple choice radio', 'multiple choice checkboxes'].includes(val('{ self.attr_name('field_type') }'))", - "default": "\n".join( - [ - f"{opt.capitalize().replace('_', ' ')}: {opt}" - for opt in self.choice_options - ] - ) - if hasattr(self, "choice_options") - else None, + "default": ( + "\n".join( + [ + f"{opt.capitalize().replace('_', ' ')}: {opt}" + for opt in self.choice_options + ] + ) + if hasattr(self, "choice_options") + else None + ), "help": "Like `Descriptive name: key_name`, or just `Descriptive name`", "hint": "Descriptive name: key_name", } From 2f4bb0499f019bf5715a2ff8f38925d5ec6f31b4 Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Tue, 30 Apr 2024 09:54:24 -0400 Subject: [PATCH 4/4] Title was too long in test --- docassemble/ALWeaver/data/sources/test_1.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/docassemble/ALWeaver/data/sources/test_1.feature b/docassemble/ALWeaver/data/sources/test_1.feature index 4a1b835f..806441b8 100644 --- a/docassemble/ALWeaver/data/sources/test_1.feature +++ b/docassemble/ALWeaver/data/sources/test_1.feature @@ -39,6 +39,7 @@ Scenario: I weave the civil docketing statement | interview.original_form | http://an-online-form.com | | | interview.state | MA | | | interview_label_draft | test_civil_docketing_statement | | + | interview.short_title | Civil docketing | | | people_quantities['decision_maker'] | any | | | people_quantities['users'] | more | | | people_variables['decision_maker'] | True | |