Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/services/schema-detection/utilities/patterns

lib/services/schema-detection/utilities/patterns

Field pattern matching utilities.

Provides language-aware pattern matching for detecting standard event fields (title, description, timestamp, location) based on column names and data characteristics.

Interfaces

FieldPatternMatch

Result of matching a name against field patterns.

Properties

name

name: string

The name that matched

patternIndex

patternIndex: number

Index of the matched pattern (lower = more specific)

patternCount

patternCount: number

Total patterns checked

isFallback

isFallback: boolean

Whether the match came from the primary language or the English fallback

Variables

FIELD_PATTERNS

const FIELD_PATTERNS: object

Language-specific field name patterns.

Patterns are ordered by specificity - more specific patterns first to ensure higher confidence scores for better matches.

Type Declaration

title

readonly title: object

title.eng

readonly eng: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.deu

readonly deu: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.fra

readonly fra: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.spa

readonly spa: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.ita

readonly ita: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.nld

readonly nld: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

title.por

readonly por: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description

readonly description: object

description.eng

readonly eng: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.deu

readonly deu: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.fra

readonly fra: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.spa

readonly spa: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.ita

readonly ita: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.nld

readonly nld: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

description.por

readonly por: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName

readonly locationName: object

locationName.eng

readonly eng: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.deu

readonly deu: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.fra

readonly fra: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.spa

readonly spa: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.ita

readonly ita: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.nld

readonly nld: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

locationName.por

readonly por: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp

readonly timestamp: object

timestamp.eng

readonly eng: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.deu

readonly deu: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.fra

readonly fra: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.spa

readonly spa: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.ita

readonly ita: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.nld

readonly nld: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

timestamp.por

readonly por: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location

readonly location: object

location.eng

readonly eng: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.deu

readonly deu: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.fra

readonly fra: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.spa

readonly spa: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.ita

readonly ita: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.nld

readonly nld: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]

location.por

readonly por: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp]


LATITUDE_PATTERNS

const LATITUDE_PATTERNS: RegExp[]

Latitude patterns for coordinate detection.

Supports separators: underscore, space, hyphen, dot


LONGITUDE_PATTERNS

const LONGITUDE_PATTERNS: RegExp[]

Longitude patterns for coordinate detection.

Supports separators: underscore, space, hyphen, dot


COMBINED_COORDINATE_PATTERNS

const COMBINED_COORDINATE_PATTERNS: RegExp[]

Combined coordinate patterns.

Recognizes fields that contain both latitude and longitude in a single value.


COORDINATE_BOUNDS

const COORDINATE_BOUNDS: object

Valid coordinate bounds.

Type Declaration

latitude

latitude: object

latitude.min

min: number = -90

latitude.max

max: number = 90

longitude

longitude: object

longitude.min

min: number = -180

longitude.max

max: number = 180


ADDRESS_PATTERNS

const ADDRESS_PATTERNS: RegExp[]

Address patterns for geocoding field detection.

Matches fields that contain textual address information suitable for geocoding.

Functions

matchFieldNamePatterns()

matchFieldNamePatterns(names, fieldType, language): FieldPatternMatch | null

Match a list of field/column names against FIELD_PATTERNS for a given field type and language.

Tries language-specific patterns first, then falls back to English. Returns the first (most specific) match found, or null if no match.

Used by both preview-time detection and background job detection to ensure the pattern-matching portion of field detection uses consistent logic.

Parameters

names

string[]

fieldType

FieldType

language

string

Returns

FieldPatternMatch | null


getFieldPatterns()

getFieldPatterns(fieldType, language, options?): readonly RegExp[]

Get patterns for a field type and language, falling back to English.

When options provide fieldPatterns for the given field type and language, they are prepended to defaults (or replace them if the field type is in replacePatterns).

Single source of truth for pattern selection.

Parameters

fieldType

string

language

string

options?

DetectionOptions

Returns

readonly RegExp[]


detectFieldMappings()

detectFieldMappings(fieldStats, language, options?): FieldMappingsResult

Detect field mappings for all standard fields (structured result with confidence).

Parameters

fieldStats

Record<string, FieldStatistics>

Field statistics from schema builder

language

string

ISO 639-3 language code

options?

DetectionOptions

Optional detection options for customizing behavior

Returns

FieldMappingsResult

Field mappings result with confidence scores

Last updated on