GetCDMTableId¶
Looks up a value in a CDM table by key and replaces the input with the matching value.
Maps the input using two fields in a single CDM table — one acts as a key, the other as a value. If the input matches the key, it is replaced with the corresponding value. If the key cannot be found and no default is given, the record mapping fails.
A common use is to map IDs in a source table to IDs in the OMOP CDM. The
best practice is to store the source ID in <table>_source_value and the
CDM table id in <table>_id; these are the default key and value field
names used when only the table is specified.
Parameters¶
Default fields, optional default value¶
- 1 —
tableMandatory — accepts: table -
The CDM table to collect the key and value from, in
@-notation. With this form the key field defaults to<table_name>_source_valueand the value field to<table_name>_id. - 2 —
defaultOptional — accepts: any -
A default value used when the key cannot be found. The type must match the value field's type.
Explicit key/value fields¶
- 1 —
tableMandatory — accepts: table -
The CDM table, in
@-notation. - 2 —
keyMandatory — accepts: field -
The key field on the CDM table, in
:-notation. - 3 —
valueMandatory — accepts: field -
The value field on the CDM table, in
:-notation. - 4 —
defaultOptional — accepts: any -
Default value used when the key cannot be found. The type must match the value field's type.
Input type¶
The input type must match the type of the key field.
Output type¶
The output type matches the type of the value field.
Requires¶
- The table used must exist.
- Either both the key and value field are specified or neither is.
- Both fields must be available in the table.
- If a default value is set, its type must match that of the value.
Examples¶
Default fields (<table>_source_value, <table>_id)
Explicit key and value fields
Default value when key not found
Explicit fields with default