GithubHelp home page GithubHelp logo

18f / paid-leave-prototype Goto Github PK

View Code? Open in Web Editor NEW
6.0 103.0 3.0 1.37 MB

A proof of concept state paid family medical leave system

Home Page: https://paid-leave-prototype.18f.gov/

License: Other

HTML 18.57% JavaScript 66.72% CSS 14.68% Ruby 0.02%
government dol labor paid-leave form application json-schema

paid-leave-prototype's Introduction

Paid Family & Medical Leave Prototype

Code Climate CircleCI

This prototype was built by 18F, in partnership with the Department of Labor's Women's Bureau. Our goal was to provide a simple front-end, and some guidance on potential back-end structures, so that any jurisdiction with a Paid Family Medical Leave program can more easily create a website for it. The prototype is available now. Notable subsets of the prototype include a public-facing application process and a healthcare-provider patient-approval process.

Development

Development is in the 18f-pages branch.

Project Management

Feel free to open an issue if you'd like to request a feature. You can also look at our issues-tracking system on Trello.

Technical Approach

With a goal of constructing a modular, extensible, lightweight easily-customizable platform, this prototype employs several notable processes:

  • The site is constructed in Jekyll.
  • It is built entirely in JavaScript, to ensure that it can be hosted in any server environment.
  • The application form is encoded as JSON Schema, with JSON Form used to dynamically generate the HTML for the form. (No form data is present within the application page's HTMLβ€”it is all rendered in-browser, via JavaScript.)
  • Upon submission, form contents are submitted against the JSON Schema before being submitted to a RESTful endpoint (a server to be provided by the state implementing this prototype software).

Making changes to the form and validation process can be done by modifying the schema, with some particular HTML customizations possible via extensions to the schema in the form JSON. See the JSON Form documentation for specifics about this.

Because the form is generated from JSON, it would not be difficult to extend this prototype by adding a web-based form-building system, permitting customizations to the form without necessitating editing any JSON or HTML.

Local Development

This can be deployed locally with the following commands:

git clone https://github.com/18F/Paid-Leave-Prototype.git
gem install jekyll bundler accesslint-ci
jekyll serve --watch

Third Party Javascript Libraries

Contributing

See CONTRIBUTING for additional information.

Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

paid-leave-prototype's People

Contributors

andrewmaier avatar jposi avatar mheadd avatar waldoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paid-leave-prototype's Issues

Ensure that validation against JSON Schema is working

On submission, the form contents should be validated against JSON Schema, and any errors should be displayed in a user-friendly way. And when the form validates against the schema, it should be submitted to a specified endpoint (customized for each implementation, for the state's PFL system).

Resolve question of how best to encode form's structure

Per the discussion in #9, there's a fundamental conflict that I'm not sure of how to best resolve, and that's about how to represent the form structure and style it properly. JSON Form has a notable limitation: form JSON cannot be nested (at least, not much). This makes it challenging to break the form up into its constituent sections while also providing decent granularity for each of the fields in that section. We have three choices:

  1. Represent each form section in form.json as "type": "fieldset" groups. That eliminates any JSON Form display options (e.g., rendering select fields as radio buttons), and necessitates using CSS to group together fields...if that's possible.
  2. Do not include form sections in form.json, but instead represent each field, one by one, serially. Use a combination of CSS and form.json options (e.g., prepend, htmlClass) to group fields together. Challenge: including descriptive text / titles before or after form groupings.
  3. See if using a different JSON Schema library, e.g. Alpaca, will make it possible to nest form elements. Switching wouldn't be particularly difficult at this point, since JSON Schema is JSON Schema.

Add the contextual help text

Right now, we're using the help field in form.json to title each section. Instead, do this:

  • change these help fields to title (or something like that) fields, creating a custom field type to do so
  • change the .help-block class name in the CSS to instead apply to the new field class
  • add the actual help text throughout form.json (e.g., "Birth certificate, certificate of adoption, marriage license, or other documentary material" for the "Documentation of Relationship" field)
  • create new .help-block CSS to style this help text properly

Wire up the submit button

Within JSON Form's structure, make sure that the submit button is properly wired up to:

  • validate the input against the schema
  • display errors if there are any
  • submit to an endpoint

Simplify, merge form.css

Our form CSS right now contains many more rules than it needs to. Remove everything redundant, and figure out whether to combine it with the main site CSS file, or keep it as a separate file.

Add a file upload field for Documentation of Relationship

Right now it's just a text input field. JSON Schema has no concept of files. For this prototype, we need this to look like a file input. I suspect that this is best done via the onBeforeRender function. However we do it, the idea is just to replace the text input field (<input type="text" name="dependent.relationship.documentation">) with a file upload field (<input type="file" />.

Actually supporting this would probably involve using HTML5's file API, base64ing the file, and stuffing it into a string...but that presents its own challenges. Alternately, see how Alpaca does it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.