Friday 23 September 2011

Improving Data Quality using Custom Forms in Trac

Synopsis
When using a convention for your tickets, it is easy for ticket authors to break the convention. A solution is presented to help ticket authors abide by the convention.

The Problem
If you have a convention for your ticket description, and a high error rate in the use of the convention, how do you reduce the errors introduced by ticket authors?

A Solution
Provide as much content of the ticket description as possible as a default value. This works because it acts as a mental prop for authors.

The Implementation
When using Trac there are a couple of wrinkles in providing custom forms, however it is generally very easy. One solution is to embed a form in a wiki page which submits to the new ticket creation page. When the author enters some information, the form can enter default values and substitute textual descriptions for values that are meaningful to the reports.
A custom form implemented as a wiki page
The result of the custom form above, where the description has been populated and the textual description of the work package (WP) has been substituted for a value relevant to the reports.
The wrinkle here is that the wiki pages pass a cookie to track the users session, however the ticketing pages pass a hidden form field. So we use a little java script to copy the value from the cookie to the form field. The wiki page source that works around this is here.

Have fun with custom forms in Trac!

No comments:

Post a Comment