Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DALA-4584 Introduce Dataland Lego Bricks #812

Open
wants to merge 97 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
356b728
Create Specification Service
dennis-dfine Oct 24, 2024
2738e00
add first set of files
SiegfriedSobkowiak Oct 24, 2024
a0b0ce4
fix error
SiegfriedSobkowiak Oct 24, 2024
8f67c03
Add entrypoint script
dennis-dfine Oct 25, 2024
c61600b
Add datapoints and datatypes for additional-company-information
dennis-dfine Oct 25, 2024
2aba6da
Add datapoint validation
SiegfriedSobkowiak Oct 25, 2024
66b8e14
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Oct 26, 2024
8cac4bd
Add up- and download for data points into in memory store
SiegfriedSobkowiak Oct 27, 2024
1911747
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
dennis-dfine Oct 28, 2024
00654af
Update SpecificationService
dennis-dfine Oct 28, 2024
2e08fe9
Add Todos Naming
dennis-dfine Oct 28, 2024
7ad96ae
Store data-point in the same structure as the data sets before
SiegfriedSobkowiak Oct 28, 2024
be7b68d
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
SiegfriedSobkowiak Oct 28, 2024
e29a196
add todo
SiegfriedSobkowiak Oct 29, 2024
9ebbe58
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Oct 29, 2024
daea79a
add open api spec
SiegfriedSobkowiak Oct 29, 2024
0126038
Fix links in specifications
dennis-dfine Oct 29, 2024
3d43367
Fix automated QA Service
dennis-dfine Oct 29, 2024
ed47dc8
Update backend to match specifications
dennis-dfine Oct 29, 2024
d9cec7d
Merge branch 'DALA-4584_Introduce-Legos' of github.com:d-fine/Datalan…
dennis-dfine Oct 29, 2024
68e9ec0
update naming
SiegfriedSobkowiak Oct 29, 2024
83e28f9
Fix error in automated QA service
dennis-dfine Oct 29, 2024
c2b753c
Modify internal storage to store datapoints
dennis-dfine Oct 29, 2024
e057a87
Transform Specification Service into fully-featured spring service
MarcTM01 Oct 29, 2024
1a68812
Transform Specification Service into fully-featured spring service (P…
MarcTM01 Oct 29, 2024
944b3d0
Finally fix automated QA Service
dennis-dfine Oct 29, 2024
2a21031
introduce breaking down
SiegfriedSobkowiak Oct 29, 2024
626d37d
Introduce logic to the specification service.
MarcTM01 Oct 30, 2024
2a8b3b8
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
MarcTM01 Oct 30, 2024
1fc1ca8
Introduce missing endpoints to specification service. Generated OpenA…
MarcTM01 Oct 30, 2024
11d56c6
introduce assembly
SiegfriedSobkowiak Oct 30, 2024
4c4e5aa
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Oct 30, 2024
2f99009
regenerate openApi spec
SiegfriedSobkowiak Oct 30, 2024
9be966e
Fix Validation Error and add datasetToDataPoint dbTable
dennis-dfine Oct 31, 2024
6928c60
Logging and ExceptionHandling
dennis-dfine Nov 1, 2024
2c98040
wip for clean up
SiegfriedSobkowiak Nov 1, 2024
2d1c877
fix and extend unit tests and associated changes
SiegfriedSobkowiak Nov 2, 2024
6aab259
first version for referenced reports (without publication date)
SiegfriedSobkowiak Nov 4, 2024
8a5856f
Fix Detekt
MarcTM01 Nov 4, 2024
560f6a1
some detekt fixes
SiegfriedSobkowiak Nov 4, 2024
bb74f37
Integrate elements into framework toolbox
MarcTM01 Nov 5, 2024
12de01c
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
MarcTM01 Nov 5, 2024
afb42de
Fix Detekt issues
MarcTM01 Nov 5, 2024
9ed0c6b
Fix non-empty gitinfo
MarcTM01 Nov 5, 2024
7f34821
Integrate new field referenced report json path
MarcTM01 Nov 5, 2024
26de126
Changes for first version of referenced reports
SiegfriedSobkowiak Nov 5, 2024
acc3788
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
SiegfriedSobkowiak Nov 5, 2024
99154da
Fix inserting of referencedReports
SiegfriedSobkowiak Nov 6, 2024
4f17bf6
Some more improvements
SiegfriedSobkowiak Nov 6, 2024
d582c91
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Nov 6, 2024
60df279
Add changes to fix issues
SiegfriedSobkowiak Nov 6, 2024
7e0b5f6
Fix toolbox bug
MarcTM01 Nov 6, 2024
c698b47
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
MarcTM01 Nov 6, 2024
13b0b2a
Fixes for Sonar and CI
SiegfriedSobkowiak Nov 6, 2024
9be64d9
Fix specification service testing.
MarcTM01 Nov 7, 2024
3eca09e
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
MarcTM01 Nov 7, 2024
09d5885
Fix merge
MarcTM01 Nov 7, 2024
24fa1ec
Fixes for Sonar
SiegfriedSobkowiak Nov 7, 2024
1b5bd16
Some more fixes
SiegfriedSobkowiak Nov 7, 2024
f522677
additional fixes
SiegfriedSobkowiak Nov 7, 2024
ccd80b0
add publication date to fixtures
SiegfriedSobkowiak Nov 8, 2024
1232426
exclude publication date from checks
SiegfriedSobkowiak Nov 8, 2024
eb738bb
test if performance is the issue
SiegfriedSobkowiak Nov 8, 2024
809dfbd
fix actual issue
SiegfriedSobkowiak Nov 8, 2024
1337ba0
more unit tests
SiegfriedSobkowiak Nov 8, 2024
48b5ba9
add e2e test and some changes to automated qa
SiegfriedSobkowiak Nov 10, 2024
787d8ff
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Nov 11, 2024
8074c5e
workaround for QA approving
SiegfriedSobkowiak Nov 11, 2024
c077b5c
different approach
SiegfriedSobkowiak Nov 11, 2024
66c4580
change
SiegfriedSobkowiak Nov 11, 2024
4f06ba2
fix for the internal storage
SiegfriedSobkowiak Nov 11, 2024
c21e9e9
fix for e2e test
SiegfriedSobkowiak Nov 11, 2024
289f9f2
rework the internal storage interaction
SiegfriedSobkowiak Nov 11, 2024
0408c6d
add documentation and fix
SiegfriedSobkowiak Nov 12, 2024
e7ee23d
update spec
SiegfriedSobkowiak Nov 12, 2024
364f126
update test
SiegfriedSobkowiak Nov 12, 2024
8ff4556
fix test and output
SiegfriedSobkowiak Nov 12, 2024
5874520
fix for sonar
SiegfriedSobkowiak Nov 12, 2024
911f027
Add process documentation for the upload and QA process.
MarcTM01 Nov 12, 2024
8dc4332
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
MarcTM01 Nov 12, 2024
f195e12
Add missing step to sequence diagram
MarcTM01 Nov 12, 2024
f417cec
fix for qa
SiegfriedSobkowiak Nov 12, 2024
8254cb1
Merge remote-tracking branch 'origin/DALA-4584_Introduce-Legos' into …
SiegfriedSobkowiak Nov 12, 2024
2adc6e7
more CI fixes
SiegfriedSobkowiak Nov 12, 2024
4faf890
add checks before storing data
SiegfriedSobkowiak Nov 12, 2024
67278d0
fix test
SiegfriedSobkowiak Nov 13, 2024
352a0ad
Added new endpoints to specification controller
MarcTM01 Nov 13, 2024
0045f36
fix test
SiegfriedSobkowiak Nov 13, 2024
b814d27
variables instead of hard coding
SiegfriedSobkowiak Nov 13, 2024
5a9424d
make ignoring fields configurable
SiegfriedSobkowiak Nov 13, 2024
8363ad0
add missing return
SiegfriedSobkowiak Nov 13, 2024
e612294
remove currency validator
SiegfriedSobkowiak Nov 13, 2024
e61f850
fix CI findings
SiegfriedSobkowiak Nov 13, 2024
c058a89
fix more CI findings
SiegfriedSobkowiak Nov 14, 2024
13a8d2d
add ignore fields
SiegfriedSobkowiak Nov 14, 2024
3721c63
change import usage
SiegfriedSobkowiak Nov 14, 2024
aec51eb
Merge remote-tracking branch 'origin/main' into DALA-4584_Introduce-L…
SiegfriedSobkowiak Nov 14, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
run: |
sudo apt update && sudo apt install libreoffice
#TODO: look into a more elegant solution for the line below
./gradlew :dataland-backend:test :dataland-backend-utils:test :dataland-internal-storage:test :dataland-api-key-manager:test :dataland-qa-service:test :dataland-document-manager:test :dataland-batch-manager:test :dataland-community-manager:test :dataland-email-service:test :dataland-framework-toolbox:test :dataland-external-storage:test :dataland-data-exporter:test --no-daemon --stacktrace
./gradlew :dataland-backend:test :dataland-backend-utils:test :dataland-internal-storage:test :dataland-api-key-manager:test :dataland-qa-service:test :dataland-document-manager:test :dataland-batch-manager:test :dataland-community-manager:test :dataland-email-service:test :dataland-framework-toolbox:test :dataland-external-storage:test :dataland-data-exporter:test :dataland-specification-service:test :dataland-specification-lib:test --no-daemon --stacktrace
if: always()
env:
MAILJET_API_ID: ${{ secrets.MAILJET_API_ID }}
Expand Down
1 change: 1 addition & 0 deletions build-utils/base_rebuild_single_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ docker_build_args=( --build-arg PROXY_ENVIRONMENT="${PROXY_ENVIRONMENT:-}" \
--build-arg DATALAND_INTERNAL_STORAGE_BASE_VERSION="${DATALAND_INTERNAL_STORAGE_BASE_VERSION:-}" \
--build-arg DATALAND_BATCH_MANAGER_BASE_VERSION="${DATALAND_BATCH_MANAGER_BASE_VERSION:-}" \
--build-arg DATALAND_COMMUNITY_MANAGER_BASE_VERSION="${DATALAND_COMMUNITY_MANAGER_BASE_VERSION:-}" \
--build-arg DATALAND_SPECIFICATION_SERVICE_BASE_VERSION="${DATALAND_SPECIFICATION_SERVICE_BASE_VERSION:-}" \
--build-arg DATALAND_EMAIL_SERVICE_BASE_VERSION="${DATALAND_EMAIL_SERVICE_BASE_VERSION:-}" \
--build-arg DATALAND_EXTERNAL_STORAGE_BASE_VERSION="${DATALAND_EXTERNAL_STORAGE_BASE_VERSION:-}" \
--build-arg DATALAND_DUMMY_EURODAT_CLIENT_BASE_VERSION="${DATALAND_DUMMY_EURODAT_CLIENT_BASE_VERSION:-}" \
Expand Down
Empty file modified build-utils/download_and_unpack_jacoco.sh
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions build-utils/rebuild_backend_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ gradle_dependencies=$(grep gradle_dependencies ./build-utils/common.conf | cut -
dependencies="./dataland-backend/ ./dataland-backend-utils/ ./dataland-keycloak-adapter/ ./dataland-message-queue-utils/ $gradle_dependencies"
dependencies+=" ./dataland-api-key-manager/apiKeyManagerOpenApi.json ./dataland-community-manager/communityManagerOpenApi.json"
dependencies+=" ./dataland-internal-storage/internalStorageOpenApi.json ./environments/.env.uncritical"
dependencies+=" ./dataland-specification-service/specificationServiceOpenApi.json ./dataland-external-storage/externalStorageOpenApi.json"
dependencies+=" ./dataland-document-manager/documentManagerOpenApi.json"

./build-utils/base_rebuild_single_docker_image.sh dataland_backend_base ./dataland-backend/DockerfileBase $dependencies

Expand Down
Empty file modified build-utils/rebuild_data_exporter_images.sh
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions build-utils/rebuild_specification_service_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euxo pipefail

gradle_dependencies=$(grep gradle_dependencies ./build-utils/common.conf | cut -d'=' -f2)
dependencies="./dataland-specification-service/ ./dataland-backend-utils/ ./dataland-specification-lib/ $gradle_dependencies"

./build-utils/base_rebuild_single_docker_image.sh dataland_specification_service_base ./dataland-specification-service/DockerfileBase $dependencies

set -o allexport
source ./*github_env.log
set +o allexport

./build-utils/base_rebuild_single_docker_image.sh dataland_specification_service_production ./dataland-specification-service/Dockerfile $dependencies

./build-utils/base_rebuild_single_docker_image.sh dataland_specification_service_test ./dataland-specification-service/DockerfileTest $dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ def _load(self) -> None:
token = get_access_token()
backend_client = AuthenticatedClient(base_url=backend_api_url, token=token)
logging.info(f"Retrieving meta information for dataset with ID {self.id}")
self.meta_info = get_data_meta_info(self.id, client=backend_client)
logging.info(f"Retrieving dataset with ID {self.id}")
self.data = _get_data(data_type=self.meta_info.data_type, data_id=self.id, client=backend_client).data
try:
self.meta_info = get_data_meta_info(self.id, client=backend_client)
logging.info(f"Retrieving dataset with ID {self.id}")
self.data = _get_data(data_type=self.meta_info.data_type, data_id=self.id, client=backend_client).data
except ValueError as e:
MarcTM01 marked this conversation as resolved.
Show resolved Hide resolved
logging.info(f"Exception caught while retrieving metadata': {e}.")


def _get_data(data_type: DataTypeEnum, data_id: str, client: AuthenticatedClient) -> any:
Expand All @@ -78,11 +81,13 @@ def _get_data(data_type: DataTypeEnum, data_id: str, client: AuthenticatedClient
DataTypeEnum.HEIMATHAFEN: CompanyAssociatedDataHeimathafenData,
DataTypeEnum.ADDITIONAL_COMPANY_INFORMATION: CompanyAssociatedDataAdditionalCompanyInformationData
}
response = client.get_httpx_client().request(method="get", url=f"/data/{data_type}/{data_id}")
if response.status_code == HTTPStatus.OK:
return type_to_company_associated_data.get(data_type).from_dict(response.json())
if response.status_code == HTTPStatus.UNAUTHORIZED:
return cast(Any, None)
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)

if type_to_company_associated_data.get(data_type):
response = client.get_httpx_client().request(method="get", url=f"/data/{data_type}/{data_id}")
if response.status_code == HTTPStatus.OK:
return type_to_company_associated_data.get(data_type).from_dict(response.json())
if response.status_code == HTTPStatus.UNAUTHORIZED:
return cast(Any, None)
MarcTM01 marked this conversation as resolved.
Show resolved Hide resolved
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
return None
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ package org.dataland.datalandbackendutils.exceptions

const val SEARCHSTRING_TOO_SHORT_THRESHOLD = 3
const val SEARCHSTRING_TOO_SHORT_VALIDATION_MESSAGE = "Search string is shorter than minimum number of characters"
const val DATAPOINT_VALIDATION_CLASS_NOT_FOUND_MESSAGE = "Couldn't retrieve the validation class for the data point."
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@ class ExceptionForwarder {
)
}
}

/**
* Catches a bad-request-client-exception due to a validation error of a data point and throws a custom exception
* which is known to the ExceptionHandler.
* @param response the response in the inter-microservice-request that has a client error
* @param statusCode the status code of the client error
* @param throwable the client error itself
*/
fun catchDataPointValidationClassNotFoundClientException(
response: String,
statusCode: Int,
throwable: Throwable,
) {
if (statusCode == HttpStatus.NOT_FOUND.value() && response.contains(DATAPOINT_VALIDATION_CLASS_NOT_FOUND_MESSAGE)) {
throw InvalidInputApiException(
summary = "Failed to retrieve validation class for data point.",
message = DATAPOINT_VALIDATION_CLASS_NOT_FOUND_MESSAGE,
cause = throwable,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import org.dataland.datalandbackendutils.model.ErrorDetails
import org.springframework.http.HttpStatus

/**
* An InternalServerErrorApiException should be thrown if something went terribly wrong on Datalands side.
* An InternalServerErrorApiException should be thrown if something went terribly wrong on Dataland side.
* It will be returned as a 500 error. publicSummary and publicMessage will be displayed to the user,
* internalMessage and internalCause will only be displayed in development mode
*/
class InternalServerErrorApiException(
val publicSummary: String,
val publicMessage: String,
private val publicSummary: String,
private val publicMessage: String,
internalMessage: String,
internalCause: Throwable? = null,
) : SingleApiException(internalMessage, internalCause) {
Expand Down
1 change: 1 addition & 0 deletions dataland-backend/DockerfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY ./dataland-internal-storage/internalStorageOpenApi.json ./dataland-internal
COPY ./dataland-external-storage/externalStorageOpenApi.json ./dataland-external-storage/externalStorageOpenApi.json
COPY ./dataland-community-manager/communityManagerOpenApi.json ./dataland-community-manager/communityManagerOpenApi.json
COPY ./dataland-document-manager/documentManagerOpenApi.json ./dataland-document-manager/documentManagerOpenApi.json
COPY ./dataland-specification-service/specificationServiceOpenApi.json ./dataland-specification-service/specificationServiceOpenApi.json

COPY ./dataland-keycloak-adapter/ ./dataland-keycloak-adapter/
COPY ./.git/ ./.git
Expand Down
210 changes: 204 additions & 6 deletions dataland-backend/backendOpenApi.json
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,77 @@
]
}
},
"/data-points": {
"post": {
"tags": [
"data-point-controller"
],
"summary": "Upload new data point.",
"description": "The uploaded data point is added to the data store, the generated data id is returned.",
"operationId": "postDataPoint",
"parameters": [
{
"name": "bypassQa",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": false
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StorableDataPoint"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successfully added data to the data store.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DataPointMetaInformation"
}
}
}
},
"default": {
"description": "An error occurred",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"headers": {
"WWW-Authenticate": {
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"default-oauth": []
},
{
"default-bearer-auth": []
}
]
}
},
"/companies": {
"get": {
"tags": [
Expand Down Expand Up @@ -3154,6 +3225,66 @@
]
}
},
"/data-points/{dataId}": {
"get": {
"tags": [
"data-point-controller"
],
"summary": "Retrieve data points by ID.",
"description": "A data point identified by its ID is retrieved.",
"operationId": "getDataPoint",
"parameters": [
{
"name": "dataId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully retrieved data point.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StorableDataPoint"
}
}
}
},
"default": {
"description": "An error occurred",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"headers": {
"WWW-Authenticate": {
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"default-oauth": []
},
{
"default-bearer-auth": []
}
]
}
},
"/companies/{companyId}/info": {
"get": {
"tags": [
Expand Down Expand Up @@ -4072,6 +4203,11 @@
},
"fileReference": {
"type": "string"
},
"publicationDate": {
"type": "string",
"format": "date",
"nullable": true
}
}
},
Expand Down Expand Up @@ -4164,6 +4300,11 @@
},
"fileReference": {
"type": "string"
},
"publicationDate": {
"type": "string",
"format": "date",
"nullable": true
}
}
},
Expand Down Expand Up @@ -17630,6 +17771,63 @@
}
}
},
"StorableDataPoint": {
"required": [
"companyId",
"dataPointContent",
"dataPointIdentifier",
"reportingPeriod"
],
"type": "object",
"properties": {
"dataPointContent": {
"type": "string"
},
"dataPointIdentifier": {
"type": "string"
},
"companyId": {
"type": "string",
"format": "uuid"
},
"reportingPeriod": {
"type": "string"
}
}
},
"DataPointMetaInformation": {
"required": [
"companyId",
"dataId",
"dataPointIdentifier",
"reportingPeriod",
"uploadTime"
],
"type": "object",
"properties": {
"dataId": {
"type": "string"
},
"dataPointIdentifier": {
"type": "string"
},
"companyId": {
"type": "string",
"format": "uuid"
},
"reportingPeriod": {
"type": "string"
},
"uploaderUserId": {
"type": "string",
"nullable": true
},
"uploadTime": {
"type": "integer",
"format": "int64"
}
}
},
"CompanyInformationPatch": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -17921,22 +18119,22 @@
],
"type": "object",
"properties": {
"sector": {
"type": "string",
"nullable": true
},
"companyName": {
"type": "string"
},
"companyId": {
"type": "string"
},
"countryCode": {
"headquarters": {
"type": "string"
},
"headquarters": {
"countryCode": {
"type": "string"
},
"sector": {
"type": "string",
"nullable": true
},
"lei": {
"type": "string",
"nullable": true
Expand Down
Loading
Loading