This chapter is about the data model used in AsTeRICS Grid.
- Introduction
- Data models saved to database
- Data models not saved to database
- Common data model properties
- Full and short objects
The development of AsTeRICS Grid started in 2018 when TypeScript wasn't the standard choice for type-safety in web development. That's why ObjectModel for the data model of AsTeRICS Grid. It allows to define data models and perform dynamic checks on their validity. At some point ObjectModel
should be replaced by TypeScript
or ES6
classes. Some newer developments already use ES6 classes instead of ObjectModel, e.g. the model SettingsApp.
Data models defined for AsTeRICS Grid can be found in the folder src/js/model. These are the data models which are actually saved to database:
- GridData: model for a grid, containing a list of GridElement objects
- MetaData: model for global data, includes various grid-independent data, e.g. InputConfig, ColorConfig, config about integrations.
- Dictionary: saves the configuration of a predictionary wordlist, a dictionary shown in the manage dictionaries view
- EncryptedObject: contains any of the data model objects above serialized as JSON object and encrypted using the sjcl crypto library. In fact every object saved to database is an EncryptedObject containing one of the data model objects listed above.
These are some data models which are part of one of the data models above, but aren't independently saved to database:
- GridElement: data model for a single grid element, containing label, image and corresponding GridAction objects
- AdditionalGridFile: generic file that is saved within GridData, e.g. an AsTeRICS ARE model
- GridActionARE: data model for an asterics action
- GridActionCollectElement: data model for a collect element action
- GridActionNavigate: data model for a navigate to other grid action
- GridActionPredict: data model for a fill prediction elements action
- GridActionSpeak: data model for a speak label action
- GridActionSpeakCustom: data model for a custom speak action
- InputConfig: part of MetaData, containing all input config options (e.g. scanning, hovering)
All data models have these properties in common:
- id [String]: unique ID of the object
- modelName [String]: name of the data model, same as the class filename defining it, e.g. GridData
- modelVersion [String]: version of the data model using semantic versioning, e.g.
1.0.0
EncryptedObject has the following two additional properties:
- encryptedDataBase64: contains the encrypted version of the serialized JSON object which this EncryptedObject actually holds
- encryptedDataBase64Short: contains the same encrypted serialized JSON object, but all properties longer than 500 characters are removed. This "short" version of the object can be used if not all data is needed, e.g. no image data of grids, but only short data items like the label. The property
encryptedDataBase64Short
is empty (null
), if it's the same asencryptedDataBase64
(no long properties) in order to save disk space.
The GridData
data model contains a property isShortVersion
which indicates that the current object includes only a short, stripped version of the data, if set to true
. These short versions of GridData objects are used for the list of grids in the manage grids view since there the only properties that are needed are label
and id
.