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
60dfb9eb
Commit
60dfb9eb
authored
Feb 12, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added rest get for user graphs
parent
933c956b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
swagger.yml
.../community-detection-microservice/app/configs/swagger.yml
+38
-6
create_user_graphs.py
...ommunity-detection-microservice/app/create_user_graphs.py
+3
-3
user_cluster.py
...community-detection-microservice/app/rest/user_cluster.py
+8
-0
No files found.
src/data-hub/community-detection-microservice/app/configs/swagger.yml
View file @
60dfb9eb
...
@@ -129,7 +129,20 @@ paths:
...
@@ -129,7 +129,20 @@ paths:
# responses:
# responses:
# 200:
# 200:
# description: "Successful operation"
# description: "Successful operation"
/user-cluster-graphs
:
get
:
operationId
:
"
rest.user_cluster.get"
tags
:
-
"
User
Graphs"
summary
:
"
Get
user
graphs
per
layer
per
cluster"
parameters
:
[]
responses
:
200
:
description
:
"
Successful
operation"
schema
:
$ref
:
"
#/definitions/UserClusterGraphCollection"
definitions
:
definitions
:
Location
:
Location
:
type
:
"
object"
type
:
"
object"
...
@@ -163,8 +176,6 @@ definitions:
...
@@ -163,8 +176,6 @@ definitions:
type
:
array
type
:
array
items
:
items
:
$ref
:
"
#/definitions/Location"
$ref
:
"
#/definitions/Location"
# example:
# 0: [1dc61b1a0602de0eaee9dba7eece9279c2844202, b4b31bbe5e12f55737e3a910827c81595fbca3eb]
LocationClusterCollection
:
LocationClusterCollection
:
type
:
array
type
:
array
...
@@ -186,10 +197,31 @@ definitions:
...
@@ -186,10 +197,31 @@ definitions:
type
:
array
type
:
array
items
:
items
:
$ref
:
"
#/definitions/Location"
$ref
:
"
#/definitions/Location"
# example:
# 0: [1dc61b1a0602de0eaee9dba7eece9279c2844202, b4b31bbe5e12f55737e3a910827c81595fbca3eb]
TimeClusterCollection
:
TimeClusterCollection
:
type
:
array
type
:
array
items
:
items
:
$ref
:
"
#/definitions/TimeCluster"
$ref
:
"
#/definitions/TimeCluster"
\ No newline at end of file
UserClusterGraph
:
type
:
object
properties
:
nodes
:
type
:
array
items
:
type
:
string
edges
:
type
:
array
items
:
type
:
array
items
:
type
:
string
example
:
-
user1
-
user2
-
weight
UserClusterGraphCollection
:
type
:
array
items
:
$ref
:
"
#/definitions/UserClusterGraph"
\ No newline at end of file
src/data-hub/community-detection-microservice/app/create_user_graphs.py
View file @
60dfb9eb
...
@@ -24,13 +24,13 @@ def get_edges_with_weights(g: Graph) -> List[Tuple[Any, Any, int]]:
...
@@ -24,13 +24,13 @@ def get_edges_with_weights(g: Graph) -> List[Tuple[Any, Any, int]]:
return
res
return
res
def
create_graphs_for_clusters
():
def
create_graphs_for_
location_
clusters
():
graphs_for_clusters
=
[]
graphs_for_clusters
=
[]
ug
=
UserGraphGenerator
()
ug
=
UserGraphGenerator
()
clusters
:
Cluster
=
repo
.
get_location_clusters
()
clusters
:
Cluster
=
repo
.
get_location_clusters
()
for
cluster
in
clusters
[
11
:
12
]
:
for
cluster
in
clusters
:
user_ids
=
[
n
[
'user'
]
for
n
in
cluster
.
nodes
]
user_ids
=
[
n
[
'user'
]
for
n
in
cluster
.
nodes
]
graph
:
Graph
=
ug
.
create_graph_from_nodes
(
user_ids
)
graph
:
Graph
=
ug
.
create_graph_from_nodes
(
user_ids
)
...
@@ -49,4 +49,4 @@ def store_graphs(graphs: List):
...
@@ -49,4 +49,4 @@ def store_graphs(graphs: List):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
create_graphs_for_clusters
()
create_graphs_for_
location_
clusters
()
src/data-hub/community-detection-microservice/app/rest/user_cluster.py
0 → 100644
View file @
60dfb9eb
from
flask
import
request
,
Response
from
db.repository
import
Repository
repo
=
Repository
()
def
get
():
data
=
repo
.
get_user_cluster_graphs
()
return
[
d
.
to_serializable_dict
()
for
d
in
data
]
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