ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
survey_service.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
10
11#include "reusex/core/ProjectDB.hpp"
12#include "reusex/core/survey.hpp"
13
14#include <cstddef>
15#include <map>
16#include <optional>
17#include <string>
18#include <vector>
19
20namespace reusex::core {
21
22std::map<int64_t, EnvironmentStatus>
23environment_statuses(const ProjectDB &db); // every type
27 ReviewStatus status);
30std::vector<ProjectDB::SurveyPartRecord>
31set_type_quantity(ProjectDB &db, int64_t type_id, double total);
32std::vector<TypeTotals>
33type_totals(const ProjectDB &db); // one per survey type, same order
38 const ProjectDB::SamplePatch &patch);
39
48
56std::vector<ReportSurveyRow> report_survey_rows(const ProjectDB &db);
57
60 std::string instances_cloud =
61 std::string(kDefaultInstanceCloud); // mirrors `rux create materials`
62 std::string semantic_cloud = "labels";
63 std::string rooms_cloud = "rooms";
64};
65
67 std::size_t types_created = 0;
68 std::size_t parts_created = 0;
69 std::size_t parts_existing = 0;
72 std::size_t parts_dismissed = 0;
76 std::size_t instances_seen = 0;
80 std::size_t instances_backfilled = 0;
81 bool rooms_assigned = false;
86 std::size_t parts_orphaned = 0;
87 std::vector<std::string> orphaned_codes;
92 std::size_t links_restored = 0;
93};
94
107
108} // namespace reusex::core
Wire form of one stored report PDF version — the ReportPdfVersion schema in ruxd's API contract (docs...
EnvironmentStatus environment_status_of(const ProjectDB &db, int64_t type_id)
ProjectDB::SampleRecord update_sample_checked(ProjectDB &db, int64_t id, const ProjectDB::SamplePatch &patch)
Sample edit with the stage/result rule enforced (validate_sample_state on the merged state).
std::map< int64_t, EnvironmentStatus > environment_statuses(const ProjectDB &db)
SurveySyncReport sync_survey(ProjectDB &db, const SurveySyncOptions &opts={})
Fill survey_types / survey_parts from the instances table: one type per semantic class,...
constexpr std::string_view kDefaultInstanceCloud
Default name of the instance-label cloud sync_survey reads from, and the default SurveySyncOptions::i...
Definition survey.hpp:39
ProjectDB::SurveyTypeRecord set_review_status(ProjectDB &db, int64_t type_id, ReviewStatus status)
Approving a type whose miljøstatus is afventer throws SamplePendingError.
std::vector< ReportSurveyRow > report_survey_rows(const ProjectDB &db)
One row per reportable survey type, in id order, for the PDF report's survey section ("kun godkendte ...
std::vector< ProjectDB::SurveyPartRecord > set_type_quantity(ProjectDB &db, int64_t type_id, double total)
Scales the type's parts to sum to total (redistribute_quantity).
std::vector< TypeTotals > type_totals(const ProjectDB &db)
One survey type as the PDF report's Kortlægning section lists it.
std::optional< double > mass_t
Options for sync_survey — the cloud names it reads from.
Counts of what sync_survey changed.
std::size_t links_restored
Instance links put back: instance-backed parts that own a passport (survey_parts.passport_guid) but w...
std::size_t parts_dismissed
Instances skipped because the user deleted their part (tombstoned in survey_dismissed_instances,...
std::size_t parts_orphaned
Parts whose instance_guid no longer resolves to an instance row (the instance was dropped,...
std::vector< std::string > orphaned_codes
std::size_t instances_seen
Instance rows considered: parts_created + parts_existing + parts_dismissed.
std::size_t instances_backfilled
Instance rows sync wrote first because the cloud had labels but no instances rows: a cloud from befor...