Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
regimo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIT
IAI
IT4EDM
regimo
Commits
0fa0e08c
Commit
0fa0e08c
authored
2 months ago
by
Mohamed Anis Koubaa
Browse files
Options
Downloads
Patches
Plain Diff
use settings to define model paths.
parent
88338a5d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
services/backend_regimo/components/oep_access/settings.py
+1
-2
1 addition, 2 deletions
services/backend_regimo/components/oep_access/settings.py
services/backend_regimo/components/oep_access/upload_LLEC.py
+17
-9
17 additions, 9 deletions
services/backend_regimo/components/oep_access/upload_LLEC.py
with
18 additions
and
11 deletions
services/backend_regimo/components/oep_access/settings.py
+
1
−
2
View file @
0fa0e08c
...
...
@@ -13,13 +13,12 @@ VERSION_PATH = BASE_PATH / VERSION
SCHEMA_BUILD_PATH
=
VERSION_PATH
/
"
build_source
"
MAIN_SCHEMA_PATH
=
SCHEMA_BUILD_PATH
/
"
schema_structure.json
"
SCHEMA_REFS
=
SCHEMA_BUILD_PATH
/
"
schemas
"
MODEL_PATH
=
SCHEMA_REFS
RESOLVED_SCHEMA_FILE_NAME
=
VERSION_PATH
/
"
schema.json
"
EXPECTED_SCHEMA_PATH
=
VERSION_PATH
/
"
schema.json
"
EXAMPLE_PATH
=
VERSION_PATH
/
"
example.json
"
TEMPLATE_PATH
=
VERSION_PATH
/
"
template.json
"
PATH_TO_SOURCE
=
(
'
/Users/ot2661/Documents/01_dev/aed_pub/regimo/regimo/services/backend_regimo/data
'
+
'
/LLEC_Data/dataset_sample_2rows.xlsx
'
)
URL_TO_SOURCE
=
"
https://github.com/koubaa-hmc/LLEC_Data/raw/refs/heads/main/dataset_sample_2rows.xlsx
"
This diff is collapsed.
Click to expand it.
services/backend_regimo/components/oep_access/upload_LLEC.py
+
17
−
9
View file @
0fa0e08c
...
...
@@ -8,8 +8,12 @@ from os import environ
from
random
import
randint
from
oep_client
import
OepClient
from
oemeta.target_meta
import
OEMeta
from
excel_sheet_adapter
import
ExcelSheetAdapter
from
settings
import
(
RESOLVED_SCHEMA_FILE_NAME
,
TEMPLATE_PATH
,
LOG_FORMAT
,
PATH_TO_SOURCE
,
URL_TO_SOURCE
)
# set default value for the oep token
environ
.
setdefault
(
'
OEP_API_TOKEN
'
,
"
f00fa56fa4554da3714832a9452525248f9c4988
"
)
...
...
@@ -19,17 +23,13 @@ table = f"living_lab_table_{randint(0, 100000)}"
# configure logger. Please select your logging level
# INFO or DEBUG. Logs are to find under log/
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
filename
=
'
log/
'
+
table
+
'
.log
'
,
format
=
"
[%(asctime)s %(module)16s %(levelname)7s] %(message)s
"
,
filemode
=
'
w
'
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
filename
=
'
log/
'
+
table
+
'
.log
'
,
format
=
LOG_FORMAT
,
filemode
=
'
w
'
)
logger
=
logging
.
getLogger
(
__name__
)
logger
.
info
(
'
Starting LLEC upload
'
)
path_to_source
=
(
'
/Users/ot2661/Documents/01_dev/aed_pub/regimo/regimo/services/backend_regimo/data
'
+
'
/LLEC_Data/dataset_sample_2rows.xlsx
'
)
url_to_source
=
"
https://github.com/koubaa-hmc/LLEC_Data/raw/refs/heads/main/dataset_sample_2rows.xlsx
"
path_to_source
=
PATH_TO_SOURCE
url_to_source
=
URL_TO_SOURCE
token
=
environ
.
get
(
"
OEP_API_TOKEN
"
)
or
getpass
(
"
Enter your OEP API token:
"
)
# for read/write, we need to add authorization header
...
...
@@ -41,14 +41,22 @@ logger.info("Table API URL: %s" % table_api_url)
table_source
=
ExcelSheetAdapter
(
table_path
=
Path
(
path_to_source
),
data_sheet_name
=
'
dataset_sample_2rows_comp
'
,
metadata_sheet_name
=
'
dataset_sample_2rows_meta
'
)
# instantiate target meta
target_meta
=
OEMeta
()
# get header
table_schema_definition
=
table_source
.
get_header
()
# load data
# load data
from table source
table_data
=
table_source
.
get_data
()
# load metadata from table source
table_metadata
=
table_source
.
get_metadata
()
# todo: handle metadata with in an object(oemeta)
# attach a model to target_meta
target_meta
.
attach_schema
(
MODEL_PATH
)
# instantiate client to oep
cli
=
OepClient
(
token
=
token
,
default_schema
=
topic
)
cli
.
create_table
(
table
,
table_schema_definition
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment