Flex Code System

A flex code system represents a domain. The flex code definition represents the definition of that domain, the flex codes represent the values in that domain.

The purpose of such a domain is to bind the values of a Field Definitions.

Suppose that you want to extend Oracle Health Insurances Relation table with a dynamic field that contains a person’s occupation. You want to bind possible values to a domain so this dynamic field references a flex code system containing the allowable occupations.

A flex code is not (necessarily) a single value, that is, commonly a flex code is a record of several fields, each field with its own value. For example, a flex code can consist of a code and description field. In this sense, a flex code definition is very similar to a table definition. In a flex code system the columns of the 'table' are defined by flex code field usages. A flex code always keeps track of a start and end date, and the definition to which it belongs.

Flex Code Definitions

Flex Code Definition Overview

Definition

A flex code definition is simply an umbrella under which the pertaining details are persisted that further specify the definition.

Field Description

Code

The identifying code of the flex code definition

Description

A description of this flex code definition

A flex code definition has one or more flex code field usages. Each flex code field usage represents a column in a flex code. Flex code field usages have the following attributes:

Field Description

Name

The unique name of the column (within the code) in the object model

Display name

The column header when the codes are shown in a table view

Display sequence

The column position when the codes are shown in a table view

Field

The data type, length, decimals and other validations that apply

Key?

If checked, then this field is the flex code key field.

Descriptor?

If checked, then this field is the flex code description field.

Mandatory?

If checked, then this field is mandatory for each flex code.

Allowable values

References another flex code definition. The value of this field must be one of the available key field values of the referenced definition.

In our 'Occupation' example you would set up the following flex code definition:

  • Code: OCC

  • Description: Occupation

For each possible occupation, you store two fields: the key, which is a four digit code, and a description, which is a 60 character field. For this purpose, the payer creates two flex fields:

  • Code: C4, Data type: char, Length: 4

  • Code: C60, Data type: char, Length: 60

The last step is to specify the flex code fields, connecting the flex code definition with the flex fields. The payer creates the following two flex code field usages for the POS flex code definition:

  • Code: "occCode", Display name: "Occupation", Display sequence:0, Flex field:C4, Key?: checked, Mandatory?: checked.

    NOTE

    Only character fields are allowed to be used as flex code key fields.

  • Code: "occDescr", Display name: "Description", Display sequence:1, Flex field:C60, Description?: checked, Mandatory?: checked.

You have now set up a complete definition. The next step is to setup the allowed values within this definition, that is, the flex codes. The following rules apply to flex code field usages within the context one flex code definition:

  • Only one field usage can represent the key field.

  • Only one field usage can represent the descriptor field.

  • The key field is always mandatory.

  • The key field is always the first field that is displayed (display sequence 0).

  • The descriptor field is always the second field that is displayed (display sequence 1).

  • Alphanumeric fields (including the key field) can be up to 1000 characters long.

  • Once flex codes exist for a definition, it is no longer allowed to update the Key? indicator or the Allowable Values field. [1]. [2].

  • Once flex codes exist for a definition, it is no longer allowed to create new key and/or descriptor fields.

  • The flex field that represents the key field must be of the character data type.

  • The 'allowable values' attribute may only be set for non-key, non-descriptor fields.

Values

Flex codes represent the actual values that belong to a flex code definition. This entity has no fixed set of attributes, that is, the flex code definition defines the attribute fields.

A flex code always has a start and end date. The start and end date represent the period in which the flex code is a valid value within the domain set out by the flex code definition. It is not allowed for two flex codes within the same flex code definition to have the same key field value at any one point in time.

Flex Code Field Usage

Once the flex code definition and the flex codes have been defined, you need to connect them to the table where you want to use them. You can accomplish this by setting up a new dynamic field usage for the relation table (See Extending Tables). The name of this field is ''primaryOccupation' and the display name is 'Occupation'. The payer sets the type to 'Flex Code' and the flex code system to 'OCCUPATION'.

Because it is possible (and even likely) that a person changes his occupation over time, you choose to make the occupation field time valid, by checking the time valid indicator. The value of the occupation field is not unique, not multi value and not (conditionally) mandatory. You set a condition that imposes that only a person can have an occupation (as opposed to an organization).

As a result, the relation interfaces now show a new field, labeled 'Occupation' that displays the key and the descriptor field, and the start & end date of an occupation. It is possible for a particular person to change an existing occupation or end an existing occupation and choose a new one with a later start date. The occupation also becomes available as an attribute of a relation in the object layer, that is, in groovy dynamic logic scripts.

Flex Code Set

A flex code set is a group of flex code definitions.

Field Description

Code

The identifying code of flex code definition

Description

A description of this flex code definition

List of code definitions

The code definitions that belong tho this set

It is possible for a dynamic field to refer to a flex code set, rather than a flex code definition. If this is the case, then any flex code of any of the definitions under that set is an allowed value for that dynamic field.

Procedure and diagnosis codes are always defined by a flex code set, because the common case is that multiple standards for those codes exist (ICD-9, ICD-10, CPT).

Flex Code Group

A flex code group is a grouping of a number of flex codes that belong to the same flex code definition. You can use flex code groups in dynamic logic, thus reducing the required complexity for the groovy scripts. A flex code group consists of:

Field Description

Code

The identifying code of flex code definition

Description

A description of this flex code definition

Flex Code Definition

The definition to which all flex codes in this group must belong.

List of codes

The flex codes that belong to this group

Consider a scenario where you want to set up a flex code definition for person’s occupations. This flex code definition lists over a hundred occupations, that is, flex codes. You want to divide those occupations over three axis:

  • Indoor versus outdoor

  • Office hours versus irregular hours.

  • Hazardous versus low health risk.

You create six flex code groups: INDOOR, OUTDOOR, OFFICEHOURS, IRREGHOURS, HAZARD and LOWRISK. Each occupation flex code in the flex code definition is assigned to one of the groups on each axis.

As a result, whenever you set up a rule that applies only to persons with hazardous outdoor occupations, the dynamic logic condition that checks this would contain the simple logic: "Is the person’s occupation in both the OUTDOOR and HAZARD flex code group?", rather than listing each occupation flex code that qualifies inside the groovy script.

Flex Code Definitions in Flex Code Definitions

It is possible to use a flex code definition within a flex code definition. Imagine that you want to extend the Occupation Flex Code Definition discussed above with a Risk level. The risk level only allows the values H (high) and L (low), meaning that the risk level itself is also a domain.

Setup Definition

First you create an additional flex field:

  • Code 'C1', Description 'Generic text 1 char', Length 1, Type 'Value', Data type 'Char'

Now create a flex code definition RISK that holds the allowed values for risk. Use the new C1 field to define the Key field of that flex code definition and add the flex codes H (high) and L (low) to the flex code definition.

Add a flex field usage to the Occupation flex code definition

  • Field 'C1', code 'RISK', display name 'Health risk', we specify this field as optional. The Allowable Values attribute of this flex field usage refers to the jsut created flex code definition RISK that only allows the values H (high) and L (low).

The result of our setup is that you have created a virtual table that has three columns.

Codes Table

Now you have updated the definition and field usages, you can update the flex codes.

Code Description Health Risk Start Date End Date

FIRE

Firefighter

H

2009-01-01

n/a

SURG

Surgeon

L

2009-01-01

n/a

PARA

Paramedic

2009-01-01

n/a

Note that you may leave the 'Health risk' field empty because you specified that field to be optional.


1. The system allows setting the Mandatory? indicator even if flex codes exist. Setting the field to mandatory will not check if all current flex codes currently have a value. The check however will apply when the flex code or the record that holds the flex code is updated
2. The system allows updating the Field Code. It allows only updates to field code of the same datatype (CHAR to CHAR, and so on) and an equal or bigger size. Note that a field definition can have a validation logic (see Field Definition page of this chapter. Changing the field code for a flex code will not check if all current flex codes meet the validation condition of the new field definition. The system however will check that validation logic when the flex code or the record that holds the flex code is updated