Skip to content

Commit 0f1d158

Browse files
authored
Merge pull request #196 from meaningfy-ws/feature/TED-480
Feature/ted 480
2 parents d7dfacd + 3760072 commit 0f1d158

143 files changed

Lines changed: 5899 additions & 445 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
run: |
2424
python -m pip install --upgrade setuptools pip wheel
2525
make install
26+
make install-dev
2627
- name: Make envfile
2728
uses: SpicyPizza/create-envfile@v1
2829
with:

Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ XML_PROCESSOR_PATH = ${PROJECT_PATH}/.saxon/saxon-he-10.6.jar
1919
#-----------------------------------------------------------------------------
2020
# Dev commands
2121
#-----------------------------------------------------------------------------
22-
install: install-dev
22+
install:
2323
@ echo -e "$(BUILD_PRINT)Installing the requirements$(END_BUILD_PRINT)"
2424
@ pip install --upgrade pip
25-
@ pip install -r requirements.txt
25+
@ pip install --no-cache-dir -r requirements.txt --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.5/constraints-no-providers-3.8.txt"
2626

2727
install-dev:
2828
@ echo -e "$(BUILD_PRINT)Installing the dev requirements$(END_BUILD_PRINT)"
2929
@ pip install --upgrade pip
30-
@ pip install -r requirements.dev.txt
30+
@ pip install --no-cache-dir -r requirements.dev.txt --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.5/constraints-no-providers-3.8.txt"
3131

3232
test: test-unit
3333

@@ -37,7 +37,7 @@ test-unit:
3737

3838
test-features:
3939
@ echo -e "$(BUILD_PRINT)Gherkin Features Testing ...$(END_BUILD_PRINT)"
40-
@ tox -e features
40+
# @ tox -e features
4141

4242
test-e2e:
4343
@ echo -e "$(BUILD_PRINT)End to End Testing ...$(END_BUILD_PRINT)"
@@ -301,23 +301,23 @@ refresh-mapping-files:
301301
#-----------------------------------------------------------------------------
302302
# API Service commands
303303
#-----------------------------------------------------------------------------
304-
build-all-apis: build-id_manager-api
304+
build-all-apis: build-digest_service-api
305305

306-
start-all-apis: start-id_manager-api
306+
start-all-apis: start-digest_service-api
307307

308-
stop-all-apis: stop-id_manager-api
308+
stop-all-apis: stop-digest_service-api
309309

310-
build-id_manager-api:
311-
@ echo -e "$(BUILD_PRINT) Build id_manager API service $(END_BUILD_PRINT)"
310+
build-digest_service-api:
311+
@ echo -e "$(BUILD_PRINT) Build digest_service API service $(END_BUILD_PRINT)"
312312
@ docker-compose -p common --file infra/api/docker-compose.yml --env-file ${ENV_FILE} build --no-cache --force-rm
313313
@ docker-compose -p common --file infra/api/docker-compose.yml --env-file ${ENV_FILE} up -d --force-recreate
314314

315-
start-id_manager-api:
316-
@ echo -e "$(BUILD_PRINT)Starting id_manager API service $(END_BUILD_PRINT)"
315+
start-digest_service-api:
316+
@ echo -e "$(BUILD_PRINT)Starting digest_service API service $(END_BUILD_PRINT)"
317317
@ docker-compose -p common --file infra/api/docker-compose.yml --env-file ${ENV_FILE} up -d
318318

319-
stop-id_manager-api:
320-
@ echo -e "$(BUILD_PRINT)Stopping id_manager API service $(END_BUILD_PRINT)"
319+
stop-digest_service-api:
320+
@ echo -e "$(BUILD_PRINT)Stopping digest_service API service $(END_BUILD_PRINT)"
321321
@ docker-compose -p common --file infra/api/docker-compose.yml --env-file ${ENV_FILE} down
322322

323323

README.md

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
## Table of contents
1717

1818
- [Developer documentation](#developer-documentation)
19-
- [Installation](#installation)
19+
- [Installation for Software Engineers](#installation-for-software-engineers)
20+
- [Installation for Semantic Engineers](#installation-for-semantic-engineers)
2021
- [Usage](#usage)
2122
- [Contributing](#contributing)
2223
- [Licence](#licence)
@@ -31,9 +32,68 @@ If you contribute to this project please refer to the following project document
3132
* [Enterprise architecture model file (in development)](https://drive.google.com/file/d/1YB2dPYe9E9bAR2peVraQaUANS-hXetms/view?usp=sharing)
3233
* [Meaningfy google Drive of the project (restricted)](https://drive.google.com/drive/folders/1wfWYDAtcaJrYTuB14VzTixr1mJUkCHYl?usp=sharing)
3334

35+
Try to follow as close as possible the Clean Code Architecture (onion architecture), develop by writing tests first i.e. do Test Driven Development (TDD) and think of the Domain first, i.e. think Domain Driven Design (DDD).
36+
3437
<hr>
3538

36-
## Installation
39+
## Installation for software engineers
40+
41+
42+
Make sure you have installed `Docker` and `docker-compose`.
43+
44+
Create the local `venv` and activate it.
45+
```shell
46+
pip install virtualenv
47+
virtualenv venv
48+
source venv/bin/activate
49+
```
50+
51+
Install the python dependencies:
52+
53+
```shell
54+
make install
55+
make istall-dev
56+
```
57+
58+
Prepare the Airflow environment
59+
```shell
60+
make create-env-airflow
61+
```
62+
63+
Set up the local infra
64+
```shell
65+
make build-externals
66+
make build-airflow
67+
make init-rml-mapper
68+
make init-saxon
69+
```
70+
71+
Start local infra services
72+
```shell
73+
make start-traefik
74+
make start-mongo
75+
make start-metabase
76+
make start-allegro-graph
77+
```
78+
79+
Start Airflow
80+
```shell
81+
make start-airflow
82+
```
83+
84+
## Running tests
85+
86+
```shell
87+
make install-dev
88+
```
89+
90+
```shell
91+
make test-unit
92+
make test-feature
93+
make test-e2e
94+
```
95+
96+
## Installation for semantic engineers
3797
### Installation of ted-sws package within external projects using terminal
3898
#### 1. Using the package manager pip
3999
1. Go to the root folder of the project
@@ -352,21 +412,21 @@ Options:
352412
##### Start local API server
353413
To start the API server:
354414
```bash
355-
api-id_manager-start-server
415+
api-digest_service-start-server
356416
```
357417
Output:
358418
```bash
359-
uvicorn --host localhost --port 8000 ted_sws.id_manager.entrypoints.api.main:app --reload
419+
uvicorn --host localhost --port 8000 ted_sws.notice_transformer.entrypoints.api.digest_service.main:app --reload
360420
###
361421
See http://localhost:8000/api/v1/docs for API usage.
362422
```
363423
Use:
364424
```bash
365-
api-id_manager-start-server --help
425+
api-digest_service-start-server --help
366426
```
367427
to get the cli command Usage Help:
368428
```bash
369-
Usage: api-id_manager-start-server [OPTIONS]
429+
Usage: api-digest_service-start-server [OPTIONS]
370430

371431
Options:
372432
-h, --host TEXT

dags/index_and_normalise_notice_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ted_sws.event_manager.model.event_message import NoticeEventMessage
1313
from ted_sws.event_manager.services.logger_from_context import get_logger_from_dag_context, \
1414
handle_event_message_metadata_dag_context
15-
from ted_sws.metadata_normaliser.services.metadata_normalizer import normalise_notice_by_id
15+
from ted_sws.notice_metadata_processor.services.metadata_normalizer import normalise_notice_by_id
1616

1717
NOTICE_ID = "notice_id"
1818

dags/worker_single_notice_process_orchestrator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
from ted_sws.core.model.notice import NoticeStatus
88
from ted_sws.data_manager.adapters.mapping_suite_repository import MappingSuiteRepositoryMongoDB
99
from ted_sws.data_manager.adapters.notice_repository import NoticeRepository
10-
from ted_sws.data_sampler.services.notice_xml_indexer import index_notice, index_notice_by_id
11-
from ted_sws.metadata_normaliser.services.metadata_normalizer import normalise_notice_by_id
10+
from ted_sws.data_sampler.services.notice_xml_indexer import index_notice_by_id
11+
from ted_sws.notice_metadata_processor.services.metadata_normalizer import normalise_notice_by_id
1212

1313
from airflow.decorators import dag
1414
from airflow.operators.python import get_current_context, BranchPythonOperator, PythonOperator
1515

1616
from dags import DEFAULT_DAG_ARGUMENTS
17-
from ted_sws.notice_eligibility.services.notice_eligibility import notice_eligibility_checker_by_id
17+
from ted_sws.notice_metadata_processor.services.notice_eligibility import notice_eligibility_checker_by_id
1818
from ted_sws.notice_packager.services.notice_packager import create_notice_package
1919
from ted_sws.notice_transformer.adapters.rml_mapper import RMLMapper
2020
from ted_sws.notice_transformer.services.notice_transformer import transform_notice_by_id
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ RUN pip install --upgrade pip
88
RUN pip install -r requirements.txt
99
RUN pip install -r infra/api/requirements.txt
1010

11-
ENTRYPOINT uvicorn --host 0.0.0.0 --port ${ID_MANAGER_API_PORT} ted_sws.id_manager.entrypoints.api.main:app
11+
ENTRYPOINT uvicorn --host 0.0.0.0 --port ${ID_MANAGER_API_PORT} ted_sws.notice_transformer.entrypoints.api.digest_service.main:app

infra/api/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ version: '3.8'
22

33
services:
44
api-id_manager:
5-
container_name: api-id_manager
5+
container_name: api-digest_service
66
build:
77
context: ../..
8-
dockerfile: ./infra/api/id_manager/Dockerfile
8+
dockerfile: ./infra/api/digest_service/Dockerfile
99
env_file: ../../.env
1010
networks:
1111
- proxy-net

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def open_local(paths, mode="r", encoding="utf8"):
8989
"normalisation_resource_generator = ted_sws.data_manager.entrypoints.cli.cmd_generate_mapping_resources:main",
9090
"triple_store_loader = ted_sws.mapping_suite_processor.entrypoints.cli.cmd_triple_store_loader:main",
9191
"bulk_packager = ted_sws.notice_packager.entrypoints.cli.cmd_bulk_packager:main",
92-
"api-id_manager-start-server = ted_sws.id_manager.entrypoints.api.server:api_server_start"
92+
"api-digest_service-start-server = ted_sws.notice_transformer.entrypoints.api.digest_service.server:api_server_start"
9393
],
9494
},
9595
include_package_data=True,

ted_sws/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,14 @@ def ID_MANAGER_API_PORT(self) -> int:
146146
return int(v) if v else 8000
147147

148148

149+
class TedAPIConfig:
150+
@property
151+
def TED_API_URL(self) -> str:
152+
return EnvConfigResolver().config_resolve()
153+
154+
149155
class TedConfigResolver(MongoDBConfig, RMLMapperConfig, XMLProcessorConfig, ELKConfig, LoggingConfig,
150-
GitHubArtefacts, API, AllegroConfig):
156+
GitHubArtefacts, API, AllegroConfig, TedAPIConfig):
151157
"""
152158
This class resolve the secrets of the ted-sws project.
153159
"""

ted_sws/core/adapters/vault_secrets_store.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
from abc import ABC, abstractmethod
2-
from typing import List
3-
import hvac
41
import json
52
import os
3+
from abc import ABC, abstractmethod
4+
from typing import List
5+
66
import dotenv
7+
import hvac
78

89
dotenv.load_dotenv(verbose=True, override=os.environ.get('IS_PRIME_ENV') != 'true')
910

0 commit comments

Comments
 (0)