CodeKit Overview

CodeKit is an interface to a universal database code table. CodeKit takes all of the programming work out of maintaining multiple database code definition sets.

The code administration page lets you define new virtual code tables and enter all codes and their descriptions. Perl and PHP classes retrieve the code descriptions and automatically generate HTML code selection elements.

Traditional Code Set Implementations

Code sets are an important part of any database. They define the choices available for codified fields and supply the human readable descriptions for display purposes.

Code sets are usually implemented as database tables, one physical database table for each set of codes.

Each database table typically needs an administration data entry page to allow for code set entry and upkeep. Also, each use of each code set requires similar but slightly different SQL and application code, an opportunity for bugs to slip into the applications.

Universal Code Table

A universal code table replaces all of the traditional individual database code tables with a single database table which is structured to hold all of the code sets in the entire database.

This saves a lot of programmer work in setting up the tables and eliminates the need to write multiple code set administration data entry pages. CodeKit provides code administration utilities written in both PHP and Perl.

A single database table makes it easy to write an API for each language of interest to perform common operations such as looking up a code description or displaying code choices to the user. CodeKit currently provides APIs for PHP and Perl.

Code Set Display Order

It is often necessary to specify the order in which code set choices are displayed to the user.

CodeKit has a numeric code order field associated with each code value. The sort is first by code order numerically, then by code value lexicographically. The code order field can be specified at data entry time. If the order field is not specified and the code value is numeric then that numeric value is used as the code order value. This keeps numeric code values sorted numerically by default.

Deprecated Codes

Sometimes codified choices go out of date and are no longer available for user selection. Simply removing an obsolete code from the code set creates a problem when it comes time to display the code descriptions for obsolete code values which are still in the database.

The solution is to mark obsolete codes as deprecated without removing them from the code set. This leaves the obsolete code descriptions in the code set for display purposes, but does not allow new data entry selection of deprecated code choices. CodeKit fully supports deprecated codes.

Phrase and Paragraph User Interface Text

If you have a web site or user interface which needs to display pieces of text CodeKit can help with the storage and retrieval of phrases and paragraphs.

One approach is to create a code set called 'phrase' and another called 'paragraph'. The phase set is used for one line words and phrases. The paragraph set can hold multiline paragraphs or pages of text. Check the 'Multiline Set' box when creating the paragraph set.

For software modularity it helps to use code values which are a combination of the module using the phrase or paragraph and a short name such as 'member-accepted' and 'credit-disclaimer'. That way you will know exactly which modules will be affected by a change in phrasing. Some phrases may be so universal as to be invariant, so those can be shared between modules as in 'shared-hello'.

Parameter Sets

It is often a good idea to keep any application parameters separate from the application code so that they can be changed without source code changes. Parameter sets are a excellent way to accomplish this. Use the data() method to get the data.