Commit 3a20813c authored by Luca Braun's avatar Luca Braun

Cluster querying

parent 79524c0c
2021/03/15-11:05:30.990 e04 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.cba95e9d\flutter_tools_chrome_device.e3043b12\Default\AutofillStrikeDatabase/MANIFEST-000001 2021/03/15-14:11:37.409 2e54 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6980f546\flutter_tools_chrome_device.99ecf2dc\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/15-11:05:30.991 e04 Recovering log #3
2021/03/15-11:05:30.991 e04 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.cba95e9d\flutter_tools_chrome_device.e3043b12\Default\AutofillStrikeDatabase/000003.log
2021/03/15-11:05:30.987 e04 Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.cba95e9d\flutter_tools_chrome_device.e3043b12\Default\BudgetDatabase/MANIFEST-000001 2021/03/15-14:11:37.379 1fec Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6980f546\flutter_tools_chrome_device.99ecf2dc\Default\BudgetDatabase/MANIFEST-000001
2021/03/15-11:05:30.988 e04 Recovering log #3
2021/03/15-11:05:30.988 e04 Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.cba95e9d\flutter_tools_chrome_device.e3043b12\Default\BudgetDatabase/000003.log
...@@ -14894,7 +14894,7 @@ define(['dart_sdk', 'packages/flutter/src/painting/basic_types.dart', 'packages/ ...@@ -14894,7 +14894,7 @@ define(['dart_sdk', 'packages/flutter/src/painting/basic_types.dart', 'packages/
isStructuredErrorsEnabled() { isStructuredErrorsEnabled() {
let enabled = false; let enabled = false;
if (!dart.test(dart.fn(() => { if (!dart.test(dart.fn(() => {
enabled = true; enabled = false;
return true; return true;
}, T$.VoidTobool())())) dart.assertFailed(null, I[2], 963, 12, "() {\r\n // TODO(kenz): add support for structured errors on the web.\r\n enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb);\r\n return true;\r\n }()"); }, T$.VoidTobool())())) dart.assertFailed(null, I[2], 963, 12, "() {\r\n // TODO(kenz): add support for structured errors on the web.\r\n enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb);\r\n return true;\r\n }()");
return enabled; return enabled;
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
"languageVersion": "2.7" "languageVersion": "2.7"
} }
], ],
"generated": "2021-03-15T10:04:26.892758Z", "generated": "2021-03-15T13:10:54.177879Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.12.0" "generatorVersion": "2.12.0"
} }
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 11:39:35.547471","version":"2.0.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 14:15:50.497365","version":"2.0.1"}
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# For more info see: https://dart.dev/go/dot-packages-deprecation # For more info see: https://dart.dev/go/dot-packages-deprecation
# #
# Generated by pub on 2021-03-15 11:04:26.861778. # Generated by pub on 2021-03-15 14:10:54.143901.
apex_flutter_sdk:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/apex_flutter_sdk-1.1.1+1/lib/ apex_flutter_sdk:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/apex_flutter_sdk-1.1.1+1/lib/
archive:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/ archive:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/ args:file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
......
...@@ -2,6 +2,7 @@ import 'dart:math'; ...@@ -2,6 +2,7 @@ import 'dart:math';
import 'package:circlegraph/circlegraph.dart'; import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/data/communityGraphNodeData.dart'; import 'package:dashboard/data/communityGraphNodeData.dart';
import 'package:dashboard/querying/cluster.dart';
import 'package:dashboard/querying/datagetter.dart'; import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/graphing/postnode.dart'; import 'package:dashboard/graphing/postnode.dart';
import 'package:dashboard/ui/graphs/community/index.dart'; import 'package:dashboard/ui/graphs/community/index.dart';
...@@ -104,6 +105,7 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> { ...@@ -104,6 +105,7 @@ class _CommunityMetaGraphState extends State<CommunityMetaGraph> {
class CommunityMetaGraphViewPage extends StatelessWidget { class CommunityMetaGraphViewPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ClusterGetter().getNodesfromLayer("Upvotes_Layer");
return Scaffold( return Scaffold(
appBar: LoggedInAppBar("Communities"), appBar: LoggedInAppBar("Communities"),
backgroundColor: ColorHolder.color3, backgroundColor: ColorHolder.color3,
......
...@@ -7,6 +7,8 @@ import 'package:dashboard/util/user.dart'; ...@@ -7,6 +7,8 @@ import 'package:dashboard/util/user.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart'; import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'graphing/communitymetagraph.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
} }
...@@ -35,7 +37,7 @@ class _MyAppState extends State<MyApp> { ...@@ -35,7 +37,7 @@ class _MyAppState extends State<MyApp> {
rememberFutureResult: false, rememberFutureResult: false,
whenDone: (BackendUser snapshotData) { whenDone: (BackendUser snapshotData) {
if (snapshotData == null) return LoginPage(); if (snapshotData == null) return LoginPage();
return CommunityGraphViewPage("worldnews"); return CommunityMetaGraphViewPage();
}, },
), ),
); );
......
import 'package:dashboard/data/post.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart';
import 'package:logger/logger.dart';
class ClusterGetter { class ClusterGetter {
Future<Map<String, dynamic>> getClusters(String layerName) async { Future<Map<String, dynamic>> getNodesfromLayer(String layerName) async {
String url = String url =
"https://articonf1.itec.aau.at:30401/api/use-cases/reddit/tables/reddit/layers/" + "https://articonf1.itec.aau.at:30101/api/use-cases/reddit/tables/reddit/layers/$layerName/nodes";
layerName + Logger().i(url);
"/clusters";
BackendUser user = await LoginHelper().loggedInUser;
String token = user.token;
Logger().i(token);
Map<String, dynamic> headers = {"Authorization": "Bearer $token"};
List<dynamic> nodesList =
await DataGetter.getJsonList(url, headers: headers);
Logger().i(nodesList.toString());
Map<String, List<Post>> resultMap = {};
String credentials; for (Map<String, dynamic> entry in nodesList) {
if (resultMap[entry["subreddit"]] == null)
resultMap[entry["subreddit"]] = [];
//new File("") resultMap[entry["subreddit"]].add(Post(
entry["title"],
entry["content"],
entry["user_id"],
entry["subreddit"],
entry["percentage_upvoted"],
entry["n_comments"]));
}
Logger().i(resultMap.toString());
return resultMap;
}
//http.Response tokenResponse = await http.post() Future<Map<String, dynamic>> getClusters() async {
List<String> layers = [
"Upvotes_Layer",
"Percentage_Layer",
"Engagement_Layer",
"Time_Layer",
];
//Map<String, dynamic> clusters = await http.get(url, ) Map<String, dynamic> clusterMap = {};
for (String layer in layers) {
clusterMap[layer] = await getNodesfromLayer(layer);
}
Logger().i(clusterMap.toString());
return clusterMap;
} }
} }
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
...@@ -27,6 +29,29 @@ class DataGetter { ...@@ -27,6 +29,29 @@ class DataGetter {
return jsonDecode(response.body) as Map<String, dynamic>; return jsonDecode(response.body) as Map<String, dynamic>;
} }
static Future<List<dynamic>> getJsonList(
String url, {
Map<String, dynamic> headers,
}) async {
BackendUser user = await LoginHelper().loggedInUser;
http.Response response = await http.get(
url,
headers: {
HttpHeaders.authorizationHeader: "Bearer ${user.token}",
},
);
if (response.statusCode != 200) {
Logger().e("Http request code != 200\nActual:\t" +
response.statusCode.toString());
throw HttpException(
"Status code is not 200 but " + response.statusCode.toString());
}
return jsonDecode(response.body) as List<dynamic>;
}
static Future<Map<String, dynamic>> postJson(String url, String body, static Future<Map<String, dynamic>> postJson(String url, String body,
{Map<String, dynamic> headers}) async { {Map<String, dynamic> headers}) async {
http.Response response; http.Response response;
...@@ -117,7 +142,7 @@ class DataGetter { ...@@ -117,7 +142,7 @@ class DataGetter {
for (var entry in communities.entries) { for (var entry in communities.entries) {
Community results = await getCommunity(entry.key); Community results = await getCommunity(entry.key);
Logger().i(results.toString()); //Logger().i(results.toString());
communityList.add(results); communityList.add(results);
} }
...@@ -127,7 +152,7 @@ class DataGetter { ...@@ -127,7 +152,7 @@ class DataGetter {
// communityList.add(results); // communityList.add(results);
//}); //});
Logger().i(communityList.toString()); //Logger().i(communityList.toString());
return communityList; return communityList;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment