Skip to main content
Version: 2024

Model enrichments

Introduction to model enrichments

Model enrichments are actions that automate parts of your manual workflows. An enrichment can jump-start the work on your application before you start with manual fine-tuning.

tip

Use a dynamic model if you want your actions to be executed during every generation. See also Dynamic model.

The Software Factory comes with a number of ready-made enrichments. For more information, see Available enrichments.

In addition, you can build your own model enrichments. For example:

  • A subroutine for an API connection that always contains a few standard parameters as well as a few extra that can be added manually.
  • Base tables that always comply with a certain format.
  • Prefilters that are often used in the entire system.
  • Check if values and units are always on the same line; if not, correct that if needed..
  • Formatting name and address details in a consistent way.

Types of model enrichments

Enrichments can be model-driven, data-driven, or AI-powered. Or a combination of these.

A model-driven enrichment will query the model and then create (potential) model updates. It can be used to check, for example, the consistency in your application. You can re-run it on a need-to basis.

A data-driven enrichment will prompt you for a runtime configuration when you start it. It queries the database to load the information required to present the model updates. Examples of this type of enrichment include generating missing indexes, creating mock data based on table content, and deriving control types and elements from data in the database.

An AI-powered enrichment will use the configured generative AI provider of the Software Factory to retrieve information from a large language model. Examples include generating descriptions, translations, comments, etc. See also Enable generative AI.

Available model enrichments

The following model enrichments are available in the Software Factory.

GroupNameDescription
Data modelCreate a sample data model with AISwiftly generates a sample data model using AI. The provided application description will be used to create a diagram with tables, columns, and references.
Data modelSuggest unique indexes when the data is uniqueReads all non-primary key columns of tables and suggests a unique index when the data is unique.
FunctionalityTemplate summarizationSummarizes control procedure templates that do not yet have a description. Using AI, the summary will be generated based on the inspected code.
User interfaceTranslate all untranslated objectsUses generative AI to update the translations of untranslated objects.
User interfaceCreate prefilters for checkboxesGenerates prefilters for columns that use a checkbox domain.
User interfaceCreate prefilters for image combo'sGenerates prefilters for every column that uses an image combo domain.
Unit testCreate mock data table from test databaseReads the contents of a given table and converts it into a mock data set that can be used for unit tests.

Use a model enrichment

The Software Factory comes with a number of ready-made model enrichments.

tip

In the execution overview of each model enrichment, you will find an instruction or explanation specific for that enrichment.

We will demonstrate how to use a model enrichment with an example. Create sample model data with AI is one of the available model enrichments. It swiftly generates a sample data model using AI. It uses the application description that you provide to create a diagram with tables, columns, and references.

menu Enrichment > Model enrichments > tab Enrich model > tab Select enrichment

  1. Select the enrichment Create sample model data with AI.

    Enrichments list Select an enrichment

  2. Execute the task Create enrichment run . The focus changes to the tab Run enrichment.

  3. Add a description of the data model that you want to create. Other enrichments require different input.

  4. Execute the task Generate model updates .

  5. Select the model updates that you want to execute from the list.

Model updates Select the model updates you want to execute

  1. Execute the task Execute model updates .

Once all the updates have been performed, the enrichment run is closed.

If any actions remain open, you will be prompted whether to close the run or to execute additional actions. To continue, you can select and execute all the actions that have not been completed yet. The enrichment run will end once all the actions have been executed or if you end it manually.

Re-run a model enrichment

menu Enrichment > Model enrichments > tab Enrich model > tab Select enrichment

You cannot rerun a closed enrichment run. To execute it again, Cancel it in the tab Select enrichment.

Create a model enrichment

tip

Check the available model enrichments for inspiration and as examples.

Create a model-driven enrichment

You can create your own model enrichments.

The following steps apply to all the types of model enrichments:

menu Enrichment > Model enrichments > tab Maintenance > tab Form > tab Enrichment

  1. Enter a title and instruction for your enrichment.

  2. Select a group. You can use the available groups or create your own using the lookup.

  3. If necessary for your enrichment, add user input parameters in the tab Parameters. The values for these parameters must be provided when the enrichment is run. For example, if you create an enrichment that adds a new prefilter, you could include the prefilter name in a parameter. Parameters can have default values. A default query can even fill them. Parameters can be Mandatory and Multiline.

    Add parameters to your enrichment

  4. Add a template in the tab Templates. You can use model update parameters in the description of a template. That way, you can see which action is being carried out. For example, an enrichment that adds a prefilter to records if they are between a specific start date and end date could have the following description: 'Add prefilter for table @tab_id'.

Example template

This is an enrichment that adds a new prefilter:

-- Create prefilter
insert into tab_prefilter
(
model_id,
branch_id,
tab_id,
tab_prefilter_id,
type_of_prefilter,
insert_user,
insert_date_time,
update_user,
update_date_time
)
values
(
@model_id,
@branch_id,
@tab_id,
@tab_prefilter_id,
0,
dbo.tsf_user(),
sysdatetime(),
dbo.tsf_user(),
sysdatetime()
)
  1. Now, create a model update query in the tab Form > Model update. When you create a new one, an example query is added to the tab Model update.

Example model update query


-- Available variables
-- @model_id - Name of the current model
-- @branch_id - Name of the current branch
-- @enrichment_id - Name of the current enrichment
-- Additional user input variables will also be available

/*
insert into #model_update
(
model_update_id,
template_id,
default_active,
order_no,
parent_model_update_id
)
select
'@enrichment_id',
'@enrichment_id',
1,
10,
null

insert into #model_update_parmtr
(
model_update_id,
parmtr_id,
parmtr_value
)
select
'@enrichment_id',
'TAB',
tab_id
from tab
where model_id = @model_id
and branch_id = @branch_id
and tab_id = 'example'
*/
  • Add the potentially executed updates to the table #model_update.
  • The table #model_update_parmtr contains the parameters that are used by the template.
  • The column parent_model_update_id can be used to set dependencies between model updates. If set, the model update can only be selected when the parent update is also selected. If the parent_model_update_id is set but does not refer to an actual model update, the dependency will be ignored.
  • It is possible to use is_truthy to validate truthy input, such as true, yes, and 1. A value is considered truthy when it is not literally true but is evaluated as true. If you are adding parameters to your enrichments that accept true or false values, use this function to validate the input. It will return 1 for truthy input or 0 otherwise. For example: set @no_yes = is_truthy(@parmtr_value)
tip

You can also use the is_truthy function in any other query running on the Software Factory database, such as the dynamic model and control procedure code.

Create a data-driven enrichment

A data-driven model enrichment follows the same steps as the model-driven enrichment. In addition, to make it a data-driven enrichment:

menu Enrichment > Model enrichments > tab Maintenance > tab Form

  1. Select the checkbox Data driven.
  2. The tab Database code contains a query field with instructions on how to set up the database query. While constructing this query, you can use generic variables (@model_id, @branch_id, @enrichment_id) and any user variables specific to the enrichment.

With the database query, you can retrieve a temporary table with key-value pairs from the database. The pairs can consist of raw values, such as table_id as the key and a counter as the value, or a JSON object as the key and a JSON object as the value for more complex use cases.

You can use the key-value pairs in the subsequent AI-powered step or the step that prepares the model updates. These steps are built with knowledge of the contents of the key-value structure.

Create a data-driven enrichment

Create an AI-powered enrichment

note

Make sure that you have enabled generative AI. See Enable generative AI.

An AI-powered enrichment follows the same steps as the model-driven enrichment. In addition, to make it an AI-powered enrichment:

menu Enrichment > Model enrichments > tab Maintenance > tab Form

  1. Select the checkbox AI powered.
  2. The tab AI completion prompts contains a query field with instructions on how to set up the AI query. While constructing this query, you can use generic variables (@model_id, @branch_id, @enrichment_id), in addition to the temporary key-value table retrieved from the database, if applicable.

You can use the AI query to set up a temporary table with key-prompt pairs. This query can access the model as well. The prompts will then be executed using the generative AI provider. The subsequent query that prepares the model updates can use the completions for each key retrieved from the generative AI provider.

Create an AI-powered enrichment

Was this page helpful?