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
512fadca
Commit
512fadca
authored
Mar 24, 2020
by
Alex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added clustering config as yaml
parent
ee159e16
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
3 deletions
+67
-3
clustering.yaml
...munity-detection-microservice/app/configs/clustering.yaml
+8
-0
clusterer.py
...ction-microservice/app/processing/clustering/clusterer.py
+0
-0
clustering_config.py
...croservice/app/processing/clustering/clustering_config.py
+37
-0
cluster.py
...-hub/community-detection-microservice/app/rest/cluster.py
+1
-1
run_clustering.py
...ub/community-detection-microservice/app/run_clustering.py
+1
-1
test_clusterer.py
...munity-detection-microservice/app/tests/test_clusterer.py
+2
-1
test_clustering_config.py
...etection-microservice/app/tests/test_clustering_config.py
+18
-0
No files found.
src/data-hub/community-detection-microservice/app/configs/clustering.yaml
0 → 100644
View file @
512fadca
layers
:
user
:
properties
:
starting-point
:
properties
:
-
Latitude_StartingPoint
-
Longitude_StartingPoint
\ No newline at end of file
src/data-hub/community-detection-microservice/app/processing/clusterer.py
→
src/data-hub/community-detection-microservice/app/processing/cluster
ing/cluster
er.py
View file @
512fadca
File moved
src/data-hub/community-detection-microservice/app/processing/clustering/clustering_config.py
0 → 100644
View file @
512fadca
import
yaml
### init logging ###
import
logging
LOG_FORMAT
=
(
'
%(levelname) -5
s
%(asctime)
s
%(name)
s:
%(funcName) -35
s
%(lineno) -5
d:
%(message)
s'
)
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
LOG_FORMAT
)
LOGGER
=
logging
.
getLogger
(
__name__
)
class
ClusteringConfig
:
config_path
=
'configs/clustering.yaml'
config
:
dict
=
None
def
__init__
(
self
):
self
.
config
=
self
.
load_config
()
def
load_config
(
self
)
->
dict
:
config
=
None
with
open
(
self
.
config_path
,
'r'
)
as
stream
:
try
:
config
=
yaml
.
safe_load
(
stream
)
except
yaml
.
YAMLError
as
exc
:
LOGGER
.
error
(
exc
)
config
=
{}
return
config
def
get_config
(
self
):
return
self
.
config
def
get_layer_configs
(
self
):
for
key
,
layer
in
self
.
config
[
'layers'
]
.
items
():
layer
[
'layer-name'
]
=
key
yield
layer
src/data-hub/community-detection-microservice/app/rest/cluster.py
View file @
512fadca
import
io
import
io
from
flask
import
request
,
Response
from
flask
import
request
,
Response
from
db.repository
import
Repository
from
db.repository
import
Repository
from
processing.clusterer
import
Clusterer
from
processing.cluster
ing.cluster
er
import
Clusterer
from
matplotlib.backends.backend_agg
import
FigureCanvasAgg
as
FigureCanvas
from
matplotlib.backends.backend_agg
import
FigureCanvasAgg
as
FigureCanvas
repo
=
Repository
()
repo
=
Repository
()
...
...
src/data-hub/community-detection-microservice/app/run_clustering.py
View file @
512fadca
...
@@ -7,7 +7,7 @@ if os.path.exists(modules_path):
...
@@ -7,7 +7,7 @@ if os.path.exists(modules_path):
from
db.entities
import
Location
,
PopularLocation
,
LocationCluster
,
TimeCluster
from
db.entities
import
Location
,
PopularLocation
,
LocationCluster
,
TimeCluster
from
typing
import
List
,
Dict
,
Tuple
from
typing
import
List
,
Dict
,
Tuple
from
db.repository
import
Repository
from
db.repository
import
Repository
from
processing.clusterer
import
Clusterer
from
processing.cluster
ing.cluster
er
import
Clusterer
DEBUG
=
False
DEBUG
=
False
...
...
src/data-hub/community-detection-microservice/app/tests/test_clusterer.py
View file @
512fadca
import
unittest
import
unittest
import
sys
import
sys
sys
.
path
.
insert
(
1
,
'../'
)
sys
.
path
.
insert
(
1
,
'../'
)
# python -m unittest discover
# python -m unittest discover
from
processing.clusterer
import
Clusterer
from
processing.cluster
ing.cluster
er
import
Clusterer
class
TestClusterer
(
unittest
.
TestCase
):
class
TestClusterer
(
unittest
.
TestCase
):
clusterer
:
Clusterer
=
None
clusterer
:
Clusterer
=
None
...
...
src/data-hub/community-detection-microservice/app/tests/test_clustering_config.py
0 → 100644
View file @
512fadca
import
unittest
import
sys
sys
.
path
.
insert
(
1
,
'./'
)
# python -m unittest discover
from
processing.clustering.clustering_config
import
ClusteringConfig
class
TestClusteringConfig
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
clustering_config
=
ClusteringConfig
()
def
test_get_layer_configs_noneInput_noneOutput
(
self
):
for
layer_config
in
self
.
clustering_config
.
get_layer_configs
():
self
.
assertIn
(
'layer-name'
,
layer_config
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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