Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
a797866f
Commit
a797866f
authored
Sep 10, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bityoga schema and flattening
parent
92010bd6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
16 deletions
+26
-16
add_bityoga_schema.py
...hub/business-logic-microservice/app/add_bityoga_schema.py
+18
-13
swagger.yml
src/rest-gateway/app/configs/swagger.yml
+1
-1
blockchain_trace.py
src/rest-gateway/app/routes/blockchain_trace.py
+1
-1
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+6
-1
No files found.
src/participation-hub/business-logic-microservice/app/add_bityoga_
dat
a.py
→
src/participation-hub/business-logic-microservice/app/add_bityoga_
schem
a.py
View file @
a797866f
...
...
@@ -19,8 +19,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Solar_Production_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Solar_Production_kWh"
],
...
...
@@ -32,8 +33,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Energy_Consumption_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Energy_Consumption_kWh"
],
...
...
@@ -44,8 +46,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Heating_Consumption_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Heating_Consumption_kWh"
],
...
...
@@ -56,8 +59,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Price_AUD_MWh"
],
...
...
@@ -68,8 +72,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Demand_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Total_Demand_MWh"
],
...
...
@@ -80,8 +85,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"name"
:
"Position_Layer"
,
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Latitude"
,
"Longitude"
...
...
@@ -96,7 +102,7 @@ def add_by_layers():
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
for
layer
in
layers
:
url
=
f
"https://
localhost:500
0/api/layers"
url
=
f
"https://
articonf1.itec.aau.at:3042
0/api/layers"
response
=
requests
.
post
(
url
,
...
...
@@ -121,15 +127,14 @@ def add_by_schema():
print
(
f
"jwt token: {jwt}"
)
use_case
=
"smart-energy"
columns
=
[
"Customer"
,
"PostCode"
,
"Timestamp"
,
"Solar_Production_kWh"
,
"Energy_Consumption_kWh"
,
"Heating_Consumption_kWh"
,
"Price_AUD/MWh"
,
"Total_Demand_MWh"
,
"Latitude"
,
"Longitude"
]
columns
=
[
"Customer"
,
"Postcode"
,
"Timestamp"
,
"Solar_Production_kWh"
,
"Energy_Consumption_kWh"
,
"Heating_Consumption_kWh"
,
"Price_AUD/MWh"
,
"Total_Demand_MWh"
,
"Latitude"
,
"Longitude"
]
columns
=
[(
c
.
replace
(
"/"
,
"_"
),
c
)
for
c
in
columns
]
columns
.
append
((
"UniqueID"
,
"Customer+Postcode+Timestamp"
))
# url = f"https://{nc.BUSINESS_LOGIC_HOSTNAME}:{nc.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/schema/mapping"
url
=
f
"https://localhost:5000/api/use-cases/{use_case}/schema/mapping"
for
column
in
columns
:
internal
=
column
.
replace
(
"/"
,
"_"
)
external
=
column
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/schema/mapping"
for
internal
,
external
in
columns
:
response
=
requests
.
put
(
url
,
verify
=
False
,
...
...
src/rest-gateway/app/configs/swagger.yml
View file @
a797866f
...
...
@@ -140,7 +140,7 @@ paths:
/trace
:
post
:
security
:
-
Jwt
Admin
:
[]
-
Jwt
Regular
:
[]
operationId
:
"
routes.blockchain_trace.receive"
tags
:
-
"
Blockchain
Trace"
...
...
src/rest-gateway/app/routes/blockchain_trace.py
View file @
a797866f
...
...
@@ -13,7 +13,7 @@ def receive():
message_sender
.
send_message
(
'inhub'
,
'trace-retrieval'
,
json
.
dumps
(
message
))
return
Response
(
status
=
201
)
return
Response
(
status
=
400
)
return
Response
(
'ApplicationType is missing'
,
status
=
400
)
def
isBlockchainTraceValid
(
trace
)
->
bool
:
# different for every use case, no global schema
...
...
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
a797866f
...
...
@@ -164,7 +164,12 @@ class MessageHandler:
return
mappings
=
data
[
"mappings"
]
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
try
:
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
except
KeyError
as
e
:
LOGGER
.
error
(
f
"Failed while flattening with KeyError: {str(e)}"
)
self
.
_mongo_repo
.
add_failed_transaction
(
transaction_message
)
return
transaction
=
Transaction
(
use_case
,
flattened
)
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment