ORE Studio 0.0.4
Loading...
Searching...
No Matches
DatasetViewDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_DATASET_VIEW_DIALOG_HPP
21#define ORES_QT_DATASET_VIEW_DIALOG_HPP
22
23#include <map>
24#include <vector>
25#include <QDialog>
26#include <QTabWidget>
27#include <QTreeWidget>
28#include <QTextBrowser>
29#include <QGraphicsView>
30#include <QGraphicsScene>
31#include "ores.dq/domain/dataset.hpp"
32#include "ores.dq/domain/methodology.hpp"
33#include "ores.dq/domain/dataset_dependency.hpp"
34#include "ores.logging/make_logger.hpp"
35
36namespace ores::qt {
37class ClientManager;
38}
39
40namespace ores::qt {
41
51class DatasetViewDialog : public QDialog {
52 Q_OBJECT
53
54 // QSS-styleable properties for lineage diagram
55 Q_PROPERTY(QColor lineageBackground MEMBER lineageBackground_)
56 Q_PROPERTY(QColor lineageNodeBody MEMBER lineageNodeBody_)
57 Q_PROPERTY(QColor lineageNodeBorder MEMBER lineageNodeBorder_)
58 Q_PROPERTY(QColor lineageText MEMBER lineageText_)
59 Q_PROPERTY(QColor lineageLabel MEMBER lineageLabel_)
60 Q_PROPERTY(QColor lineageValue MEMBER lineageValue_)
61 Q_PROPERTY(QColor lineageConnection MEMBER lineageConnection_)
62 Q_PROPERTY(QColor lineageSocket MEMBER lineageSocket_)
63 Q_PROPERTY(QColor lineageHeaderOrigin MEMBER lineageHeaderOrigin_)
64 Q_PROPERTY(QColor lineageHeaderMethod MEMBER lineageHeaderMethod_)
65 Q_PROPERTY(QColor lineageHeaderDataset MEMBER lineageHeaderDataset_)
66 Q_PROPERTY(QColor lineageHeaderCatalog MEMBER lineageHeaderCatalog_)
67 Q_PROPERTY(qreal lineageNodeWidth MEMBER lineageNodeWidth_)
68 Q_PROPERTY(qreal lineageHeaderHeight MEMBER lineageHeaderHeight_)
69 Q_PROPERTY(qreal lineageRowHeight MEMBER lineageRowHeight_)
70 Q_PROPERTY(qreal lineageNodeSpacing MEMBER lineageNodeSpacing_)
71 Q_PROPERTY(qreal lineageCornerRadius MEMBER lineageCornerRadius_)
72 Q_PROPERTY(qreal lineageSocketRadius MEMBER lineageSocketRadius_)
73 Q_PROPERTY(qreal lineagePadding MEMBER lineagePadding_)
74
75private:
76 inline static std::string_view logger_name = "ores.qt.dataset_view_dialog";
77
78 [[nodiscard]] static auto& lg() {
79 using namespace ores::logging;
80 static auto instance = make_logger(logger_name);
81 return instance;
82 }
83
84public:
85 explicit DatasetViewDialog(ClientManager* clientManager,
86 QWidget* parent = nullptr);
87 ~DatasetViewDialog() override;
88
89 void setDataset(const dq::domain::dataset& dataset);
90 void setMethodologies(const std::vector<dq::domain::methodology>& methodologies);
91 void setDatasetDependencies(
92 const std::vector<dq::domain::dataset_dependency>& dependencies);
93 void setDatasetNames(const std::map<std::string, std::string>& codeToName);
94
95private:
96 void setupUi();
97 QWidget* createOverviewTab();
98 QWidget* createProvenanceTab();
99 QWidget* createMethodologyTab();
100 QWidget* createLineageTab();
101
102 void updateOverviewTab();
103 void updateProvenanceTab();
104 void updateMethodologyTab();
105 void updateLineageView();
106
107 // Helper to add property to tree widget
108 void addProperty(QTreeWidget* tree, const QString& name, const QString& value,
109 const QString& tooltip = {});
110 void addSectionHeader(QTreeWidget* tree, const QString& title);
111
112 QString findMethodologyName(const std::optional<boost::uuids::uuid>& methodologyId) const;
113 const dq::domain::methodology* findMethodology(
114 const std::optional<boost::uuids::uuid>& methodologyId) const;
115
116 // Lineage diagram helper methods
117 qreal createLineageNode(QGraphicsScene* scene, qreal x, qreal y,
118 const QString& headerText, const QStringList& labels,
119 const QStringList& values, const QColor& headerColor,
120 bool hasInputSocket, bool hasOutputSocket) const;
121 void createLineageNodeBody(QGraphicsScene* scene, qreal x, qreal y,
122 qreal nodeHeight, const QString& tooltip) const;
123 void createLineageNodeHeader(QGraphicsScene* scene, qreal x, qreal y,
124 const QString& headerText, const QColor& headerColor,
125 const QString& tooltip) const;
126 void createLineageNodeProperties(QGraphicsScene* scene, qreal x, qreal y,
127 const QStringList& labels, const QStringList& values) const;
128 void createLineageNodeSockets(QGraphicsScene* scene, qreal x, qreal y,
129 qreal nodeHeight, bool hasInputSocket, bool hasOutputSocket) const;
130 void drawLineageConnection(QGraphicsScene* scene,
131 qreal x1, qreal y1, qreal x2, qreal y2) const;
132 void drawLabeledConnection(QGraphicsScene* scene,
133 qreal x1, qreal y1, qreal x2, qreal y2, const QString& label) const;
134
135 // Tab widget
136 QTabWidget* tabWidget_;
137
138 // Overview tab (General + Classification + Data Governance + Audit)
139 QTreeWidget* overviewTree_;
140
141 // Provenance tab
142 QTreeWidget* provenanceTree_;
143
144 // Methodology tab
145 QTreeWidget* methodologyTree_;
146 QTextBrowser* stepsText_;
147
148 // Lineage tab
149 QGraphicsView* lineageView_;
150
151 // Data
152 ClientManager* clientManager_;
153 dq::domain::dataset dataset_;
154 std::vector<dq::domain::methodology> methodologies_;
155 std::vector<dq::domain::dataset_dependency> datasetDependencies_;
156 std::map<std::string, std::string> datasetNames_; // code -> name lookup
157
158 // Lineage styling properties (QSS-configurable)
159 QColor lineageBackground_{0x2D, 0x2D, 0x30};
160 QColor lineageNodeBody_{0x3F, 0x3F, 0x46};
161 QColor lineageNodeBorder_{0x52, 0x52, 0x5B};
162 QColor lineageText_{0xFF, 0xFF, 0xFF};
163 QColor lineageLabel_{0xA1, 0xA1, 0xAA};
164 QColor lineageValue_{0xE4, 0xE4, 0xE7};
165 QColor lineageConnection_{0x71, 0x71, 0x7A};
166 QColor lineageSocket_{0x3B, 0x82, 0xF6};
167 QColor lineageHeaderOrigin_{0x3B, 0x82, 0xF6};
168 QColor lineageHeaderMethod_{0x8B, 0x5C, 0xF6};
169 QColor lineageHeaderDataset_{0x22, 0xC5, 0x5E};
170 QColor lineageHeaderCatalog_{0xF9, 0x73, 0x16}; // Orange for catalog
171 qreal lineageNodeWidth_{200}; // Wider to accommodate long dataset names
172 qreal lineageHeaderHeight_{18};
173 qreal lineageRowHeight_{14};
174 qreal lineageNodeSpacing_{60};
175 qreal lineageCornerRadius_{4};
176 qreal lineageSocketRadius_{4};
177 qreal lineagePadding_{4};
178};
179
180}
181
182#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Represents a data quality dataset with lineage tracking.
Definition dataset.hpp:36
Describes a methodology for data processing or transformation.
Definition methodology.hpp:33
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Dialog for viewing dataset details with tabbed interface.
Definition DatasetViewDialog.hpp:51