Configuration
The Data Upload Design Kit can help you identify and validate the data submitted by your users. You need to configure the Kit by telling it what data you are expecting.
You can configure the Kit using the
configuration page
or by manually changing the app/config.json
file.
Using the configuration page
You can use the configuration page once you have installed the Data Upload Design Kit into a GOV.UK prototype and run the service in development mode.
Visit the configuration page and change the list of data fields to match the data needed by your service. You can remove existing fields or add new ones.
You can choose the type of data fields to automatically provide validation and helpful messages to your users. The available types are:
Type | Used for | Validation applied |
---|---|---|
text
|
Paragraphs or short sentences; or any field not covered by another type | None |
number
|
Numbers, including monetary values, with and without decimal places |
Supplied value can be unambiguously interpreted as a
number (e.g. 1 or −230 or 0.25 )
|
You can also specify that a field is required or optional. Users will receive an error if they submit any rows that have no value for required fields.
Once you are done, save your changes. The new configuration will
be written to your app/config.json
file. You can
commit
the file to keep the changes and share them with others.
Manually editing the config file
Your app/config.json
file controls the features of
the Data Upload Design Kit. You can manually edit this file
instead of using the configuration page.
Specifying data fields
The fields
property of the configuration file
should be an array of objects that define the fields to be used
in the service.
Each object can have the following properties:
Property | Meaning | Possible values |
---|---|---|
name
|
The name of a data field that will be shown to your users | Any text contained in quotes. You should avoid punctuation although you may use spaces and numbers in the name. The name must be unique. |
type
|
What type of data the field must contain. |
"text" or "number" (see above)
|
required
|
Whether data that does not contain this field will be rejected or not (see above) |
true for required fields or false for optional fields
|
An example set of fields might be:
{ "fields": [ { "name": "Code", "type": "number", "required": true }, { "name": "Name", "type": "text", "required": true }, { "name": "Speciality", "type": "text", "required": false } ] }
Specifying spreadsheet upload path
By default, any spreadsheets that your users upload will be stored in a temporary directory. They may be deleted when the machine is rebooted.
You can change the location of uploaded spreadsheets to be any
other directory by using the uploadPath
configuration option.
An example might be:
{ "uploadPath": "/tmp/my-spreadsheets" }