Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add form validation for create/edit views #41

Open
jeancochrane opened this issue Mar 2, 2020 · 4 comments
Open

Add form validation for create/edit views #41

jeancochrane opened this issue Mar 2, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@jeancochrane
Copy link
Contributor

We've shied away from form validation so far because the data quality wasn't good enough, but now that active users are starting to use the application we should add it in to make sure that new data meets the standard.

For Add views, we can drop this validation in easily. For edit views, we'll need a custom validator to check if there's pre-existing data for the record and skip the validation if so. (Remember to turn off JavaScript validation in these cases.)

@jeancochrane
Copy link
Contributor Author

I've got a preliminary spike of the form validation framework that seems to work well for licenses. Now we just need a canonical list of validators for each field and I can roll it out across all the document types. Here's my guess of what validators should look like, based on the existing data:

All

  • Source file: .pdf extension

Books

  • Township: Integer range between 35-42
  • Range: Integer range between 9-15
  • Section: Integer range between 1-36

Control Monument Maps

  • Township: Integer between 35-42
  • Range: Integer between 9-15
  • Section: Array of integers between 1-36
  • Part of section: Choice of "E1/2" or "W1/2"

Surplus Parcels

  • Surplus parcel: No restrictions
  • Description: No restrictions

Deep Tunnels:

  • Descrpition: No restrictions

Dossiers

  • File number: Positive integer
  • Document number: Positive integer

Easements

  • Easement number: Positive integer
  • Description: No restrictions

Flat Drawings

  • Area: Integer between 1-33
  • Section: Integer range between 1-36
  • Map number: No restrictions
  • Location: No restrictions
  • Building ID: No restrictions
  • Description: No restrictions
  • Job number: No restrictions
  • Number of sheets: Positive integer
  • Date: Date formatted like "YYYY-MM-DD"
  • Cross reference area: Integer between 1-33
  • Cross reference section: Integer between 1-36
  • Cross reference map number: No restrictions
  • Hash: No restrictions
  • CAD file: One of:
    • .DWG
    • .DXF
    • .DGN
    • .STL

Index Cards

  • Monument number: No restrictions
  • Township: Integer between 35-42
  • Section: Integer range between 1-36
  • Corner: No restrictions

Licenses

  • Township: Array of integers between 35-42
  • Range: Array of integers between 9-15
  • Section: Array of integers between 1-36
  • License number: Hyphenated string starting with "O" and ending with an integer, like "O-100"
  • Description: No restrictions
  • Geometry: GeoJSON object
  • Type: One of:
    • combined sewer
    • electric
    • gas
    • other
    • pipeline
    • sanitary sewer
    • storm sewer
    • telecom
    • water main
  • Entity: No restrictions
  • Diameter: Positive integer
  • Material: No restrictions
  • End date: Date formatted like "YYYY-MM-DD"
  • Status: One of:
    • TBD
    • active
    • cancelled
    • continuous
    • expired
    • indefinite
    • perpetual
  • Agreement type: No restrictions

Project files

  • Area: Integer between 1-33
  • Section: Integer between 1-36
  • Job number: No restrictions
  • Job name: No restrictions
  • Description: No restrictions
  • Cabinet number: Integer between 1-10
  • Drawer number: No restrictions

Rights of way

  • Folder tab: No restrictions

Surveys

  • Township: Array of integers between 35-42
  • Range: Array of integers between 9-15
  • Section: Array of integers between 1-36
  • Map number: No restrictions
  • Location: No restrictions
  • Description: No restrictions
  • Job number: 0-padded three-digit integer
  • Number of sheets: Positive integer
  • Date: Date formatted like "YYYY-MM-DD"
  • Cross reference area: Integer between 1-33
  • Cross reference area: Integer between 1-33
  • Cross reference section: Integer between 1-36
  • Cross reference map number: No restrictions
  • Hash: No restrictions

Titles

  • Control number: Positive integer

@glw glw added the enhancement New feature or request label Mar 27, 2023
@smcalilly
Copy link
Contributor

smcalilly commented May 23, 2023

locations (flat drawing) and dates (todo: find model). related #45 and #78

@xmedr xmedr self-assigned this May 24, 2023
@xmedr
Copy link
Collaborator

xmedr commented May 25, 2023

Found some discrepancies with the data we have and the validation requirements listed here, so I just wanted to double check that these were still what we're going for or if some need to be re-evaluated.

Flat Drawings and Index Cards

  • Both have a section field that's listed as needing to be two integers within a range of 1 through 36. All the inputs I've seen so far have been a single number as opposed to something like "20 - 30" and they go as high as 98.
    • By contrast, the section field for Books is storing that data this way just fine, and even has a custom field type set up for it that is not being used for flatdrawings/indexcards

Index Cards

  • The township field is listed as needing to be an integer between 35 and 42. The data is only ever the names of the township in all caps, of which there are 17 different names.
    • By contrast, all other documents' township fields are numbers.

Surveys

  • The job_number field is listed as needing to be a 0-padded, three digit number. The data instead has been anywhere from a 3 digit number, to a 5 digit, to a range, to just the word "Hold"

@smcalilly
Copy link
Contributor

We're going to validate the fields that we have no questions and revisit the other fields in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants