Download web/src/controllers/DashboardController.php from datamatters24/research-document-archive: direct link, hf CLI and curl.
- Browser
- Download file 2.81 kB
-
https://huggingface.co/datamatters24/research-document-archive/resolve/main/web/src/controllers/DashboardController.php
- Command line
-
hf download hf://datamatters24/research-document-archive/web/src/controllers/DashboardController.php
-
curl -L -o DashboardController.php https://huggingface.co/datamatters24/research-document-archive/resolve/main/web/src/controllers/DashboardController.php
2.81 kB
| declare(strict_types=1); | |
| class DashboardController | |
| { | |
| public function index(): void | |
| { | |
| $db = Database::getInstance(); | |
| // Collection summary | |
| $collectionSummary = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'collection_summary'"); | |
| if (!empty($row[0]['value'])) { | |
| $collectionSummary = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Topic profiles | |
| $topicProfiles = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'topic_profiles'"); | |
| if (!empty($row[0]['value'])) { | |
| $topicProfiles = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Collection similarity | |
| $similarities = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'collection_similarity'"); | |
| if (!empty($row[0]['value'])) { | |
| $similarities = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Bridge entities (PERSON) | |
| $bridgePersons = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'bridge_entities_person'"); | |
| if (!empty($row[0]['value'])) { | |
| $bridgePersons = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Bridge entities (ORG) | |
| $bridgeOrgs = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'bridge_entities_org'"); | |
| if (!empty($row[0]['value'])) { | |
| $bridgeOrgs = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Sentiment summary | |
| $sentimentSummary = []; | |
| try { | |
| $row = $db->fetchAll("SELECT value FROM analytics_cache WHERE key = 'sentiment_summary'"); | |
| if (!empty($row[0]['value'])) { | |
| $sentimentSummary = json_decode($row[0]['value'], true) ?: []; | |
| } | |
| } catch (\PDOException $e) {} | |
| // Stamp distribution | |
| $stamps = []; | |
| try { | |
| $stamps = $db->fetchAll(" | |
| SELECT stamp->>'stamp' as classification, COUNT(*) as doc_count | |
| FROM document_features, | |
| jsonb_array_elements(feature_json->'stamps') as stamp | |
| WHERE feature_name = 'forensic_metadata' | |
| GROUP BY stamp->>'stamp' | |
| ORDER BY doc_count DESC | |
| "); | |
| } catch (\PDOException $e) {} | |
| require __DIR__ . '/../views/dashboard.php'; | |
| } | |
| } | |