Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 5e59887

Browse files
Merge pull request #19 from topcoder-platform/enrich
Integrate Enrichment of data feature
2 parents d7da58b + 7e24266 commit 5e59887

File tree

15 files changed

+300
-104
lines changed

15 files changed

+300
-104
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ The following parameters can be set in config files or in env variables:
2929
- GROUPS_MEMBERSHIP_TYPE: the groups membership type that should be processed, default value is 'user'
3030
- ES.HOST: Elasticsearch host, default value is 'localhost:9200'
3131
- ES.AWS_REGION: The Amazon region to use when using AWS Elasticsearch service, default value is 'us-east-1'
32-
- ES.API_VERSION: Elasticsearch API version, default value is '7.4'
3332
- ES.ACHIEVEMENT_PROVIDER_INDEX: Elasticsearch index name for achievement provider, default value is 'achievement_provider'
3433
- ES.ACHIEVEMENT_PROVIDER_TYPE: Elasticsearch index type for achievement provider, default value is '_doc'
3534
- ES.ATTRIBUTE_INDEX: Elasticsearch index name for attribute, default value is 'attribute'
@@ -53,6 +52,16 @@ The following parameters can be set in config files or in env variables:
5352
- ES.USER_SKILL_PROPERTY_NAME: the user property name of skill, default value is 'skills'
5453
- ES.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: the org property name of org skill providers, default value is 'skillProviders'
5554
- ES.USER_GROUP_PROPERTY_NAME: the user property name of group, default value is 'groups'
55+
- ATTRIBUTE_GROUP_PIPELINE_ID: The pipeline id for enrichment with attribute group. Default is `attributegroup-pipeline`
56+
- SKILL_PROVIDER_PIPELINE_ID: The pipeline id for enrichment with skill provider. Default is `skillprovider-pipeline`
57+
- USER_PIPELINE_ID: The pipeline id for enrichment of user details. Default is `user-pipeline`
58+
- ATTRIBUTE_GROUP_ENRICH_POLICYNAME: The enrich policy for attribute group. Default is `attributegroup-policy`
59+
- SKILL_PROVIDER_ENRICH_POLICYNAME: The enrich policy for skill provider. Default is `skillprovider-policy`
60+
- ROLE_ENRICH_POLICYNAME: The enrich policy for role. Default is `role-policy`
61+
- ACHIEVEMENT_PROVIDER_ENRICH_POLICYNAME: The enrich policy for achievement provider. Default is `achievementprovider-policy`
62+
- SKILL_ENRICH_POLICYNAME: The enrich policy for skill. Default is `skill-policy`
63+
- ATTRIBUTE_ENRICH_POLICYNAME: The enrich policy for skill. Default is `attribute-policy`
64+
5665

5766
There is a `/health` endpoint that checks for the health of the app. This sets up an expressjs server and listens on the environment variable `PORT`. It's not part of the configuration file and needs to be passed as an environment variable
5867

@@ -103,15 +112,10 @@ Configuration for the tests is at `config/test.js`, only add such new configurat
103112
```
104113

105114
4. Initialize Elasticsearch index
115+
For this, refer to the [Ubahn API](https://github.com/topcoder-platform/u-bahn-api) repository. In this repository, you need to execute the following script (after following their deployment guide):
106116

107117
```bash
108-
npm run init-es
109-
```
110-
111-
To delete and re-create the index:
112-
113-
```bash
114-
npm run init-es force
118+
npm run insert-data
115119
```
116120

117121
5. Start the processor and health check dropin

config/default.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ module.exports = {
2323
GROUPS_MEMBERSHIP_TYPE: process.env.GROUPS_MEMBERSHIP_TYPE || 'user',
2424

2525
ES: {
26-
HOST: process.env.ES_HOST || 'localhost:9200',
26+
HOST: process.env.ES_HOST || 'http://localhost:9200',
2727
AWS_REGION: process.env.AWS_REGION || 'us-east-1', // AWS Region to be used if we use AWS ES
28-
API_VERSION: process.env.ES_API_VERSION || '7.4',
2928
ACHIEVEMENT_PROVIDER_INDEX: process.env.ACHIEVEMENT_PROVIDER_INDEX || 'achievement_provider',
3029
ACHIEVEMENT_PROVIDER_TYPE: process.env.ACHIEVEMENT_PROVIDER_TYPE || '_doc',
3130
ATTRIBUTE_INDEX: process.env.ATTRIBUTE_INDEX || 'attribute',
@@ -50,6 +49,35 @@ module.exports = {
5049
USER_SKILL_PROPERTY_NAME: process.env.USER_SKILL_PROPERTY_NAME || 'skills',
5150
USER_GROUP_PROPERTY_NAME: process.env.USER_GROUP_PROPERTY_NAME || 'groups',
5251

53-
ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: process.env.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME || 'skillProviders'
52+
ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME: process.env.ORGANIZATION_SKILLPROVIDER_PROPERTY_NAME || 'skillProviders',
53+
54+
ENRICHMENT: {
55+
attributegroup: {
56+
enrichPolicyName: process.env.ATTRIBUTE_GROUP_ENRICH_POLICYNAME || 'attributegroup-policy',
57+
pipelineId: process.env.ATTRIBUTE_GROUP_PIPELINE_ID || 'attributegroup-pipeline'
58+
},
59+
skillprovider: {
60+
enrichPolicyName: process.env.SKILL_PROVIDER_ENRICH_POLICYNAME || 'skillprovider-policy',
61+
pipelineId: process.env.SKILL_PROVIDER_PIPELINE_ID || 'skillprovider-pipeline'
62+
},
63+
user: {
64+
pipelineId: process.env.USER_PIPELINE_ID || 'user-pipeline'
65+
},
66+
role: {
67+
enrichPolicyName: process.env.ROLE_ENRICH_POLICYNAME || 'role-policy'
68+
},
69+
achievementprovider: {
70+
enrichPolicyName: process.env.ACHIEVEMENT_PROVIDER_ENRICH_POLICYNAME || 'achievementprovider-policy'
71+
},
72+
skill: {
73+
enrichPolicyName: process.env.SKILL_ENRICH_POLICYNAME || 'skill-policy'
74+
},
75+
attribute: {
76+
enrichPolicyName: process.env.ATTRIBUTE_ENRICH_POLICYNAME || 'attribute-policy'
77+
},
78+
organization: {
79+
enrichPolicyName: process.env.ORGANIZATION_ENRICH_POLICYNAME || 'organization-policy'
80+
}
81+
}
5482
}
5583
}

docker-kafka-es/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
KAFKA_CREATE_TOPICS: "u-bahn.action.aggregate:1:1,groups.notification.member.add:1:1,groups.notification.member.delete:1:1"
1616
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
1717
esearch:
18-
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
18+
image: elasticsearch:7.7.1
1919
container_name: ubahn-data-processor-es_es
2020
ports:
2121
- "9200:9200"

package-lock.json

Lines changed: 65 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
"superagent": "^5.1.0"
2727
},
2828
"dependencies": {
29+
"@elastic/elasticsearch": "^7.9.1",
2930
"@hapi/joi": "^15.1.0",
3031
"async-mutex": "^0.2.4",
32+
"aws-elasticsearch-connector": "^9.0.0",
3133
"aws-sdk": "^2.476.0",
3234
"bluebird": "^3.5.5",
3335
"config": "^3.1.0",
34-
"elasticsearch": "^16.7.1",
3536
"get-parameter-names": "^0.3.0",
36-
"http-aws-es": "^6.0.0",
3737
"lodash": "^4.17.19",
3838
"no-kafka": "^3.4.3",
3939
"topcoder-healthcheck-dropin": "^1.0.3",

0 commit comments

Comments
 (0)