A derived property is a special kind of property whose values derive from one or more data fields or other properties, using a mathematical, mapping or similar operation. See which entities support derived properties.
Note: Unlike standard properties, you do not explicitly attach derived properties to entities and specify values. Rather, LUSID automatically calculates values when you choose to retrieve entities with their derived properties.
You can use derived properties to curate a 'golden source' representation of your reference data. Consider the following example, of instruments loaded into LUSID from two different data vendors. Data relating to domicile from each vendor has been mapped to two (standard) properties, represented by the country_issue and origin columns. We can see that the same countries are represented using different values, and that some values are missing:
Because it seems likely this information has the same meaning, we can create a Domicile derived property that automatically maps and coalesces country_issue and origin values to a new, normalised set. This derived property can subsequently be used for reporting purposes, or for consumption by a downstream system, without having altered the original data:
Working with derived properties
- The first step is to construct a derivation formula. For example, the Domicile derived property above might have a formula that uses the
coalesceoperations like this:
map(coalesce(Properties[Instrument/VendorA/country_issue], Properties[Instrument/VendorB/origin], 'Unknown'): 'United Kingdom'='UK', 'united_kingdom'='UK', 'Great Britain'='UK', 'GB'='UK', 'DE'='Germany', 'United States'='USA', 'usa'='USA', default='Unknown')
For information on syntax, available operations, and which data fields and properties you can derive from, see this article.
- The next step is to create a derived property type that stores the derivation formula and defines other characteristics such as the entity type to which derived properties belong.
- The final step is to cause LUSID to automatically calculate derived property values by retrieving entities with their derived properties.