Skip to content

Commit 5183e7c

Browse files
authored
fill masterdata missing CollectionType and DatasetType properties (#41)
* Changed capitalizing DataSet to Dataset * Add properties to datasets and collections More oop coding forOpenbisEntities and MasterdataCodeGenerator * Added dosctrings * Fix ruff * Add badge for pipelines passed in readme
1 parent 0fedf84 commit 5183e7c

File tree

9 files changed

+1890
-201
lines changed

9 files changed

+1890
-201
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![test-and-build pipeline](https://github.com/BAMresearch/bam-masterdata/actions/workflows/actions.yml/badge.svg)
2+
13
# BAM Masterdata
24

35
The BAM Masterdata is a repository containing all the masterdata schema defining in BAM, as well as some utility functions to handle the masterdata.

bam_masterdata/datamodel/collection_types.py

+294-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from bam_masterdata.metadata.definitions import CollectionTypeDef
1+
from bam_masterdata.metadata.definitions import (
2+
CollectionTypeDef,
3+
PropertyTypeAssignment,
4+
)
25
from bam_masterdata.metadata.entities import CollectionType
36

47

@@ -8,6 +11,36 @@ class Collection(CollectionType):
811
description="""""",
912
)
1013

14+
name = PropertyTypeAssignment(
15+
code="$NAME",
16+
data_type="VARCHAR",
17+
property_label="Name",
18+
description="""Name""",
19+
mandatory=False,
20+
show_in_edit_views=False,
21+
section="General info",
22+
)
23+
24+
default_object_type = PropertyTypeAssignment(
25+
code="$DEFAULT_OBJECT_TYPE",
26+
data_type="VARCHAR",
27+
property_label="Default object type",
28+
description="""Enter the code of the object type for which the collection is used""",
29+
mandatory=False,
30+
show_in_edit_views=False,
31+
section="General info",
32+
)
33+
34+
default_collection_view = PropertyTypeAssignment(
35+
code="$DEFAULT_COLLECTION_VIEW",
36+
data_type="CONTROLLEDVOCABULARY",
37+
property_label="Default collection view",
38+
description="""Default view for experiments of the type collection""",
39+
mandatory=False,
40+
show_in_edit_views=False,
41+
section="General info",
42+
)
43+
1144

1245
class DefaultExperiment(CollectionType):
1346
defs = CollectionTypeDef(
@@ -16,9 +49,269 @@ class DefaultExperiment(CollectionType):
1649
validation_script="DEFAULT_EXPERIMENT.date_range_validation",
1750
)
1851

52+
name = PropertyTypeAssignment(
53+
code="$NAME",
54+
data_type="VARCHAR",
55+
property_label="Name",
56+
description="""Name""",
57+
mandatory=False,
58+
show_in_edit_views=False,
59+
section="General info",
60+
)
61+
62+
default_object_type = PropertyTypeAssignment(
63+
code="$DEFAULT_OBJECT_TYPE",
64+
data_type="VARCHAR",
65+
property_label="Default object type",
66+
description="""Enter the code of the object type for which the collection is used""",
67+
mandatory=False,
68+
show_in_edit_views=False,
69+
section="General info",
70+
)
71+
72+
show_in_project_overview = PropertyTypeAssignment(
73+
code="$SHOW_IN_PROJECT_OVERVIEW",
74+
data_type="BOOLEAN",
75+
property_label="Show in project overview",
76+
description="""Show in project overview page""",
77+
mandatory=False,
78+
show_in_edit_views=False,
79+
section="General info",
80+
)
81+
82+
finished_flag = PropertyTypeAssignment(
83+
code="FINISHED_FLAG",
84+
data_type="BOOLEAN",
85+
property_label="Experiment completed",
86+
description="""Marks the experiment as finished//Markiert das Experiment als abgeschlossen""",
87+
mandatory=False,
88+
show_in_edit_views=False,
89+
section="General info",
90+
)
91+
92+
default_experiment_grant = PropertyTypeAssignment(
93+
code="DEFAULT_EXPERIMENT.GRANT",
94+
data_type="VARCHAR",
95+
property_label="Grant",
96+
description="""Grant""",
97+
mandatory=False,
98+
show_in_edit_views=False,
99+
section="General info",
100+
)
101+
102+
start_date = PropertyTypeAssignment(
103+
code="START_DATE",
104+
data_type="TIMESTAMP",
105+
property_label="Start date",
106+
description="""Start date//Startdatum""",
107+
mandatory=False,
108+
show_in_edit_views=False,
109+
section="General info",
110+
)
111+
112+
end_date = PropertyTypeAssignment(
113+
code="END_DATE",
114+
data_type="TIMESTAMP",
115+
property_label="End date",
116+
description="""End date//Enddatum""",
117+
mandatory=False,
118+
show_in_edit_views=False,
119+
section="General info",
120+
)
121+
122+
default_experiment_experimental_goals = PropertyTypeAssignment(
123+
code="DEFAULT_EXPERIMENT.EXPERIMENTAL_GOALS",
124+
data_type="MULTILINE_VARCHAR",
125+
property_label="Goals",
126+
description="""Goals of the experiment""",
127+
mandatory=False,
128+
show_in_edit_views=False,
129+
section="Experimental details",
130+
)
131+
132+
default_experiment_experimental_description = PropertyTypeAssignment(
133+
code="DEFAULT_EXPERIMENT.EXPERIMENTAL_DESCRIPTION",
134+
data_type="MULTILINE_VARCHAR",
135+
property_label="Description",
136+
description="""Description of the experiment""",
137+
mandatory=False,
138+
show_in_edit_views=False,
139+
section="Experimental details",
140+
)
141+
142+
default_experiment_experimental_results = PropertyTypeAssignment(
143+
code="DEFAULT_EXPERIMENT.EXPERIMENTAL_RESULTS",
144+
data_type="MULTILINE_VARCHAR",
145+
property_label="Results",
146+
description="""Summary of experimental results""",
147+
mandatory=False,
148+
show_in_edit_views=False,
149+
section="Experimental details",
150+
)
151+
152+
reference = PropertyTypeAssignment(
153+
code="REFERENCE",
154+
data_type="MULTILINE_VARCHAR",
155+
property_label="References",
156+
description="""Useful refences//Nützliche Referenzen""",
157+
mandatory=False,
158+
show_in_edit_views=False,
159+
section="References",
160+
)
161+
162+
publication = PropertyTypeAssignment(
163+
code="PUBLICATION",
164+
data_type="MULTILINE_VARCHAR",
165+
property_label="Publication",
166+
description="""Own publication where this entity is referenced//Eigene Publikation, in dem dieses Experiment beschrieben wird""",
167+
mandatory=False,
168+
show_in_edit_views=False,
169+
section="References",
170+
)
171+
172+
notes = PropertyTypeAssignment(
173+
code="NOTES",
174+
data_type="MULTILINE_VARCHAR",
175+
property_label="Notes",
176+
description="""Notes//Notizen""",
177+
mandatory=False,
178+
show_in_edit_views=False,
179+
section="",
180+
)
181+
182+
xmlcomments = PropertyTypeAssignment(
183+
code="$XMLCOMMENTS",
184+
data_type="XML",
185+
property_label="Comments",
186+
description="""Comments log""",
187+
mandatory=False,
188+
show_in_edit_views=False,
189+
section="",
190+
)
191+
19192

20193
class MeasurementsCollection(CollectionType):
21194
defs = CollectionTypeDef(
22195
code="MEASUREMENTS_COLLECTION",
23196
description="""Contains individual measurements, common metadata//Enthält individuelle Messungen, gemeinsame Metadaten""",
24197
)
198+
199+
name = PropertyTypeAssignment(
200+
code="$NAME",
201+
data_type="VARCHAR",
202+
property_label="Name",
203+
description="""Name""",
204+
mandatory=True,
205+
show_in_edit_views=False,
206+
section="General Information",
207+
)
208+
209+
default_object_type = PropertyTypeAssignment(
210+
code="$DEFAULT_OBJECT_TYPE",
211+
data_type="VARCHAR",
212+
property_label="Default object type",
213+
description="""Enter the code of the object type for which the collection is used""",
214+
mandatory=False,
215+
show_in_edit_views=False,
216+
section="General Information",
217+
)
218+
219+
default_collection_view = PropertyTypeAssignment(
220+
code="$DEFAULT_COLLECTION_VIEW",
221+
data_type="CONTROLLEDVOCABULARY",
222+
property_label="Default collection view",
223+
description="""Default view for experiments of the type collection""",
224+
mandatory=False,
225+
show_in_edit_views=False,
226+
section="General Information",
227+
)
228+
229+
measurement_date = PropertyTypeAssignment(
230+
code="MEASUREMENT_DATE",
231+
data_type="DATE",
232+
property_label="Measurement Date",
233+
description="""Measurement Date//Messdatum""",
234+
mandatory=True,
235+
show_in_edit_views=False,
236+
section="Experiment Details",
237+
)
238+
239+
description = PropertyTypeAssignment(
240+
code="DESCRIPTION",
241+
data_type="MULTILINE_VARCHAR",
242+
property_label="Description",
243+
description="""Short description and/or purpose//Kurzbeschreibung und/oder Zweck""",
244+
mandatory=False,
245+
show_in_edit_views=False,
246+
section="Experiment Details",
247+
)
248+
249+
air_temperature_in_celsius = PropertyTypeAssignment(
250+
code="AIR_TEMPERATURE_IN_CELSIUS",
251+
data_type="REAL",
252+
property_label="Air Temperature [°C]",
253+
description="""Air Temperature in °C//Lufttemperatur in °C""",
254+
mandatory=False,
255+
show_in_edit_views=False,
256+
section="Experiment Details",
257+
)
258+
259+
bam_oe = PropertyTypeAssignment(
260+
code="BAM_OE",
261+
data_type="CONTROLLEDVOCABULARY",
262+
property_label="BAM Organizational Entity",
263+
description="""BAM Organizational Entity//BAM Organisationseinheit (OE)""",
264+
mandatory=True,
265+
show_in_edit_views=False,
266+
section="BAM Information",
267+
)
268+
269+
responsible_person = PropertyTypeAssignment(
270+
code="RESPONSIBLE_PERSON",
271+
data_type="SAMPLE",
272+
property_label="Responsible person",
273+
description="""Responsible person//Verantwortliche Person""",
274+
mandatory=False,
275+
show_in_edit_views=False,
276+
section="BAM Information",
277+
)
278+
279+
co_responsible_person = PropertyTypeAssignment(
280+
code="CO_RESPONSIBLE_PERSON",
281+
data_type="SAMPLE",
282+
property_label="Co-responsible person",
283+
description="""Co-responsible person//Weitere verantwortliche Person""",
284+
mandatory=False,
285+
show_in_edit_views=False,
286+
section="BAM Information",
287+
)
288+
289+
notes = PropertyTypeAssignment(
290+
code="NOTES",
291+
data_type="MULTILINE_VARCHAR",
292+
property_label="Notes",
293+
description="""Notes//Notizen""",
294+
mandatory=False,
295+
show_in_edit_views=False,
296+
section="Additional Information",
297+
)
298+
299+
xmlcomments = PropertyTypeAssignment(
300+
code="$XMLCOMMENTS",
301+
data_type="XML",
302+
property_label="Comments",
303+
description="""Comments log""",
304+
mandatory=False,
305+
show_in_edit_views=False,
306+
section="Comments",
307+
)
308+
309+
annotations_state = PropertyTypeAssignment(
310+
code="$ANNOTATIONS_STATE",
311+
data_type="XML",
312+
property_label="Annotations State",
313+
description="""Annotations State""",
314+
mandatory=False,
315+
show_in_edit_views=False,
316+
section="Comments",
317+
)

0 commit comments

Comments
 (0)