Click or drag to resize
* The Structure File

[This is preliminary documentation and is subject to change.]

The structure file defines the relationship between the forms in a configuration.

Because there is a 1:1 correspondence between forms and generated database tables, the structure file indirectly defines the structure in the database (relationship between database tables).

Note Note

The structure file defines the "dynamic" data model in the database (the part of the data model that varies from application to application).

The TOPiCA framework defines the "static" data model (that is used for the built-in functionality organization, users/employees, patients, etc.)

This topic contains the following sections.

Location of the structure file

The structure file is located in the Structure folder inside the configuration folder. Normally there is one and only one structure file in a configuration (this file should be named Structure.xml). However, for debugging purposes it is possible to have multiple structure files.

Editing the structure file

The structure file is typically edited using the editor built into TOPICA. In this way you may edit the structure file using a web interface, i.e. it is possible to edit the file without having access to the file system of the web server, where TOPICA runs.

If you do have access to the web server file system (or choose to use the download/upload facilities in TOPICA, you may edit the structure file using any XML editing tool.

Refer to editing tools for descripton of pros and cons of these editing methods.

What the structure file defines

The structure file mainly consists of StructureElement items. Each StructureElement defines:

  • Name of the generated database tables.

  • Captions and icons displayed in the user interface.

  • Relationship between the generated database tables (e.g. 1:1 or 1:N).

    In order to implement these relationships, TOPICA generates fields in the tables used for referring to the parent tables ("foreign keys").

    Example: If table "Child" is defined hierachically "below" table "Parent", the table "Child" will contain a field "Parent_ID".

The structure file by it self does NOT define the fields of the tables. The fields are defined by the form files referenced by each StructureElement.

StructureElement nodes may contain computations. See Computation Reference. These computations define among other things:

Data in the tables defined in the Data Dictionary is called "records". Records have relations to tables besides those defined in the Data Dictionary - so called "external" tables". "External" means "external to the Data Dictionary". The tables in question are tables in TOPICA's static data model.

  • In TOPICA releases prior to 4.23, each record has one relation to the "Patient" table, and one relation to the "OrgUnit" table.

  • In TOPICA releases 4.24 and newer, the configurator may define all releations to external tables. There must still be exactly one relation to "Patient", but is is possible to define 0..N relations to "OrgUnit" per table. That is: records in one table may have no relation to "OrgUnit", records in some other table may have 1, records in a third table may have 2, etc.

Applying changes

After editing the structure file you must update the Data Dictionary to apply changes.

Updating Data Dictionary might be thought of as a kind of "compile step". Input is the structure file and all forms referenced from the structure file. Output is (updated) physical data model in database AND (updated Data Dictionary (that holds meta data on the physical data model and information from the structure file).

Caution note Caution

Beware of data loss. The Data Dictionary update process modifies the physical data model to make it fit the data model described in the structure file and forms.

If tables are deleted (or renamed) in the structure file, the corresponding tables in the database will be dropped!

If fields are deleted (or renamed) in forms, the corresponding fields in the database will be dropped!