Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 6 additions & 39 deletions .github/workflows/release-on-tag-push.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
release_on_tag_push:
uses: MapColonies/shared-workflows/.github/workflows/release-on-tag-push.yaml@v3.1.0
secrets: inherit
71 changes: 16 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
# 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: <br/>
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.
## 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.</br>
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.</br>
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.</br>
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 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');

Expand All @@ -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 = {
Expand Down Expand Up @@ -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

```

Expand Down
Loading