From ee4f3969d6c2e7449bdf09147ac1c35245a9d9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Hn=C3=A1t?= Date: Mon, 31 Oct 2022 17:11:00 +0100 Subject: [PATCH 1/3] Created dashboard --- sports.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sports.json b/sports.json index c0c9900..e351588 100644 --- a/sports.json +++ b/sports.json @@ -18,7 +18,7 @@ "id":774718832212606976, "id_str":"774718832212606976", "name":"Express Youngstown", - "screen_name":"ExpressProsYO", + "screen_name":"ExpressProsYO", // twitter.com/{screen_name} "location":"5815 Market Street", "url":"http:\/\/apply.expresspros.com\/", "description":"Express Employment Professionals is one of the top staffing companies in the U.S. and Canada. WE want to help YOU succeed and find a job that you love!", From 3854eacf02c67531c6c68be1c6dc493c8112e82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Hn=C3=A1t?= Date: Mon, 31 Oct 2022 17:13:16 +0100 Subject: [PATCH 2/3] Added git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee9cf04 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./sports1.txt \ No newline at end of file From c28d961d8400fd6bf8c07adede33e91f2c7f085e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Hn=C3=A1t?= Date: Mon, 31 Oct 2022 17:14:03 +0100 Subject: [PATCH 3/3] Added everything --- template.py => dashboard.py | 16 +++++++++------- {template_static => dashboard_static}/index.html | 0 .../lib/charts.js | 0 .../lib/core.js | 0 .../lib/form.js | 0 .../lib/jqcloud-1.0.4.js | 0 .../lib/jquery-2.1.1.min.js | 0 .../lib/jquery.flot.categories.min.js | 0 .../lib/jquery.flot.min.js | 0 .../lib/jquery.flot.pie.js | 0 {template_static => dashboard_static}/lib/log.js | 0 .../lib/tweets.js | 0 .../lib/wordcloud.js | 0 .../style/grid.css | 0 .../style/layout.css | 0 .../style/theme.css | 0 .../style/wordcloud.css | 0 sports.json | 2 +- 18 files changed, 10 insertions(+), 8 deletions(-) rename template.py => dashboard.py (65%) rename {template_static => dashboard_static}/index.html (100%) rename {template_static => dashboard_static}/lib/charts.js (100%) rename {template_static => dashboard_static}/lib/core.js (100%) rename {template_static => dashboard_static}/lib/form.js (100%) rename {template_static => dashboard_static}/lib/jqcloud-1.0.4.js (100%) rename {template_static => dashboard_static}/lib/jquery-2.1.1.min.js (100%) rename {template_static => dashboard_static}/lib/jquery.flot.categories.min.js (100%) rename {template_static => dashboard_static}/lib/jquery.flot.min.js (100%) rename {template_static => dashboard_static}/lib/jquery.flot.pie.js (100%) rename {template_static => dashboard_static}/lib/log.js (100%) rename {template_static => dashboard_static}/lib/tweets.js (100%) rename {template_static => dashboard_static}/lib/wordcloud.js (100%) rename {template_static => dashboard_static}/style/grid.css (100%) rename {template_static => dashboard_static}/style/layout.css (100%) rename {template_static => dashboard_static}/style/theme.css (100%) rename {template_static => dashboard_static}/style/wordcloud.css (100%) diff --git a/template.py b/dashboard.py similarity index 65% rename from template.py rename to dashboard.py index edcfb4c..5574203 100644 --- a/template.py +++ b/dashboard.py @@ -1,18 +1,20 @@ from eca import * +from eca.generators import start_offline_tweets import random ## You might have to update the root path to point to the correct path ## (by default, it points to _static) -# root_content_path = 'template_static' +root_content_path = 'dashboard_static' # binds the 'setup' function as the action for the 'init' event # the action will be called with the context and the event @event('init') def setup(ctx, e): + start_offline_tweets('sports1.txt', event_name="sample") ctx.count = 0 - fire('sample', {'previous': 0.0}) + # fire('sample', {'previous': 0.0}) # define a normal Python function @@ -24,16 +26,16 @@ def generate_sample(ctx, e): ctx.count += 1 if ctx.count % 50 == 0: emit('debug', {'text': 'Log message #'+str(ctx.count)+'!'}) - + tweet = e.data + print(tweet) # base sample on previous one - sample = clip(-100, e.data['previous'] + random.uniform(+5.0, -5.0), 100) - + # sample = clip(-100, e.data['previous'] + random.uniform(+5.0, -5.0), 100) # emit to outside world emit('sample',{ 'action': 'add', - 'value': sample + 'value': tweet }) # chain event - fire('sample', {'previous': sample}, delay=0.05) + fire('sample', {'previous': tweet}, delay=0.05) diff --git a/template_static/index.html b/dashboard_static/index.html similarity index 100% rename from template_static/index.html rename to dashboard_static/index.html diff --git a/template_static/lib/charts.js b/dashboard_static/lib/charts.js similarity index 100% rename from template_static/lib/charts.js rename to dashboard_static/lib/charts.js diff --git a/template_static/lib/core.js b/dashboard_static/lib/core.js similarity index 100% rename from template_static/lib/core.js rename to dashboard_static/lib/core.js diff --git a/template_static/lib/form.js b/dashboard_static/lib/form.js similarity index 100% rename from template_static/lib/form.js rename to dashboard_static/lib/form.js diff --git a/template_static/lib/jqcloud-1.0.4.js b/dashboard_static/lib/jqcloud-1.0.4.js similarity index 100% rename from template_static/lib/jqcloud-1.0.4.js rename to dashboard_static/lib/jqcloud-1.0.4.js diff --git a/template_static/lib/jquery-2.1.1.min.js b/dashboard_static/lib/jquery-2.1.1.min.js similarity index 100% rename from template_static/lib/jquery-2.1.1.min.js rename to dashboard_static/lib/jquery-2.1.1.min.js diff --git a/template_static/lib/jquery.flot.categories.min.js b/dashboard_static/lib/jquery.flot.categories.min.js similarity index 100% rename from template_static/lib/jquery.flot.categories.min.js rename to dashboard_static/lib/jquery.flot.categories.min.js diff --git a/template_static/lib/jquery.flot.min.js b/dashboard_static/lib/jquery.flot.min.js similarity index 100% rename from template_static/lib/jquery.flot.min.js rename to dashboard_static/lib/jquery.flot.min.js diff --git a/template_static/lib/jquery.flot.pie.js b/dashboard_static/lib/jquery.flot.pie.js similarity index 100% rename from template_static/lib/jquery.flot.pie.js rename to dashboard_static/lib/jquery.flot.pie.js diff --git a/template_static/lib/log.js b/dashboard_static/lib/log.js similarity index 100% rename from template_static/lib/log.js rename to dashboard_static/lib/log.js diff --git a/template_static/lib/tweets.js b/dashboard_static/lib/tweets.js similarity index 100% rename from template_static/lib/tweets.js rename to dashboard_static/lib/tweets.js diff --git a/template_static/lib/wordcloud.js b/dashboard_static/lib/wordcloud.js similarity index 100% rename from template_static/lib/wordcloud.js rename to dashboard_static/lib/wordcloud.js diff --git a/template_static/style/grid.css b/dashboard_static/style/grid.css similarity index 100% rename from template_static/style/grid.css rename to dashboard_static/style/grid.css diff --git a/template_static/style/layout.css b/dashboard_static/style/layout.css similarity index 100% rename from template_static/style/layout.css rename to dashboard_static/style/layout.css diff --git a/template_static/style/theme.css b/dashboard_static/style/theme.css similarity index 100% rename from template_static/style/theme.css rename to dashboard_static/style/theme.css diff --git a/template_static/style/wordcloud.css b/dashboard_static/style/wordcloud.css similarity index 100% rename from template_static/style/wordcloud.css rename to dashboard_static/style/wordcloud.css diff --git a/sports.json b/sports.json index e351588..c0c9900 100644 --- a/sports.json +++ b/sports.json @@ -18,7 +18,7 @@ "id":774718832212606976, "id_str":"774718832212606976", "name":"Express Youngstown", - "screen_name":"ExpressProsYO", // twitter.com/{screen_name} + "screen_name":"ExpressProsYO", "location":"5815 Market Street", "url":"http:\/\/apply.expresspros.com\/", "description":"Express Employment Professionals is one of the top staffing companies in the U.S. and Canada. WE want to help YOU succeed and find a job that you love!",