abp-blueprint
Version:
RoadieJS blueprint to support Ordnance Survey's AddressBase Premium
279 lines (241 loc) • 6.33 kB
JSON
[
{
"element": "schema",
"id": "streets",
"config": {
"key": "usrn",
"fields": {
"usrn": { "type": "Long", "required": true },
"swaOrgRefNaming": { "type": "Number", "required": true },
"state": { "type": "Number", "required": false },
"stateDate": { "type": "Date", "required": false },
"streetSurface": { "type": "Number", "required": false },
"streetClassification": { "type": "Number", "required": false },
"version": { "type": "Number", "required": true },
"streetStartDate": { "type": "Date", "required": true },
"streetEndDate": { "type": "Date", "required": false },
"lastUpdateDate": { "type": "Date", "required": false },
"entryDate": { "type": "Date", "required": true },
"streetStartX": { "type": "Number", "required": true },
"streetStartY": { "type": "Number", "required": true },
"streetEndX": { "type": "Number", "required": true },
"streetEndY": { "type": "Number", "required": true },
"streetTolerance": { "type": "Number", "required": true },
"_primaryLabel": {"type": "String", "required": true},
"_secondaryLabel": {"type": "String", "required": false}
},
"search": {
"complete": {
"inputPath": "doc._primaryLabel"
},
"standardFields": {
"category": {
"literal": "gazetteer"
},
"subCategory": {
"literal": "Streets"
},
"title": {
"path": "doc._primaryLabel"
},
"openWith": {
"flowTemplateId": "maintainStreet"
}
}
}
}
},
{
"element": "docTask",
"id": "restructureDescriptors",
"parent": "schema.streets",
"config": {
"taskName": "collectionToObject",
"options": {
"source": "doc.descriptors",
"target": "context._descriptors",
"strategy": {
"type": "uniqueKey",
"key": "language"
}
}
}
},
{
"element": "docTask",
"id": "primaryDescriptor",
"parent": "schema.streets",
"config": {
"taskName": "coalesce",
"options": {
"valuePaths": [
"context._descriptors.ENG",
"context._descriptors.CYM",
"context._descriptors.GAE"
],
"target": "context._primaryDescriptor"
}
}
},
{
"element": "docTask",
"id": "makePrimaryParts",
"parent": "schema.streets",
"config": {
"taskName": "makeArray",
"options": {
"target": "context._primaryParts",
"values": [
{
"sourceType": "field",
"source": "context._primaryDescriptor.streetDescription"
},
{
"sourceType": "field",
"source": "context._primaryDescriptor.localityName"
},
{
"sourceType": "field",
"source": "context._primaryDescriptor.townName"
},
{
"sourceType": "field",
"source": "context._primaryDescriptor.administrativeArea"
}
]
}
}
},
{
"element": "docTask",
"id": "prunePrimaryParts",
"parent": "schema.streets",
"config": {
"taskName": "prune",
"options": {
"arrayPath": "context._primaryParts",
"remove": {
"level": "whitespace",
"turnEmptyArrayUndefined": true
},
"duplicates": {
"matching": {
"caseSensitive": false,
"level": "punctuation"
},
"remove": {
"level": "adjacent"
}
}
}
}
},
{
"element": "docTask",
"id": "makePrimaryLabel",
"parent": "schema.streets",
"config": {
"taskName": "setValue",
"options": {
"target": "doc._primaryLabel",
"function": {
"name": "concat",
"options": {
"arrayPath": "context._primaryParts",
"delimiter": ", ",
"maxSize": 3,
"fill": "fromStart"
}
}
}
}
},
{
"element": "docTask",
"id": "secondaryDescriptor",
"parent": "schema.streets",
"config": {
"taskName": "coalesce",
"options": {
"valuePaths": [
"context._descriptors.ENG",
"context._descriptors.CYM",
"context._descriptors.GAE"
],
"occurrence": 2,
"target": "context._secondaryDescriptor"
}
}
},
{
"element": "docTask",
"id": "makeSecondaryParts",
"parent": "schema.streets",
"config": {
"taskName": "makeArray",
"options": {
"target": "context._secondaryParts",
"values": [
{
"sourceType": "field",
"source": "context._secondaryDescriptor.streetDescription"
},
{
"sourceType": "field",
"source": "context._secondaryDescriptor.localityName"
},
{
"sourceType": "field",
"source": "context._secondaryDescriptor.townName"
},
{
"sourceType": "field",
"source": "context._secondaryDescriptor.administrativeArea"
}
]
}
}
},
{
"element": "docTask",
"id": "pruneSecondaryParts",
"parent": "schema.streets",
"config": {
"taskName": "prune",
"options": {
"arrayPath": "context._secondaryParts",
"remove": {
"level": "whitespace",
"turnEmptyArrayUndefined": true
},
"duplicates": {
"matching": {
"caseSensitive": false,
"level": "punctuation"
},
"remove": {
"level": "adjacent"
}
}
}
}
},
{
"element": "docTask",
"id": "makeSecondaryLabel",
"parent": "schema.streets",
"config": {
"taskName": "setValue",
"options": {
"target": "doc._secondaryLabel",
"function": {
"name": "concat",
"options": {
"arrayPath": "context._secondaryParts",
"delimiter": ", "
}
}
}
}
}
]