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_CORE_SERVICE_DATASET_SERVICE_HPP
21#define ORES_DQ_CORE_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.api/domain/dataset.hpp"
30#include "ores.dq.api/domain/methodology.hpp"
31#include "ores.dq.core/repository/dataset_repository.hpp"
32#include "ores.dq.core/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 save_datasets(const std::vector<domain::dataset>& datasets);
102
108 void remove_dataset(const boost::uuids::uuid& id);
109
116 std::vector<domain::dataset>
117 get_dataset_history(const boost::uuids::uuid& id);
118
119 // ========================================================================
120 // Methodology Management
121 // ========================================================================
122
126 std::vector<domain::methodology> list_methodologies();
127
131 std::vector<domain::methodology>
132 list_methodologies(std::uint32_t offset, std::uint32_t limit);
133
137 std::uint32_t get_methodology_count();
138
142 std::optional<domain::methodology>
143 find_methodology(const boost::uuids::uuid& id);
144
150 void save_methodology(const domain::methodology& methodology);
151
157 void save_methodologies(const std::vector<domain::methodology>& methodologies);
158
164 void remove_methodology(const boost::uuids::uuid& id);
165
172 std::vector<domain::methodology>
173 get_methodology_history(const boost::uuids::uuid& id);
174
175private:
176 repository::dataset_repository dataset_repo_;
177 repository::methodology_repository methodology_repo_;
178};
179
180}
181
182#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Context for the operations on a postgres database.
Definition context.hpp:47
Represents a data quality dataset with lineage tracking.
Definition dataset.hpp:37
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:97
std::vector< domain::dataset > get_dataset_history(const boost::uuids::uuid &id)
Gets the version history for a dataset.
Definition dataset_service.cpp:88
std::uint32_t get_methodology_count()
Gets the total count of active methodologies.
Definition dataset_service.cpp:109
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:143
void save_datasets(const std::vector< domain::dataset > &datasets)
Saves multiple datasets (creates or updates).
Definition dataset_service.cpp:71
void remove_dataset(const boost::uuids::uuid &id)
Removes a dataset.
Definition dataset_service.cpp:81
void save_dataset(const domain::dataset &dataset)
Saves a dataset (creates or updates).
Definition dataset_service.cpp:62
void save_methodologies(const std::vector< domain::methodology > &methodologies)
Saves multiple methodologies (creates or updates).
Definition dataset_service.cpp:132
std::vector< domain::methodology > get_methodology_history(const boost::uuids::uuid &id)
Gets the version history for a methodology.
Definition dataset_service.cpp:150
void save_methodology(const domain::methodology &methodology)
Saves a methodology (creates or updates).
Definition dataset_service.cpp:123
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:114