From 36d4af086e51d59b0239bb0873b5f9a38da9f3ff Mon Sep 17 00:00:00 2001 From: Fjodor van Rijsselberg Date: Wed, 5 Apr 2023 16:59:48 +0200 Subject: [PATCH] Added dot_env_example file. --- dot_env_example | 14 ++++++++++++++ src/enhancers/MetadataEnhancer.py | 9 ++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 dot_env_example diff --git a/dot_env_example b/dot_env_example new file mode 100644 index 0000000..e2e8143 --- /dev/null +++ b/dot_env_example @@ -0,0 +1,14 @@ +# Container setup +CONTAINER_NAME=metadata-enhancer +PORT=7070 +APPLICATION_DIR=src +PYTHONPATH: "/root/src/" + +# URL'S +KEYWORD_VOCABULARY_URL='https://fuseki.odissei.nl/skosmos/sparql' +VARIABLE_VOCABULARY_URL='https://fuseki.odissei.nl/skosmos/sparql' +GRLC_API_URL='https://grlc.odissei.nl/api-git/odissei-data/grlc/' + +# Endpoints +KEYWORD_ENDPOINT='matchElsstTermForKeyword' +VARIABLE_ENDPOINT='getCbsVarUri' diff --git a/src/enhancers/MetadataEnhancer.py b/src/enhancers/MetadataEnhancer.py index 9bbf76f..0f48eca 100644 --- a/src/enhancers/MetadataEnhancer.py +++ b/src/enhancers/MetadataEnhancer.py @@ -1,11 +1,15 @@ +import os + import requests from fastapi import HTTPException from .utils import _try_for_key +GRLC_API_URL = os.environ['GRLC_API_URL'] + class MetadataEnhancer: - """ A super class used for enhancing Dataverse metadata + """ A super class used for enhancing Dataverse metadata. The MetadataEnhancer's is a class that describes the steps for enhancement. A class that implements MetadataEnhancer will need to mainly implement the @@ -75,8 +79,7 @@ def query_matched_terms(self, value_to_match: str) -> dict: 'endpoint': self.sparql_endpoint, } - url = 'https://grlc.odissei.nl/api-git/odissei-data/grlc/' \ - + self.endpoint + url = GRLC_API_URL + self.endpoint response = requests.get( url, params=params,