Topic
Model​
- Typescript
- Python
watchmen-web-client/src/services/data/tuples/topic-types.ts
export enum TopicKind {
SYSTEM = 'system',
BUSINESS = 'business'
}
export enum TopicType {
RAW = 'raw',
META = 'meta',
DISTINCT = 'distinct',
AGGREGATE = 'aggregate',
TIME = 'time',
RATIO = 'ratio'
}
export type TopicId = string;
export interface Topic extends Tuple {
topicId: TopicId;
name: string;
kind: TopicKind;
type: TopicType;
description?: string;
factors: Array<Factor>;
tenantId?: TenantId;
dataSourceId?: DataSourceId;
}
watchmen-web-client/src/services/data/tuples/factor-types.ts
export enum FactorType {
SEQUENCE = 'sequence',
NUMBER = 'number',
UNSIGNED = 'unsigned', // 0 & positive
TEXT = 'text',
// address
ADDRESS = 'address',
CONTINENT = 'continent',
REGION = 'region',
COUNTRY = 'country',
PROVINCE = 'province',
CITY = 'city',
DISTRICT = 'district',
ROAD = 'road',
COMMUNITY = 'community',
FLOOR = 'floor',
RESIDENCE_TYPE = 'residence-type',
RESIDENTIAL_AREA = 'residential-area',
// contact electronic
EMAIL = 'email',
PHONE = 'phone',
MOBILE = 'mobile',
FAX = 'fax',
// date time related
DATETIME = 'datetime', // YYYY-MM-DD HH:mm:ss
FULL_DATETIME = 'full-datetime', // YYYY-MM-DD HH:mm:ss.SSS
DATE = 'date', // YYYY-MM-DD
TIME = 'time', // HH:mm:ss
YEAR = 'year', // 4 digits
HALF_YEAR = 'half-year', // 1: first half, 2: second half
QUARTER = 'quarter', // 1 - 4
MONTH = 'month', // 1 - 12
HALF_MONTH = 'half-month', // 1: first half, 2: second half
TEN_DAYS = 'ten-days', // 1, 2, 3
WEEK_OF_YEAR = 'week-of-year', // 0 (the partial week that precedes the first Sunday of the year) - 53 (leap year)
WEEK_OF_MONTH = 'week-of-month', // 0 (the partial week that precedes the first Sunday of the year) - 5
HALF_WEEK = 'half-week', // 1: first half, 2: second half
DAY_OF_MONTH = 'day-of-month', // 1 - 31, according to month/year
DAY_OF_WEEK = 'day-of-week', // 1 (Sunday) - 7 (Saturday)
DAY_KIND = 'day-kind', // 1: workday, 2: weekend, 3: holiday
HOUR = 'hour', // 0 - 23
HOUR_KIND = 'hour-kind', // 1: work time, 2: off hours, 3: sleeping time
MINUTE = 'minute', // 0 - 59
SECOND = 'second', // 0 - 59
MILLISECOND = 'millisecond', // 0 - 999
AM_PM = 'am-pm', // 1, 2
// individual
GENDER = 'gender',
OCCUPATION = 'occupation',
DATE_OF_BIRTH = 'date-of-birth', // YYYY-MM-DD
AGE = 'age',
ID_NO = 'id-no',
RELIGION = 'religion',
NATIONALITY = 'nationality',
// organization
BIZ_TRADE = 'biz-trade',
BIZ_SCALE = 'biz-scale',
BOOLEAN = 'boolean',
ENUM = 'enum',
OBJECT = 'object',
ARRAY = 'array',
}
export enum FactorEncryptMethod {
NONE = 'none',
AES256_PKCS5_PADDING = 'AES256-PKCS5-PADDING',
MD5 = 'MD5',
SHA256 = 'SHA256',
MASK_MAIL = 'MASK-MAIL',
MASK_CENTER_3 = 'MASK-CENTER-3',
MASK_CENTER_5 = 'MASK-CENTER-5',
MASK_LAST_3 = 'MASK-LAST-3',
MASK_LAST_6 = 'MASK-LAST-6',
MASK_DAY = 'MASK-DAY',
MASK_MONTH = 'MASK-MONTH',
MASK_MONTH_DAY = 'MASK-MONTH-DAY'
}
export type FactorId = string;
export type FactorIndexGroup =
'i-1' | 'i-2' | 'i-3' | 'i-4' | 'i-5' | 'i-6' | 'i-7' | 'i-8' | 'i-9' | 'i-10'
| 'u-1' | 'u-2' | 'u-3' | 'u-4' | 'u-5' | 'u-6' | 'u-7' | 'u-8' | 'u-9' | 'u-10';
export interface Factor {
factorId: FactorId;
name: string;
label: string;
type: FactorType;
enumId?: EnumId;
defaultValue?: string;
indexGroup?: FactorIndexGroup;
// will be flatten to table column or not, only used in raw topic, and must be top level factor
flatten?: boolean;
encrypt?: FactorEncryptMethod;
description?: string;
createTime: DateTime;
lastModified: DateTime;
}
(under construction)