terriajs
Version:
Geospatial data visualization platform.
101 lines (92 loc) • 3.73 kB
text/typescript
import CatalogMemberTraits from "./CatalogMemberTraits";
import EnumDimensionTraits from "./DimensionTraits";
import GroupTraits from "./GroupTraits";
import mixTraits from "../mixTraits";
import ModelTraits from "../ModelTraits";
import objectArrayTrait from "../Decorators/objectArrayTrait";
import primitiveTrait from "../Decorators/primitiveTrait";
import UrlTraits from "./UrlTraits";
import LegendOwnerTraits from "./LegendOwnerTraits";
export class ReplaceStringTraits extends ModelTraits {
find?: string;
replace?: string;
}
export type ModelOverrideType =
| "region"
| "region-type"
| "unit-measure"
| "unit-multiplier"
| "frequency";
/**
* Notes on region mapping:
* RegionType is determined by sdmxJsonDataflowStratum.column in this order:
* - `modelOverrideTraits.regionType`
* - if `modelOverrideTraits.type === 'region'` and there exists another modelOverrideTraits with `type === 'region-type'` in the datastructure, then region-type will be set from its corresponding dimension
* - the dimension id
* - the codelist name
* - the codelist id (the actual string, not URN form)
* - the concept name
* - the concept id (the actual string, not URN form)
*
* Then regionTypeReplacements are applied (which can replace regionType with a different regionType - using [{find:string, replace:string}] pattern)
*/
export class ModelOverrideTraits extends mixTraits(EnumDimensionTraits) {
id?: string;
- 'region-type': values contains region types - eg 'CNT2' which is 2-letter country codes)
- 'unit-measure': values should be used to describe primary-measure (eg in chart title)
- 'unit-multiplier': multiply primary-measure value by atrtibute values
- 'frequency': value used to determine time period frequency (ie. yearly, monthly...)`
})
type?: ModelOverrideType;
regionType?: string;
regionTypeReplacements?: ReplaceStringTraits[];
}
export default class SdmxCommonTraits extends mixTraits(
UrlTraits,
CatalogMemberTraits,
LegendOwnerTraits,
GroupTraits
) {
modelOverrides?: ModelOverrideTraits[];
}