From 24b2d1de3a382ae808ec0b668e0a5b81e073df7f Mon Sep 17 00:00:00 2001 From: NatalieShaked Date: Wed, 12 Feb 2025 14:01:02 +0200 Subject: [PATCH 1/4] docs: updated README.md file --- README.md | 69 ++++++++++++------------------------------------------- 1 file changed, 15 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index b2d92b9..a0c3337 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,19 @@ -# Map Colonies typescript service template - ----------------------------------- - -This is a basic repo template for building new MapColonies web services in Typescript. - -### Template Features: - -- eslint configuration by [@map-colonies/eslint-config](https://github.com/MapColonies/eslint-config) - -- prettier configuration by [@map-colonies/prettier-config](https://github.com/MapColonies/prettier-config) - -- jest - -- .nvmrc - -- Multi stage production-ready Dockerfile - -- commitlint - -- git hooks - -- logging by [@map-colonies/js-logger](https://github.com/MapColonies/js-logger) - -- OpenAPI request validation - -- config load with [node-config](https://www.npmjs.com/package/node-config) - -- Tracing and metrics by [@map-colonies/telemetry](https://github.com/MapColonies/telemetry) - -- github templates - -- bug report - -- feature request - -- pull request - -- github actions - -- on pull_request - -- LGTM - -- test - -- lint - -- snyk +# Geocoding-Enrichment +This service provides enrichment of the data that comes from MapColonie's [geocoding service](https://github.com/MapColonies/Geocoding), and saves the enriched data to elastic for BI purposes. ## API Checkout the OpenAPI spec [here](/openapi3.yaml) -userData Service:
+## Workflow +![Workflow Image](https://github.com/user-attachments/assets/0152dcb5-ece7-42a2-b630-116eaec6181d) + +## How does it work? +Once the requesting system sends the `request_id`, the `chosen_response_id`, and the `user_id` of the user who used [Geocoding](https://github.com/MapColonies/Geocoding) back to us using [Feedback api](https://github.com/MapColonies/feedback-api), that response is then combined with Geocoding's response and sent to Kafka, which then is consumed by Geocoding-enrichment.
+Once the response reaches geocoding-enrichment, the service then attaches the `chosen_response_id` to the geocoding response to see what response the user selected.
+In addition to adding some data to the response, The service also uses the userData service in order to fetch the user's data and see who uses Geocoding.
+Once the data is enriched, it is stored in Elasticsearch which is connected to a Grafana Dashboard in order to be analyzed. + +## UserData Service: We use 3rd party software in order to extract user details from the userId. Here is a mock service that will preduce the somewhat expected response from the userData Service. ``` const express = require('express'); @@ -62,7 +24,7 @@ app.set('port', 5000); app.use(express.json({ limit: '50mb' })); app.use(express.urlencoded({ limit: '50mb', extended: true })); -app.get("/mirage/:userid", (req, res) => { +app.get("/user_data/:userid", (req, res) => { console.log("new request", req.params, req.query); const { userid } = req.params; const users = { @@ -101,15 +63,14 @@ Clone the project ```bash -git clone https://link-to-project - +git clone https://github.com/MapColonies/Geocoding-Enrichment.git ``` Go to the project directory ```bash -cd my-project +cd geocoding-enrichment ``` From 21fa3621a988785d36ac8398e492097807a41557 Mon Sep 17 00:00:00 2001 From: NatalieShaked Date: Wed, 12 Feb 2025 14:31:51 +0200 Subject: [PATCH 2/4] chore: changed some details --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a0c3337..805cd8c 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ Checkout the OpenAPI spec [here](/openapi3.yaml) ## How does it work? Once the requesting system sends the `request_id`, the `chosen_response_id`, and the `user_id` of the user who used [Geocoding](https://github.com/MapColonies/Geocoding) back to us using [Feedback api](https://github.com/MapColonies/feedback-api), that response is then combined with Geocoding's response and sent to Kafka, which then is consumed by Geocoding-enrichment.
-Once the response reaches geocoding-enrichment, the service then attaches the `chosen_response_id` to the geocoding response to see what response the user selected.
+When the response reaches geocoding-enrichment, the service then attaches the `chosen_response_id` to the geocoding response to see what response the user selected.
In addition to adding some data to the response, The service also uses the userData service in order to fetch the user's data and see who uses Geocoding.
Once the data is enriched, it is stored in Elasticsearch which is connected to a Grafana Dashboard in order to be analyzed. ## UserData Service: -We use 3rd party software in order to extract user details from the userId. Here is a mock service that will preduce the somewhat expected response from the userData Service. +We use an external ADFS in order to extract user details from the userId. Here is a mock service that will preduce the somewhat expected response from the userData Service. ``` const express = require('express'); From 6e33d1ef487de36de6091e9719292da12e0357cb Mon Sep 17 00:00:00 2001 From: NatalieShaked Date: Wed, 12 Feb 2025 14:34:59 +0200 Subject: [PATCH 3/4] fix: release on tag push workflow --- .github/workflows/release-on-tag-push.yaml | 45 +++------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release-on-tag-push.yaml b/.github/workflows/release-on-tag-push.yaml index 9638084..78632b4 100644 --- a/.github/workflows/release-on-tag-push.yaml +++ b/.github/workflows/release-on-tag-push.yaml @@ -1,44 +1,11 @@ name: "Publish release on tag push" on: - workflow_call: - inputs: - enableOpenApiToPostman: - description: "Flag to enable OpenAPI to Postman collection conversion" - type: boolean - required: false - default: true + push: + tags: + - "v*" jobs: - publish_release: - runs-on: ubuntu-latest - steps: - - name: Checkout code for CHANGELOG.md - uses: actions/checkout@v4 - - - name: Get package info - id: package - uses: codex-team/action-nodejs-package-info@v1 - - - name: Generate postman collection for service - uses: actions/setup-node@v2 - with: - node-version: "20" - - - name: Set File name - uses: myci-actions/export-env-var@1 - with: - name: P_COLLECTION_FILE_NAME - value: ${{ steps.package.outputs.name }}-v${{ steps.package.outputs.version }}-postman-collection.json - - - name: Generate Postman Collection - if: ${{ inputs.enableOpenApiToPostman == true }} - run: "npx openapi-to-postmanv2 -s openapi3.yaml -o ${{ env.P_COLLECTION_FILE_NAME }}" - - - name: Publish Release to Github - uses: softprops/action-gh-release@v1 - with: - body_path: CHANGELOG.md - files: ${{ env.P_COLLECTION_FILE_NAME }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + release_on_tag_push: + uses: MapColonies/shared-workflows/.github/workflows/release-on-tag-push.yaml@master + secrets: inherit From 46640c5ff1f3f19b9dcc7f3109b2c5c1c886eaac Mon Sep 17 00:00:00 2001 From: Niv Greenstein Date: Wed, 12 Feb 2025 18:45:58 +0200 Subject: [PATCH 4/4] Update release-on-tag-push.yaml --- .github/workflows/release-on-tag-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-on-tag-push.yaml b/.github/workflows/release-on-tag-push.yaml index 78632b4..3905ecb 100644 --- a/.github/workflows/release-on-tag-push.yaml +++ b/.github/workflows/release-on-tag-push.yaml @@ -7,5 +7,5 @@ on: jobs: release_on_tag_push: - uses: MapColonies/shared-workflows/.github/workflows/release-on-tag-push.yaml@master + uses: MapColonies/shared-workflows/.github/workflows/release-on-tag-push.yaml@v3.1.0 secrets: inherit