ORE Studio 0.0.4
Loading...
Searching...
No Matches
dataset_service.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_DQ_SERVICE_DATASET_SERVICE_HPP
21#define ORES_DQ_SERVICE_DATASET_SERVICE_HPP
22
23#include <string>
24#include <vector>
25#include <optional>
26#include <boost/uuid/uuid.hpp>
27#include "ores.logging/make_logger.hpp"
28#include "ores.database/domain/context.hpp"
29#include "ores.dq/domain/dataset.hpp"
30#include "ores.dq/domain/methodology.hpp"
31#include "ores.dq/repository/dataset_repository.hpp"
32#include "ores.dq/repository/methodology_repository.hpp"
33
34namespace ores::dq::service {
35
44private:
45 inline static std::string_view logger_name =
46 "ores.dq.service.dataset_service";
47
48 [[nodiscard]] static auto& lg() {
49 using namespace ores::logging;
50 static auto instance = make_logger(logger_name);
51 return instance;
52 }
53
54public:
56
62 explicit dataset_service(context ctx);
63
64 // ========================================================================
65 // Dataset Management
66 // ========================================================================
67
71 std::vector<domain::dataset> list_datasets();
72
76 std::vector<domain::dataset>
77 list_datasets(std::uint32_t offset, std::uint32_t limit);
78
82 std::uint32_t get_dataset_count();
83
87 std::optional<domain::dataset> find_dataset(const boost::uuids::uuid& id);
88
94 void save_dataset(const domain::dataset& dataset);
95
101 void remove_dataset(const boost::uuids::uuid& id);
102
109 std::vector<domain::dataset>
110 get_dataset_history(const boost::uuids::uuid& id);
111
112 // ========================================================================
113 // Methodology Management
114 // ========================================================================
115
119 std::vector<domain::methodology> list_methodologies();
120
124 std::vector<domain::methodology>
125 list_methodologies(std::uint32_t offset, std::uint32_t limit);
126
130 std::uint32_t get_methodology_count();
131
135 std::optional<domain::methodology>
136 find_methodology(const boost::uuids::uuid& id);
137
143 void save_methodology(const domain::methodology& methodology);
144
150 void remove_methodology(const boost::uuids::uuid& id);
151
158 std::vector<domain::methodology>
159 get_methodology_history(const boost::uuids::uuid& id);
160
161private:
162 repository::dataset_repository dataset_repo_;
163 repository::methodology_repository methodology_repo_;
164};
165
166}
167
168#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Context for the operations on a postgres database.
Definition context.hpp:30
Represents a data quality dataset with lineage tracking.
Definition dataset.hpp:36
Describes a methodology for data processing or transformation.
Definition methodology.hpp:33
Reads and writes datasets to data storage.
Definition dataset_repository.hpp:36
Reads and writes methodologies to data storage.
Definition methodology_repository.hpp:36
Service for managing datasets and methodologies.
Definition dataset_service.hpp:43
std::vector< domain::methodology > list_methodologies()
Lists all methodologies.
Definition dataset_service.cpp:87
std::vector< domain::dataset > get_dataset_history(const boost::uuids::uuid &id)
Gets the version history for a dataset.
Definition dataset_service.cpp:78
std::uint32_t get_methodology_count()
Gets the total count of active methodologies.
Definition dataset_service.cpp:99
std::uint32_t get_dataset_count()
Gets the total count of active datasets.
Definition dataset_service.cpp:48
std::vector< domain::dataset > list_datasets()
Lists all datasets.
Definition dataset_service.cpp:36
void remove_methodology(const boost::uuids::uuid &id)
Removes a methodology.
Definition dataset_service.cpp:122
void remove_dataset(const boost::uuids::uuid &id)
Removes a dataset.
Definition dataset_service.cpp:71
void save_dataset(const domain::dataset &dataset)
Saves a dataset (creates or updates).
Definition dataset_service.cpp:62
std::vector< domain::methodology > get_methodology_history(const boost::uuids::uuid &id)
Gets the version history for a methodology.
Definition dataset_service.cpp:129
void save_methodology(const domain::methodology &methodology)
Saves a methodology (creates or updates).
Definition dataset_service.cpp:113
std::optional< domain::dataset > find_dataset(const boost::uuids::uuid &id)
Finds a dataset by its ID.
Definition dataset_service.cpp:53
std::optional< domain::methodology > find_methodology(const boost::uuids::uuid &id)
Finds a methodology by its ID.
Definition dataset_service.cpp:104