ORE Studio 0.0.4
Loading...
Searching...
No Matches
data_organization_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_DATA_ORGANIZATION_SERVICE_HPP
21#define ORES_DQ_SERVICE_DATA_ORGANIZATION_SERVICE_HPP
22
23#include <string>
24#include <vector>
25#include <optional>
26#include "ores.logging/make_logger.hpp"
27#include "ores.database/domain/context.hpp"
28#include "ores.dq/domain/catalog.hpp"
29#include "ores.dq/domain/dataset_dependency.hpp"
30#include "ores.dq/domain/data_domain.hpp"
31#include "ores.dq/domain/subject_area.hpp"
32#include "ores.dq/repository/catalog_repository.hpp"
33#include "ores.dq/repository/dataset_dependency_repository.hpp"
34#include "ores.dq/repository/data_domain_repository.hpp"
35#include "ores.dq/repository/subject_area_repository.hpp"
36
37namespace ores::dq::service {
38
47private:
48 inline static std::string_view logger_name =
49 "ores.dq.service.data_organization_service";
50
51 [[nodiscard]] static auto& lg() {
52 using namespace ores::logging;
53 static auto instance = make_logger(logger_name);
54 return instance;
55 }
56
57public:
59
66
67 // ========================================================================
68 // Catalog Management
69 // ========================================================================
70
74 std::vector<domain::catalog> list_catalogs();
75
79 std::vector<domain::catalog>
80 list_catalogs(std::uint32_t offset, std::uint32_t limit);
81
85 std::uint32_t get_catalog_count();
86
90 std::optional<domain::catalog> find_catalog(const std::string& name);
91
97 void save_catalog(const domain::catalog& catalog);
98
104 void remove_catalog(const std::string& name);
105
112 std::vector<domain::catalog> get_catalog_history(const std::string& name);
113
114 // ========================================================================
115 // Dataset Dependency Management
116 // ========================================================================
117
121 std::vector<domain::dataset_dependency> list_dataset_dependencies();
122
127 std::vector<domain::dataset_dependency>
128 list_dataset_dependencies_by_dataset(const std::string& dataset_code);
129
130 // ========================================================================
131 // Data Domain Management
132 // ========================================================================
133
137 std::vector<domain::data_domain> list_data_domains();
138
142 std::optional<domain::data_domain> find_data_domain(const std::string& name);
143
149 void save_data_domain(const domain::data_domain& data_domain);
150
156 void remove_data_domain(const std::string& name);
157
164 std::vector<domain::data_domain> get_data_domain_history(const std::string& name);
165
166 // ========================================================================
167 // Subject Area Management
168 // ========================================================================
169
173 std::vector<domain::subject_area> list_subject_areas();
174
178 std::vector<domain::subject_area>
179 list_subject_areas(std::uint32_t offset, std::uint32_t limit);
180
184 std::vector<domain::subject_area>
185 list_subject_areas_by_domain(const std::string& domain_name);
186
190 std::uint32_t get_subject_area_count();
191
195 std::optional<domain::subject_area>
196 find_subject_area(const std::string& name, const std::string& domain_name);
197
203 void save_subject_area(const domain::subject_area& subject_area);
204
211 void remove_subject_area(const std::string& name,
212 const std::string& domain_name);
213
221 std::vector<domain::subject_area>
222 get_subject_area_history(const std::string& name,
223 const std::string& domain_name);
224
225private:
226 repository::catalog_repository catalog_repo_;
227 repository::dataset_dependency_repository dataset_dependency_repo_;
228 repository::data_domain_repository data_domain_repo_;
229 repository::subject_area_repository subject_area_repo_;
230};
231
232}
233
234#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 logical grouping of related datasets.
Definition catalog.hpp:39
Represents a high-level classification of data within the system.
Definition data_domain.hpp:40
Represents a subdivision within a data domain.
Definition subject_area.hpp:38
Reads and writes catalogs to data storage.
Definition catalog_repository.hpp:35
Reads and writes data_domains to data storage.
Definition data_domain_repository.hpp:35
Reads dataset dependencies from data storage.
Definition dataset_dependency_repository.hpp:35
Reads and writes subject_areas to data storage.
Definition subject_area_repository.hpp:35
Service for managing data organization entities.
Definition data_organization_service.hpp:46
std::uint32_t get_catalog_count()
Gets the total count of active catalogs.
Definition data_organization_service.cpp:49
std::vector< domain::subject_area > list_subject_areas()
Lists all subject areas.
Definition data_organization_service.cpp:148
void save_data_domain(const domain::data_domain &data_domain)
Saves a data domain (creates or updates).
Definition data_organization_service.cpp:121
void save_subject_area(const domain::subject_area &subject_area)
Saves a subject area (creates or updates).
Definition data_organization_service.cpp:185
std::vector< domain::data_domain > list_data_domains()
Lists all data domains.
Definition data_organization_service.cpp:106
std::optional< domain::data_domain > find_data_domain(const std::string &name)
Finds a data domain by its name.
Definition data_organization_service.cpp:112
void remove_catalog(const std::string &name)
Removes a catalog.
Definition data_organization_service.cpp:72
std::vector< domain::catalog > list_catalogs()
Lists all catalogs.
Definition data_organization_service.cpp:36
std::vector< domain::dataset_dependency > list_dataset_dependencies_by_dataset(const std::string &dataset_code)
Lists dataset dependencies for a specific dataset.
Definition data_organization_service.cpp:95
void save_catalog(const domain::catalog &catalog)
Saves a catalog (creates or updates).
Definition data_organization_service.cpp:63
std::vector< domain::data_domain > get_data_domain_history(const std::string &name)
Gets the version history for a data domain.
Definition data_organization_service.cpp:138
void remove_subject_area(const std::string &name, const std::string &domain_name)
Removes a subject area.
Definition data_organization_service.cpp:199
std::vector< domain::subject_area > list_subject_areas_by_domain(const std::string &domain_name)
Lists subject areas for a specific domain.
Definition data_organization_service.cpp:162
std::vector< domain::dataset_dependency > list_dataset_dependencies()
Lists all dataset dependencies.
Definition data_organization_service.cpp:89
std::optional< domain::subject_area > find_subject_area(const std::string &name, const std::string &domain_name)
Finds a subject area by its composite key.
Definition data_organization_service.cpp:174
std::optional< domain::catalog > find_catalog(const std::string &name)
Finds a catalog by its name.
Definition data_organization_service.cpp:54
std::vector< domain::subject_area > get_subject_area_history(const std::string &name, const std::string &domain_name)
Gets the version history for a subject area.
Definition data_organization_service.cpp:208
void remove_data_domain(const std::string &name)
Removes a data domain.
Definition data_organization_service.cpp:131
std::uint32_t get_subject_area_count()
Gets the total count of active subject areas.
Definition data_organization_service.cpp:169
std::vector< domain::catalog > get_catalog_history(const std::string &name)
Gets the version history for a catalog.
Definition data_organization_service.cpp:79