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
Show 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():
...
@@ -19,8 +19,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Solar_Production_Layer"
,
"name"
:
"Solar_Production_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Solar_Production_kWh"
"Solar_Production_kWh"
],
],
...
@@ -32,8 +33,9 @@ def add_by_layers():
...
@@ -32,8 +33,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Energy_Consumption_Layer"
,
"name"
:
"Energy_Consumption_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Energy_Consumption_kWh"
"Energy_Consumption_kWh"
],
],
...
@@ -44,8 +46,9 @@ def add_by_layers():
...
@@ -44,8 +46,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Heating_Consumption_Layer"
,
"name"
:
"Heating_Consumption_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Heating_Consumption_kWh"
"Heating_Consumption_kWh"
],
],
...
@@ -56,8 +59,9 @@ def add_by_layers():
...
@@ -56,8 +59,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Price_Layer"
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Price_AUD_MWh"
"Price_AUD_MWh"
],
],
...
@@ -68,8 +72,9 @@ def add_by_layers():
...
@@ -68,8 +72,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Demand_Layer"
,
"name"
:
"Demand_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Total_Demand_MWh"
"Total_Demand_MWh"
],
],
...
@@ -80,8 +85,9 @@ def add_by_layers():
...
@@ -80,8 +85,9 @@ def add_by_layers():
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"name"
:
"Position_Layer"
,
"name"
:
"Position_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"Customer"
,
"Customer"
,
"Post
C
ode"
,
"Post
c
ode"
,
"Timestamp"
,
"Timestamp"
,
"Latitude"
,
"Latitude"
,
"Longitude"
"Longitude"
...
@@ -96,7 +102,7 @@ def add_by_layers():
...
@@ -96,7 +102,7 @@ def add_by_layers():
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
for
layer
in
layers
:
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
(
response
=
requests
.
post
(
url
,
url
,
...
@@ -121,15 +127,14 @@ def add_by_schema():
...
@@ -121,15 +127,14 @@ def add_by_schema():
print
(
f
"jwt token: {jwt}"
)
print
(
f
"jwt token: {jwt}"
)
use_case
=
"smart-energy"
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://{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"
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/schema/mapping"
for
column
in
columns
:
internal
=
column
.
replace
(
"/"
,
"_"
)
external
=
column
for
internal
,
external
in
columns
:
response
=
requests
.
put
(
response
=
requests
.
put
(
url
,
url
,
verify
=
False
,
verify
=
False
,
...
...
src/rest-gateway/app/configs/swagger.yml
View file @
a797866f
...
@@ -140,7 +140,7 @@ paths:
...
@@ -140,7 +140,7 @@ paths:
/trace
:
/trace
:
post
:
post
:
security
:
security
:
-
Jwt
Admin
:
[]
-
Jwt
Regular
:
[]
operationId
:
"
routes.blockchain_trace.receive"
operationId
:
"
routes.blockchain_trace.receive"
tags
:
tags
:
-
"
Blockchain
Trace"
-
"
Blockchain
Trace"
...
...
src/rest-gateway/app/routes/blockchain_trace.py
View file @
a797866f
...
@@ -13,7 +13,7 @@ def receive():
...
@@ -13,7 +13,7 @@ def receive():
message_sender
.
send_message
(
'inhub'
,
'trace-retrieval'
,
json
.
dumps
(
message
))
message_sender
.
send_message
(
'inhub'
,
'trace-retrieval'
,
json
.
dumps
(
message
))
return
Response
(
status
=
201
)
return
Response
(
status
=
201
)
return
Response
(
status
=
400
)
return
Response
(
'ApplicationType is missing'
,
status
=
400
)
def
isBlockchainTraceValid
(
trace
)
->
bool
:
def
isBlockchainTraceValid
(
trace
)
->
bool
:
# different for every use case, no global schema
# 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:
...
@@ -164,7 +164,12 @@ class MessageHandler:
return
return
mappings
=
data
[
"mappings"
]
mappings
=
data
[
"mappings"
]
try
:
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
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
)
transaction
=
Transaction
(
use_case
,
flattened
)
try
:
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