@piveau/dpi 0.2.0-alpha.5 → 0.2.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/dpi.css +1 -1
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/BasicInfosStep/ProjectDescriptionStep.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/BasicInfosStep/ProjectStatusStep.vue.js +18 -21
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Chip.vue.js +49 -41
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ChipToggleList/ChipToggleList.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ChipToggleList/ChipToggleList.vue2.js +30 -24
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataCollection/BasicInformationStep.vue.js +1 -1
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/DataCollection/BasicInformationStep.vue2.js +5 -5
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Findability/ApplicationsStep.vue.js +1 -1
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Findability/ApplicationsStep.vue2.js +63 -61
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Findability/DiscoverabilityStep.vue.js +47 -38
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/InputField/InputFieldFormKit.vue.js +33 -29
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ListBox/ListBoxDefinition.js +8 -3
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ListBox/ListBoxFormKit.vue.js +65 -37
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ListBox/Listbox.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ListBox/Listbox.vue2.js +21 -22
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/AreYouSureToSkipCard.vue.js +31 -0
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/AreYouSureToSkipCard.vue2.js +4 -0
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/DatasetStep.vue.js +3 -3
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/DatasetStep.vue2.js +72 -62
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/GetResource.vue.js +38 -0
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/GetResource.vue2.js +4 -0
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareStep.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/HardwareStep.vue2.js +76 -69
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/SoftwareStep.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/SoftwareStep.vue2.js +78 -91
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ProcessSteps/utils.js +27 -42
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Projektphasen/InitiierenStep.vue.js +17 -17
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Projektphasen/PlanenStep.vue.js +10 -10
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Projektphasen/ProjektPhasenOverviewStep.vue.js +1 -1
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Projektphasen/UmstezenStep.vue.js +16 -16
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/Projektphasen/WeiterdenkenStep.vue.js +13 -13
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ReviewStep/ReviewStep.vue.js +934 -0
- package/dist/packages/dpi/src/data-provider-interface/HappyFlowComponents/ui/ReviewStep/ReviewStep.vue2.js +4 -0
- package/dist/packages/dpi/src/data-provider-interface/components/ProgressSteps.vue.js +1 -1
- package/dist/packages/dpi/src/data-provider-interface/components/StepActionsSection.vue.js +2 -2
- package/dist/packages/dpi/src/data-provider-interface/components/StepActionsSection.vue2.js +75 -63
- package/dist/packages/dpi/src/data-provider-interface/components/TheCancelConfirmationDialog.vue.js +7 -0
- package/dist/packages/dpi/src/data-provider-interface/components/TheCancelConfirmationDialog.vue2.js +42 -0
- package/dist/packages/dpi/src/data-provider-interface/components/dev-tools/ProjectDpiDevTools.vue.js +7 -0
- package/dist/packages/dpi/src/data-provider-interface/components/dev-tools/ProjectDpiDevTools.vue2.js +249 -0
- package/dist/packages/dpi/src/data-provider-interface/components/dev-tools/fixtures.js +287 -0
- package/dist/packages/dpi/src/data-provider-interface/composables/project-transformer/__tests__/fixtures/theProjectForm.js +281 -0
- package/dist/packages/dpi/src/data-provider-interface/composables/project-transformer/decodeProject.js +244 -0
- package/dist/packages/dpi/src/data-provider-interface/composables/project-transformer/encodeProject.js +330 -0
- package/dist/packages/dpi/src/data-provider-interface/composables/project-transformer/shared.js +37 -0
- package/dist/packages/dpi/src/data-provider-interface/schema/projectLdSchema.js +114 -0
- package/dist/packages/dpi/src/data-provider-interface/views/InputPageProject.vue.js +387 -328
- package/dist/packages/dpi/src/stories/components/LinkCard.vue.js +3 -3
- package/dist/packages/dpi/src/stories/components/LinkCard.vue2.js +6 -6
- package/package.json +5 -2
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { pipe as z } from "effect";
|
|
2
|
+
import * as o from "effect/Option";
|
|
3
|
+
import * as O from "jsonld";
|
|
4
|
+
import { schemaProject as H } from "../../schema/projectLdSchema.js";
|
|
5
|
+
import { getFirstItem as G, extractStringValue as t, extractLocalizedString as j } from "../useDpiSimpleLoader.js";
|
|
6
|
+
import { isNonNullable as h } from "./encodeProject.js";
|
|
7
|
+
import { PREFIXES as N, nonEmpty as k } from "./shared.js";
|
|
8
|
+
async function V(i) {
|
|
9
|
+
const c = {
|
|
10
|
+
"@context": N,
|
|
11
|
+
"@type": "schema:Project"
|
|
12
|
+
}, a = await O.frame(i, c, {
|
|
13
|
+
embed: "@always",
|
|
14
|
+
omitGraph: !0
|
|
15
|
+
}), r = await O.compact(a, N, {
|
|
16
|
+
compactArrays: !1,
|
|
17
|
+
graph: !1
|
|
18
|
+
}), l = H.safeParse(G(r == null ? void 0 : r["@graph"]));
|
|
19
|
+
if (!l.success)
|
|
20
|
+
throw new Error("Failed to parse project");
|
|
21
|
+
return l.data;
|
|
22
|
+
}
|
|
23
|
+
function I(i) {
|
|
24
|
+
return k(G(i["@id"]));
|
|
25
|
+
}
|
|
26
|
+
function F(i, c) {
|
|
27
|
+
var r, l;
|
|
28
|
+
const { visibility: a } = c;
|
|
29
|
+
return {
|
|
30
|
+
"Auffindbarkeit/Sichtbarkeit": {
|
|
31
|
+
visibility: a
|
|
32
|
+
},
|
|
33
|
+
"Auffindbarkeit/Kategorien": {
|
|
34
|
+
categories: ((r = i["dcat:theme"]) == null ? void 0 : r.map(I).filter(h)) || []
|
|
35
|
+
},
|
|
36
|
+
"Auffindbarkeit/Anwendungsbereiche": {
|
|
37
|
+
applications: ((l = i["schema:application"]) == null ? void 0 : l.map(I).filter(h)) || []
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function K(i) {
|
|
42
|
+
var a;
|
|
43
|
+
const c = (a = i["dcat:contactPoint"]) == null ? void 0 : a.map((r) => ({
|
|
44
|
+
name: k(t(r["vcard:fn"])),
|
|
45
|
+
mail: k(t(r["vcard:hasEmail"])),
|
|
46
|
+
phone: k(t(r["vcard:hasTelephone"]))
|
|
47
|
+
})).filter(h);
|
|
48
|
+
return {
|
|
49
|
+
"Grundlegende Informationen/Name": {
|
|
50
|
+
projectName: z(
|
|
51
|
+
o.fromNullable(j(i["dct:title"], "de")),
|
|
52
|
+
o.flatMap((r) => k(r) ? o.some(r) : o.none()),
|
|
53
|
+
o.getOrThrowWith(() => new Error("Project name is missing"))
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
"Grundlegende Informationen/Beschreibung": {
|
|
57
|
+
projectDescription: z(
|
|
58
|
+
o.fromNullable(j(i["dct:description"], "de")),
|
|
59
|
+
o.flatMap((r) => k(r) ? o.some(r) : o.none()),
|
|
60
|
+
o.getOrThrowWith(() => new Error("Project description is missing"))
|
|
61
|
+
)
|
|
62
|
+
},
|
|
63
|
+
"Grundlegende Informationen/Projektstatus": {
|
|
64
|
+
projectName: z(
|
|
65
|
+
o.fromNullable(i["schema:status"]),
|
|
66
|
+
o.flatMap((r) => k(r) ? o.some(r) : o.none()),
|
|
67
|
+
o.getOrThrowWith(() => new Error("Project status is missing"))
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
"Grundlegende Informationen/Organisation": {
|
|
71
|
+
contact: G(c || []) || {
|
|
72
|
+
name: "",
|
|
73
|
+
mail: "",
|
|
74
|
+
phone: ""
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function U(i) {
|
|
80
|
+
var c, a, r, l, g, D, P;
|
|
81
|
+
return {
|
|
82
|
+
"Optionale Daten": {
|
|
83
|
+
partners: ((c = i["dct:contributor"]) == null ? void 0 : c.map((n) => ({
|
|
84
|
+
name: t(n["foaf:name"]),
|
|
85
|
+
url: t(n["foaf:homepage"])
|
|
86
|
+
})).filter(h)) || [],
|
|
87
|
+
requiredExpertise: ((a = i["schema:skills"]) == null ? void 0 : a.map(t).filter(h)) || [],
|
|
88
|
+
references: ((l = (r = i["dct:references"]) == null ? void 0 : r.filter((n) => n["dct:type"] === "image")) == null ? void 0 : l.map((n) => ({
|
|
89
|
+
homepage: t(n["schema:url"])
|
|
90
|
+
})).filter(h)) || [],
|
|
91
|
+
startDate: t(i["schema:startDate"] || ""),
|
|
92
|
+
endDate: t(i["schema:endDate"] || ""),
|
|
93
|
+
budget: t(((g = i["schema:amount"]) == null ? void 0 : g["schema:value"]) || ""),
|
|
94
|
+
// todo:
|
|
95
|
+
links: ((P = (D = i["dct:references"]) == null ? void 0 : D.filter((n) => n["dct:type"] === "documentation")) == null ? void 0 : P.map((n) => ({
|
|
96
|
+
name: t(n["dct:title"]),
|
|
97
|
+
url: t(n["schema:url"]),
|
|
98
|
+
description: t(n["dct:description"])
|
|
99
|
+
})).filter(h)) || []
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function q(i) {
|
|
104
|
+
const c = i["schema:hasPart"] ?? [], a = (d) => c.find((f) => f["dct:type"] === d), r = (d) => {
|
|
105
|
+
var b, m;
|
|
106
|
+
const f = /* @__PURE__ */ new Map(), v = (d == null ? void 0 : d["schema:question"]) ?? [];
|
|
107
|
+
for (const e of v) {
|
|
108
|
+
const u = (b = e["schema:text"]) == null ? void 0 : b.trim(), w = (m = e["schema:acceptedAnswer"]) == null ? void 0 : m.trim();
|
|
109
|
+
u && w && f.set(u, w);
|
|
110
|
+
}
|
|
111
|
+
return f;
|
|
112
|
+
}, l = {
|
|
113
|
+
projectTriggers: "Was waren Ausloeser fuer das Projekt (z. B. rechtliche oder politische Vorgaben, intrinsische Motivation oder inspirierende Projekte aus anderen Kommunen)?",
|
|
114
|
+
involvedStakeholders: "Welche relevanten Akteure innerhalb oder ausserhalb Ihrer Organisation haben Sie fruehzeitig involviert (z. B. um politische Rueckendeckung sicherzustellen)?",
|
|
115
|
+
dataCollectionMethod: "Wie haben Sie den Bestand vorhandener Daten erhoben?",
|
|
116
|
+
budgetPlanning: "Wie haben Sie das erste Budget berechnet und nachhaltig gesichert?"
|
|
117
|
+
}, g = {
|
|
118
|
+
requirementsGatherings: "Wie haben Sie die Anforderungen erhoben und dokumentiert (z. B. durch Markterkundung, externe Berater oder Workshops)?",
|
|
119
|
+
tenderFormat: "Welche Ausschreibungsform haben Sie gewaehlt und warum? Gab es eine Vorlage oder Muster-Leistungsbeschreibung, die hilfreich war?",
|
|
120
|
+
tenderTips: "Welche Tipps haben Sie fuer eine erfolgreiche Ausschreibung?",
|
|
121
|
+
resourcePlanning: "Wie haben Sie die Ressourcenplanung fuer die Entwicklung und den Betrieb Ihres Digitalen Zwillings gestaltet und gesichert?"
|
|
122
|
+
}, D = {
|
|
123
|
+
projectTriggers: "Wie haben Sie die Zusammenarbeit mit den Dienstleistern organisiert und wie wurden relevante Stakeholder in Entscheidungsprozesse eingebunden?",
|
|
124
|
+
involvedStakeholders: "Gab es Verzoegerungen und wenn ja, was waren die Gruende?",
|
|
125
|
+
dataCollectionMethod: "Welche Schnittstellen wurden genutzt und traten technische Herausforderungen auf?",
|
|
126
|
+
budgetPlanning: "Welche Ueberlegungen sind in Ihre Entscheidung fuer eine Open-Source-Loesung eingeflossen und welche Erfahrungen haben Sie gemacht?"
|
|
127
|
+
}, P = {
|
|
128
|
+
projectTriggers: "Was sind Ihre wichtigsten Learnings aus dem Projekt? Was wuerden Sie beim naechsten Use Case anders machen?",
|
|
129
|
+
involvedStakeholders: "Wird die Wirksamkeit Ihres Projekts ueberwacht und wenn ja, wie? Ist der erwartete Nutzen eingetreten?",
|
|
130
|
+
dataCollectionMethod: "Gibt es Plaene fuer eine Skalierung oder Weiterentwicklung? Wenn ja, wie sichern Sie die Finanzierung dafuer?",
|
|
131
|
+
budgetPlanning: "Welche externen Unterstuetzungsangebote haben Ihnen geholfen oder auch gefehlt?"
|
|
132
|
+
}, n = (d, f) => {
|
|
133
|
+
const v = a(d), b = r(v), m = {};
|
|
134
|
+
for (const [e, u] of Object.entries(f)) {
|
|
135
|
+
const w = b.get(u);
|
|
136
|
+
w && (m[e] = w);
|
|
137
|
+
}
|
|
138
|
+
return m;
|
|
139
|
+
}, W = n("Initiieren", l), p = n("Planen", g), y = n("Umsetzen", D), S = n("Weiterdenken", P);
|
|
140
|
+
return {
|
|
141
|
+
"Projektphasen (optional)": {},
|
|
142
|
+
"Projektphasen (optional)/Initiieren": W,
|
|
143
|
+
"Projektphasen (optional)/Planen": p,
|
|
144
|
+
"Projektphasen (optional)/Umsetzen": y,
|
|
145
|
+
"Projektphasen (optional)/Weiterdenken": S
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function C(i) {
|
|
149
|
+
const c = i["p-plan:hasStep"] ?? [], a = {
|
|
150
|
+
"Data collection": "1. Datenerfassung",
|
|
151
|
+
Processing: "2. Datenverarbeitung",
|
|
152
|
+
Simulation: "3. Datensimulation",
|
|
153
|
+
Visualization: "4. Datenvisualisierung"
|
|
154
|
+
}, r = {
|
|
155
|
+
"Technische Prozessschritte": {},
|
|
156
|
+
"1. Datenerfassung/Grundlegende Informationen": {},
|
|
157
|
+
"1. Datenerfassung/Software": {},
|
|
158
|
+
"1. Datenerfassung/Datensätze": {},
|
|
159
|
+
"1. Datenerfassung/Hardware": {},
|
|
160
|
+
"2. Datenverarbeitung/Grundlegende Informationen": {},
|
|
161
|
+
"2. Datenverarbeitung/Software": {},
|
|
162
|
+
"2. Datenverarbeitung/Datensätze": {},
|
|
163
|
+
"2. Datenverarbeitung/Hardware": {},
|
|
164
|
+
"3. Datensimulation/Grundlegende Informationen": {},
|
|
165
|
+
"3. Datensimulation/Software": {},
|
|
166
|
+
"3. Datensimulation/Datensätze": {},
|
|
167
|
+
"3. Datensimulation/Hardware": {},
|
|
168
|
+
"4. Datenvisualisierung/Grundlegende Informationen": {},
|
|
169
|
+
"4. Datenvisualisierung/Software": {},
|
|
170
|
+
"4. Datenvisualisierung/Datensätze": {},
|
|
171
|
+
"4. Datenvisualisierung/Hardware": {}
|
|
172
|
+
}, l = (n) => `${n}/Grundlegende Informationen`, g = (n) => `${n}/Software`, D = (n) => `${n}/Datensätze`, P = (n) => `${n}/Hardware`;
|
|
173
|
+
for (const n of c) {
|
|
174
|
+
const W = t(n["p-plan:Activity"] || "") || "", p = a[W];
|
|
175
|
+
if (!p)
|
|
176
|
+
continue;
|
|
177
|
+
const y = j(n["dct:description"], "de") || "", S = (n["prov:used"] || []).map((e) => ({
|
|
178
|
+
name: t(e["dct:title"]) || "",
|
|
179
|
+
description: t(e["dct:description"]) || void 0
|
|
180
|
+
})).filter((e) => (e.name ?? "").length > 0), d = (n["dct:references"] || []).filter((e) => t(e["dct:type"]) === "documentation").map((e) => ({
|
|
181
|
+
name: t(e["dct:title"]) || "",
|
|
182
|
+
url: t(e["schema:url"]) || "",
|
|
183
|
+
description: t(e["dct:description"]) || void 0
|
|
184
|
+
})).filter((e) => e.url.length > 0 && e.name.length > 0);
|
|
185
|
+
(y || S.length > 0 || d.length > 0) && (r[l(p)] = {
|
|
186
|
+
...y ? { description: y } : {},
|
|
187
|
+
...S.length > 0 ? { methods: S } : {},
|
|
188
|
+
...d.length > 0 ? { links: d } : {}
|
|
189
|
+
});
|
|
190
|
+
const f = n["p-plan:hasInputVar"] || [], v = f.filter((e) => t(e["@type"]) === "pv:SoftwareLink").map((e) => ({
|
|
191
|
+
id: t(e["dct:identifier"]) || "",
|
|
192
|
+
functionalities: (e["schema:featureList"] || []).map((u) => t(u)).filter(h)
|
|
193
|
+
})).filter((e) => e.id.length > 0);
|
|
194
|
+
v.length > 0 && (r[g(p)] = {
|
|
195
|
+
selected: v
|
|
196
|
+
});
|
|
197
|
+
const b = f.filter((e) => t(e["@type"]) === "dcat:Dataset").map((e) => ({ id: t(e["dct:identifier"]) || "" })).filter((e) => e.id.length > 0);
|
|
198
|
+
b.length > 0 && (r[D(p)] = {
|
|
199
|
+
selected: b
|
|
200
|
+
});
|
|
201
|
+
const m = f.filter((e) => t(e["@type"]) === "ssn:Deployment").map((e) => {
|
|
202
|
+
const u = e["ssn:deployedSystem"], w = u && typeof u == "object" ? t(u["@id"]) || u["@id"] : "", x = j(e["dct:description"], "de") || void 0, A = (e["ssn:forProperty"] || []).map((s) => t(s)).filter(h), M = (e["sosa:hasLocation"] || []).map((s) => ({ lat: t(s["geo:lat"]) || "", lng: t(s["geo:long"]) || "" })).filter((s) => s.lat.length > 0 && s.lng.length > 0), E = (e["foaf:depiction"] || []).map((s) => I(s)).filter(h), T = (e["dct:references"] || []).filter((s) => t(s["dct:type"]) === "documentation").map((s) => ({
|
|
203
|
+
name: t(s["dct:title"]) || "",
|
|
204
|
+
url: t(s["schema:url"]) || "",
|
|
205
|
+
description: t(s["dct:description"]) || void 0
|
|
206
|
+
})).filter((s) => s.url.length > 0), B = (e["ssn-system:hasSystemCapability"] || []).map((s) => t(s)).filter(h);
|
|
207
|
+
return {
|
|
208
|
+
id: w,
|
|
209
|
+
...x ? { description: x } : {},
|
|
210
|
+
...A.length > 0 ? { forProperty: A } : {},
|
|
211
|
+
...M.length > 0 ? { locations: M } : {},
|
|
212
|
+
...E.length > 0 ? { depictions: E } : {},
|
|
213
|
+
...T.length > 0 ? { references: T } : {},
|
|
214
|
+
...B.length > 0 ? { functionalities: B } : {},
|
|
215
|
+
isHostedBy: [],
|
|
216
|
+
hosts: []
|
|
217
|
+
};
|
|
218
|
+
}).filter((e) => (e.id ?? "").length > 0);
|
|
219
|
+
m.length > 0 && (r[P(p)] = {
|
|
220
|
+
selected: m
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return r;
|
|
224
|
+
}
|
|
225
|
+
async function J(i, c) {
|
|
226
|
+
const a = await V(i);
|
|
227
|
+
return {
|
|
228
|
+
Landing: {},
|
|
229
|
+
...F(a, { visibility: "public" }),
|
|
230
|
+
...K(a),
|
|
231
|
+
...U(a),
|
|
232
|
+
...q(a),
|
|
233
|
+
...C(a),
|
|
234
|
+
Vorschau: {}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export {
|
|
238
|
+
J as decodeProject,
|
|
239
|
+
F as toAuffindbarkeit,
|
|
240
|
+
K as toGrundlegendeInformationen,
|
|
241
|
+
U as toOptionaleDaten,
|
|
242
|
+
q as toProjektphasen,
|
|
243
|
+
C as toTechnicalProcessSteps
|
|
244
|
+
};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { pipe as s } from "effect";
|
|
2
|
+
import * as n from "effect/Option";
|
|
3
|
+
import { theProjectForm as C } from "./__tests__/fixtures/theProjectForm.js";
|
|
4
|
+
import { PREFIXES as F } from "./shared.js";
|
|
5
|
+
function Q(e, i) {
|
|
6
|
+
if (e)
|
|
7
|
+
return {
|
|
8
|
+
"@value": e,
|
|
9
|
+
"@type": i
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function $(e) {
|
|
13
|
+
return (e ?? []).map((t) => {
|
|
14
|
+
var r, o;
|
|
15
|
+
return { name: (r = t.name) == null ? void 0 : r.trim(), url: (o = t.url) == null ? void 0 : o.trim() };
|
|
16
|
+
}).filter((t) => !!t.name && t.name.length > 0).map((t) => ({
|
|
17
|
+
"foaf:name": t.name,
|
|
18
|
+
...t.url && t.url.length > 0 ? { "foaf:homepage": t.url } : {}
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function H(e, i) {
|
|
22
|
+
return e ? [{ "@value": e, "@language": i }] : void 0;
|
|
23
|
+
}
|
|
24
|
+
function X(e) {
|
|
25
|
+
return (i) => H(i, e);
|
|
26
|
+
}
|
|
27
|
+
function A(e) {
|
|
28
|
+
if (e)
|
|
29
|
+
return {
|
|
30
|
+
"@id": e
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function U(e) {
|
|
34
|
+
return e != null;
|
|
35
|
+
}
|
|
36
|
+
function Z(e, i = "http://www.w3.org/2001/XMLSchema#string") {
|
|
37
|
+
return s(
|
|
38
|
+
n.fromNullable(e),
|
|
39
|
+
n.map((t) => t.trim()),
|
|
40
|
+
n.filter((t) => t.length > 0),
|
|
41
|
+
n.flatMap((t) => n.fromNullable(Q(t, i)))
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const B = (e) => (e ?? "").trim(), q = (e) => e.length > 0;
|
|
45
|
+
function m(e) {
|
|
46
|
+
return s(
|
|
47
|
+
n.fromNullable(e ?? void 0),
|
|
48
|
+
n.map(B),
|
|
49
|
+
n.filter(q)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function J(e) {
|
|
53
|
+
return s(
|
|
54
|
+
n.fromNullable(e),
|
|
55
|
+
n.map((i) => i.map(B).filter(q)),
|
|
56
|
+
n.filter((i) => i.length > 0),
|
|
57
|
+
n.map((i) => [...i])
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function G(e) {
|
|
61
|
+
return s(
|
|
62
|
+
n.fromNullable(e),
|
|
63
|
+
n.map((i) => i.map((t) => A(t)).filter(U)),
|
|
64
|
+
n.filter((i) => i.length > 0),
|
|
65
|
+
n.map((i) => [...i])
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function R(e, i) {
|
|
69
|
+
return s(
|
|
70
|
+
m(e),
|
|
71
|
+
n.flatMap((t) => n.fromNullable(i(t)))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function Y(e) {
|
|
75
|
+
return L(e).flatMap((i) => [...i]);
|
|
76
|
+
}
|
|
77
|
+
function V(e, i, t) {
|
|
78
|
+
return s(
|
|
79
|
+
n.fromNullable(e),
|
|
80
|
+
n.map((r) => r.map(i).filter(U)),
|
|
81
|
+
n.filter((r) => r.length > 0),
|
|
82
|
+
n.map((r) => M(r, t)),
|
|
83
|
+
n.filter((r) => r.length > 0),
|
|
84
|
+
n.map((r) => [...r])
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function I(e) {
|
|
88
|
+
if (e == null || typeof e != "object")
|
|
89
|
+
return e;
|
|
90
|
+
if (Array.isArray(e))
|
|
91
|
+
return e.map((r) => I(r)).filter((r) => r != null);
|
|
92
|
+
const i = {};
|
|
93
|
+
for (const [t, r] of Object.entries(e)) {
|
|
94
|
+
if (r == null)
|
|
95
|
+
continue;
|
|
96
|
+
const o = I(r);
|
|
97
|
+
o != null && (i[t] = o);
|
|
98
|
+
}
|
|
99
|
+
return i;
|
|
100
|
+
}
|
|
101
|
+
function L(e) {
|
|
102
|
+
return e.map(n.getOrUndefined).filter(U);
|
|
103
|
+
}
|
|
104
|
+
function c(e) {
|
|
105
|
+
const i = e ? [...e] : [];
|
|
106
|
+
return i.length > 0 ? i : void 0;
|
|
107
|
+
}
|
|
108
|
+
function ee(e, i) {
|
|
109
|
+
const t = e ?? {}, r = [];
|
|
110
|
+
for (const [o, a] of Object.entries(i)) {
|
|
111
|
+
const f = s(
|
|
112
|
+
n.fromNullable(t[o]),
|
|
113
|
+
n.map((u) => u.trim()),
|
|
114
|
+
n.filter((u) => u.length > 0),
|
|
115
|
+
n.map((u) => ({
|
|
116
|
+
"@type": "schema:Question",
|
|
117
|
+
"schema:text": a,
|
|
118
|
+
"schema:acceptedAnswer": u
|
|
119
|
+
})),
|
|
120
|
+
n.getOrUndefined
|
|
121
|
+
);
|
|
122
|
+
f && r.push(f);
|
|
123
|
+
}
|
|
124
|
+
return r;
|
|
125
|
+
}
|
|
126
|
+
function D(e, i, t) {
|
|
127
|
+
const r = ee(e, t);
|
|
128
|
+
return r.length === 0 ? n.none() : n.some({
|
|
129
|
+
"@type": "schema:QAPage",
|
|
130
|
+
"dct:type": i,
|
|
131
|
+
"schema:question": r
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function ne(e) {
|
|
135
|
+
return (e ?? []).map((t) => {
|
|
136
|
+
var r, o;
|
|
137
|
+
return { name: (r = t.name) == null ? void 0 : r.trim(), description: (o = t.description) == null ? void 0 : o.trim() };
|
|
138
|
+
}).filter((t) => !!t.name && t.name.length > 0 && !!t.description && t.description.length > 0).map((t) => ({
|
|
139
|
+
"@type": "prov:used",
|
|
140
|
+
"dct:title": t.name,
|
|
141
|
+
"dct:description": t.description
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
function M(e, i) {
|
|
145
|
+
return (e ?? []).map((r) => ({
|
|
146
|
+
"@type": "rdfs:Resource",
|
|
147
|
+
"dct:type": i,
|
|
148
|
+
"schema:url": r.url,
|
|
149
|
+
"dct:title": r.name,
|
|
150
|
+
"dct:description": s(
|
|
151
|
+
n.fromNullable(r.description),
|
|
152
|
+
n.map((o) => o.trim()),
|
|
153
|
+
n.filter((o) => o.length > 0),
|
|
154
|
+
n.getOrUndefined
|
|
155
|
+
)
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
function te(e) {
|
|
159
|
+
return (e ?? []).map((t) => ({
|
|
160
|
+
"@type": "pv:SoftwareLink",
|
|
161
|
+
"dct:identifier": t.id,
|
|
162
|
+
"schema:featureList": c((t.functionalities ?? []).map((r) => r == null ? void 0 : r.trim()).filter((r) => !!r && r.length > 0))
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
function re(e) {
|
|
166
|
+
return (e ?? []).map((t) => ({
|
|
167
|
+
"@type": "dcat:Dataset",
|
|
168
|
+
"dct:identifier": t.id
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
function ie(e, i) {
|
|
172
|
+
return (e ?? []).map((r) => {
|
|
173
|
+
var o;
|
|
174
|
+
return {
|
|
175
|
+
"@type": "ssn:Deployment",
|
|
176
|
+
"dct:identifier": "__TODO__",
|
|
177
|
+
"dct:description": s(
|
|
178
|
+
n.fromNullable(r.description),
|
|
179
|
+
n.map((a) => a.trim()),
|
|
180
|
+
n.filter((a) => a.length > 0),
|
|
181
|
+
n.flatMap((a) => n.fromNullable(i(a))),
|
|
182
|
+
n.getOrUndefined
|
|
183
|
+
),
|
|
184
|
+
"ssn:deployedSystem": A(r.id),
|
|
185
|
+
"ssn:forProperty": c((r.forProperty ?? []).map((a) => a == null ? void 0 : a.trim()).filter((a) => !!a && a.length > 0)),
|
|
186
|
+
"sosa:hasLocation": c((r.locations ?? []).map((a) => ({
|
|
187
|
+
"@type": "dct:Location",
|
|
188
|
+
"geo:lat": a.lat,
|
|
189
|
+
"geo:long": a.lng
|
|
190
|
+
}))),
|
|
191
|
+
"foaf:depiction": c((r.depictions ?? []).map((a) => A(a)).filter(U)),
|
|
192
|
+
// Corresponds to functionalities of hardware;
|
|
193
|
+
// not to be confused with functionalities of software (schema:featureList)
|
|
194
|
+
"ssn-system:hasSystemCapability": c((r.functionalities ?? []).map((a) => a == null ? void 0 : a.trim()).filter((a) => !!a && a.length > 0)),
|
|
195
|
+
"dct:references": c(M((o = r.references) == null ? void 0 : o.map((a) => ({
|
|
196
|
+
name: a.name ?? "",
|
|
197
|
+
url: a.url ?? "",
|
|
198
|
+
description: a.description
|
|
199
|
+
})).filter((a) => a.url.length > 0 && ((a == null ? void 0 : a.name) || "").length > 0), "documentation"))
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function P(e) {
|
|
204
|
+
var h, b, y;
|
|
205
|
+
const { prefixKey: i, activityLabel: t, input: r, toLanged: o } = e, a = `${i}/Grundlegende Informationen`, f = `${i}/Software`, u = `${i}/Datensätze`, j = `${i}/Hardware`, d = r[a], N = d == null ? void 0 : d.description, x = s(
|
|
206
|
+
n.fromNullable(N),
|
|
207
|
+
n.map((g) => g.trim()),
|
|
208
|
+
n.filter((g) => g.length > 0),
|
|
209
|
+
n.getOrUndefined
|
|
210
|
+
), W = d == null ? void 0 : d.methods, z = d == null ? void 0 : d.links, v = (h = r[f]) == null ? void 0 : h.selected, w = (b = r[u]) == null ? void 0 : b.selected, S = (y = r[j]) == null ? void 0 : y.selected, p = [
|
|
211
|
+
...te(v),
|
|
212
|
+
...re(w),
|
|
213
|
+
...ie(S, o)
|
|
214
|
+
], k = {
|
|
215
|
+
"@type": "p-plan:Step",
|
|
216
|
+
"dct:identifier": "__TODO__",
|
|
217
|
+
"p-plan:Activity": t,
|
|
218
|
+
"dct:description": o(x ?? ""),
|
|
219
|
+
"prov:used": c(ne(W)),
|
|
220
|
+
"dct:references": c(M(z, "documentation")),
|
|
221
|
+
"p-plan:hasInputVar": p.length > 0 ? p : void 0
|
|
222
|
+
};
|
|
223
|
+
return n.some(k);
|
|
224
|
+
}
|
|
225
|
+
function ae(e, i) {
|
|
226
|
+
var v, w, S, p, k, h, b, y, g, K, T, _, E;
|
|
227
|
+
const t = {
|
|
228
|
+
"@type": "schema:Project"
|
|
229
|
+
}, r = (i == null ? void 0 : i.language) ?? "de", o = X(r);
|
|
230
|
+
t["dct:title"] = s(R((v = e["Grundlegende Informationen/Name"]) == null ? void 0 : v.projectName, o), n.getOrUndefined), t["dct:description"] = s(R((w = e["Grundlegende Informationen/Beschreibung"]) == null ? void 0 : w.projectDescription, o), n.getOrUndefined), t["dct:identifier"] = ["__TODO__"], t["dcat:theme"] = s(G((S = e["Auffindbarkeit/Kategorien"]) == null ? void 0 : S.categories), n.getOrUndefined), t["schema:application"] = s(G((p = e["Auffindbarkeit/Anwendungsbereiche"]) == null ? void 0 : p.applications), n.getOrUndefined), t["schema:status"] = s(m((k = e["Grundlegende Informationen/Projektstatus"]) == null ? void 0 : k.projectName), n.getOrUndefined), t["schema:amount"] = s(
|
|
231
|
+
Z((h = e["Optionale Daten"]) == null ? void 0 : h.budget, "http://www.w3.org/2001/XMLSchema#integer"),
|
|
232
|
+
n.map((l) => ({
|
|
233
|
+
"@type": "schema:MonetaryAmount",
|
|
234
|
+
"schema:currency": "EUR",
|
|
235
|
+
"schema:value": l
|
|
236
|
+
})),
|
|
237
|
+
n.getOrUndefined
|
|
238
|
+
), t["schema:skills"] = s(J((b = e["Optionale Daten"]) == null ? void 0 : b.requiredExpertise), n.getOrUndefined), t["schema:startDate"] = s(m((y = e["Optionale Daten"]) == null ? void 0 : y.startDate), n.getOrUndefined), t["schema:endDate"] = s(m((g = e["Optionale Daten"]) == null ? void 0 : g.endDate), n.getOrUndefined);
|
|
239
|
+
const a = [
|
|
240
|
+
V(
|
|
241
|
+
(K = e["Optionale Daten"]) == null ? void 0 : K.links,
|
|
242
|
+
(l) => {
|
|
243
|
+
const O = s(m(l.url), n.getOrUndefined);
|
|
244
|
+
if (O)
|
|
245
|
+
return {
|
|
246
|
+
url: O,
|
|
247
|
+
name: s(m(l.name), n.getOrUndefined),
|
|
248
|
+
description: s(m(l.description), n.getOrUndefined)
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
"documentation"
|
|
252
|
+
),
|
|
253
|
+
V(
|
|
254
|
+
(T = e["Optionale Daten"]) == null ? void 0 : T.references,
|
|
255
|
+
(l) => {
|
|
256
|
+
const O = s(m(l.homepage), n.getOrUndefined);
|
|
257
|
+
if (O)
|
|
258
|
+
return {
|
|
259
|
+
url: O,
|
|
260
|
+
name: void 0,
|
|
261
|
+
description: void 0
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
"image"
|
|
265
|
+
)
|
|
266
|
+
], f = Y(a);
|
|
267
|
+
t["dct:references"] = f.length > 0 ? f : void 0, t["dcat:contactPoint"] = s(
|
|
268
|
+
n.fromNullable((_ = e["Grundlegende Informationen/Organisation"]) == null ? void 0 : _.contact),
|
|
269
|
+
n.map((l) => ({
|
|
270
|
+
"@type": "vcard:Kind",
|
|
271
|
+
"vcard:fn": l.name,
|
|
272
|
+
"vcard:hasEmail": l.mail,
|
|
273
|
+
"vcard:hasTelephone": l.phone
|
|
274
|
+
})),
|
|
275
|
+
n.map((l) => [l]),
|
|
276
|
+
n.getOrUndefined
|
|
277
|
+
), t["dct:contributor"] = s(
|
|
278
|
+
n.fromNullable((E = e["Optionale Daten"]) == null ? void 0 : E.partners),
|
|
279
|
+
n.map((l) => $(l)),
|
|
280
|
+
n.filter((l) => l.length > 0),
|
|
281
|
+
n.getOrUndefined
|
|
282
|
+
);
|
|
283
|
+
const u = {
|
|
284
|
+
projectTriggers: "Was waren Ausloeser fuer das Projekt (z. B. rechtliche oder politische Vorgaben, intrinsische Motivation oder inspirierende Projekte aus anderen Kommunen)?",
|
|
285
|
+
involvedStakeholders: "Welche relevanten Akteure innerhalb oder ausserhalb Ihrer Organisation haben Sie fruehzeitig involviert (z. B. um politische Rueckendeckung sicherzustellen)?",
|
|
286
|
+
dataCollectionMethod: "Wie haben Sie den Bestand vorhandener Daten erhoben?",
|
|
287
|
+
budgetPlanning: "Wie haben Sie das erste Budget berechnet und nachhaltig gesichert?"
|
|
288
|
+
}, j = {
|
|
289
|
+
requirementsGatherings: "Wie haben Sie die Anforderungen erhoben und dokumentiert (z. B. durch Markterkundung, externe Berater oder Workshops)?",
|
|
290
|
+
tenderFormat: "Welche Ausschreibungsform haben Sie gewaehlt und warum? Gab es eine Vorlage oder Muster-Leistungsbeschreibung, die hilfreich war?",
|
|
291
|
+
tenderTips: "Welche Tipps haben Sie fuer eine erfolgreiche Ausschreibung?",
|
|
292
|
+
resourcePlanning: "Wie haben Sie die Ressourcenplanung fuer die Entwicklung und den Betrieb Ihres Digitalen Zwillings gestaltet und gesichert?"
|
|
293
|
+
}, d = {
|
|
294
|
+
projectTriggers: "Wie haben Sie die Zusammenarbeit mit den Dienstleistern organisiert und wie wurden relevante Stakeholder in Entscheidungsprozesse eingebunden?",
|
|
295
|
+
involvedStakeholders: "Gab es Verzoegerungen und wenn ja, was waren die Gruende?",
|
|
296
|
+
dataCollectionMethod: "Welche Schnittstellen wurden genutzt und traten technische Herausforderungen auf?",
|
|
297
|
+
budgetPlanning: "Welche Ueberlegungen sind in Ihre Entscheidung fuer eine Open-Source-Loesung eingeflossen und welche Erfahrungen haben Sie gemacht?"
|
|
298
|
+
}, N = {
|
|
299
|
+
projectTriggers: "Was sind Ihre wichtigsten Learnings aus dem Projekt? Was wuerden Sie beim naechsten Use Case anders machen?",
|
|
300
|
+
involvedStakeholders: "Wird die Wirksamkeit Ihres Projekts ueberwacht und wenn ja, wie? Ist der erwartete Nutzen eingetreten?",
|
|
301
|
+
dataCollectionMethod: "Gibt es Plaene fuer eine Skalierung oder Weiterentwicklung? Wenn ja, wie sichern Sie die Finanzierung dafuer?",
|
|
302
|
+
budgetPlanning: "Welche externen Unterstuetzungsangebote haben Ihnen geholfen oder auch gefehlt?"
|
|
303
|
+
}, x = L([
|
|
304
|
+
D(e["Projektphasen (optional)/Initiieren"], "Initiieren", u),
|
|
305
|
+
D(e["Projektphasen (optional)/Planen"], "Planen", j),
|
|
306
|
+
D(e["Projektphasen (optional)/Umsetzen"], "Umsetzen", d),
|
|
307
|
+
D(e["Projektphasen (optional)/Weiterdenken"], "Weiterdenken", N)
|
|
308
|
+
]);
|
|
309
|
+
t["schema:hasPart"] = c(x);
|
|
310
|
+
const W = L([
|
|
311
|
+
P({ prefixKey: "1. Datenerfassung", activityLabel: "Data collection", input: e, toLanged: o }),
|
|
312
|
+
P({ prefixKey: "2. Datenverarbeitung", activityLabel: "Processing", input: e, toLanged: o }),
|
|
313
|
+
P({ prefixKey: "3. Datensimulation", activityLabel: "Simulation", input: e, toLanged: o }),
|
|
314
|
+
P({ prefixKey: "4. Datenvisualisierung", activityLabel: "Visualization", input: e, toLanged: o })
|
|
315
|
+
]);
|
|
316
|
+
return t["p-plan:hasStep"] = c(W), {
|
|
317
|
+
"@context": {
|
|
318
|
+
...F
|
|
319
|
+
},
|
|
320
|
+
"@graph": I(t)
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
console.log(JSON.stringify(ae(C), null, 2));
|
|
324
|
+
export {
|
|
325
|
+
ae as encodeProject,
|
|
326
|
+
U as isNonNullable,
|
|
327
|
+
H as toLangedValue,
|
|
328
|
+
A as toNodeReference,
|
|
329
|
+
Q as toTypedValue
|
|
330
|
+
};
|
package/dist/packages/dpi/src/data-provider-interface/composables/project-transformer/shared.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { pipe as s } from "effect";
|
|
2
|
+
import * as w from "effect/Option";
|
|
3
|
+
const p = {
|
|
4
|
+
dcat: "http://www.w3.org/ns/dcat#",
|
|
5
|
+
dcatap: "http://data.europa.eu/r5r/",
|
|
6
|
+
dct: "http://purl.org/dc/terms/",
|
|
7
|
+
ex: "http://example.org/",
|
|
8
|
+
foaf: "http://xmlns.com/foaf/0.1/",
|
|
9
|
+
geo: "http://www.w3.org/2003/01/geo/wgs84_pos#",
|
|
10
|
+
lcon: "http://www.w3.org/ns/locn#",
|
|
11
|
+
owl: "http://www.w3.org/2002/07/owl#",
|
|
12
|
+
"p-plan": "http://www.opmw.org/model/p-plan/",
|
|
13
|
+
prov: "http://www.w3.org/ns/prov#",
|
|
14
|
+
pv: "https://piveau.eu/ns/voc#",
|
|
15
|
+
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
16
|
+
rdfs: "http://www.w3.org/2000/01/rdf-schema#",
|
|
17
|
+
schema: "https://schema.org/",
|
|
18
|
+
sh: "http://www.w3.org/ns/shacl#",
|
|
19
|
+
skos: "http://www.w3.org/2004/02/skos/core#",
|
|
20
|
+
sosa: "http://www.w3.org/ns/sosa/",
|
|
21
|
+
ssn: "http://www.w3.org/ns/ssn/",
|
|
22
|
+
"ssn-system": "http://www.w3.org/ns/ssn/systems/",
|
|
23
|
+
vcard: "http://www.w3.org/2006/vcard/ns#",
|
|
24
|
+
xsd: "http://www.w3.org/2001/XMLSchema#"
|
|
25
|
+
};
|
|
26
|
+
function n(o) {
|
|
27
|
+
return s(
|
|
28
|
+
w.fromNullable(o),
|
|
29
|
+
w.map((t) => t.trim()),
|
|
30
|
+
w.filter((t) => t.length > 0),
|
|
31
|
+
w.getOrUndefined
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
p as PREFIXES,
|
|
36
|
+
n as nonEmpty
|
|
37
|
+
};
|