Skip to content

Commit 030a9f9

Browse files
committed
Added examples for datamodel: object types and vocabulary types
1 parent 1440d35 commit 030a9f9

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
from bam_data_store.metadata.definitions import ObjectTypeDef, PropertyTypeAssignment
2+
from bam_data_store.metadata.entities import ObjectType
3+
4+
5+
class Instrument(ObjectType):
6+
defs = ObjectTypeDef(
7+
version=1,
8+
code='INSTRUMENT',
9+
description="""
10+
Measuring Instrument//Messger\u00e4t
11+
""",
12+
generated_code_prefix='INS',
13+
)
14+
15+
name = PropertyTypeAssignment(
16+
version=1,
17+
code='$NAME',
18+
data_type='VARCHAR',
19+
property_label='Name',
20+
description="""
21+
Name
22+
""",
23+
mandatory=True,
24+
show_in_edit_views=True,
25+
section='General information',
26+
)
27+
28+
alias = PropertyTypeAssignment(
29+
version=1,
30+
code='ALIAS',
31+
data_type='VARCHAR',
32+
property_label='Alternative name',
33+
description="""
34+
e.g. abbreviation or nickname//z.B. Abkürzung oder Spitzname//z.B. Abkürzung oder Spitzname
35+
""",
36+
mandatory=False,
37+
show_in_edit_views=True,
38+
section='General information',
39+
)
40+
41+
# ... other property types here...
42+
43+
44+
class WeldingEquipment(Instrument):
45+
defs = ObjectTypeDef(
46+
version=1,
47+
code='INSTRUMENT.WELDING_EQUIPMENT',
48+
description="""
49+
Generic Welding Equipment//Unspezifisches Schweiß-Equipment
50+
""",
51+
generated_code_prefix='INS.WLD_EQP',
52+
)
53+
54+
55+
class GMAWTorch(WeldingEquipment):
56+
defs = ObjectTypeDef(
57+
version=1,
58+
code='INSTRUMENT.WELDING_EQUIPMENT.GMAW_TORCH',
59+
description="""
60+
Arc welding torch for gas metal arc welding (GMAW) applications//Schweißbrenner für Metall-Schutzgas-Schweißen (MSG-Schweißen)
61+
""",
62+
generated_code_prefix='INS.WLD_EQP.GMAW_TRCH',
63+
)
64+
65+
torch_type = PropertyTypeAssignment(
66+
version=1,
67+
code='WELDING.TORCH_TYPE',
68+
data_type='CONTROLLEDVOCABULARY',
69+
vocabulary_code='WELDING.GMAW_TORCH_TYPE', # ? use only the class name?
70+
property_label='Type',
71+
description="""
72+
type of welding torch//Art des Schweißbrenners
73+
""",
74+
mandatory=True,
75+
show_in_edit_views=True,
76+
section='General information',
77+
)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
from bam_data_store.metadata.definitions import (
2+
VocabularyTerm,
3+
VocabularyTypeDef,
4+
)
5+
from bam_data_store.metadata.entities import VocabularyType
6+
7+
8+
class DocumentType(VocabularyType):
9+
defs = VocabularyTypeDef(
10+
version=1,
11+
code='DOCUMENT_TYPE',
12+
description='Document type//Dokumententypen',
13+
)
14+
15+
acceptance_certificate = VocabularyTerm(
16+
version=1,
17+
code='ACCEPTANCE_CERTIFICATE',
18+
label='Acceptance Certificate',
19+
description='Acceptance Certificate//Abnahmezeugnis',
20+
)
21+
22+
calibration_certificate = VocabularyTerm(
23+
version=1,
24+
code='CALIBRATION_CERTIFICATE',
25+
label='Calibration Certificate',
26+
description='Calibration Certificate//Kalibrierschein',
27+
)
28+
29+
catalog = VocabularyTerm(
30+
version=1,
31+
code='CATALOG',
32+
label='Catalog',
33+
description='Document type//Dokumententypen',
34+
)
35+
36+
datasheet = VocabularyTerm(
37+
version=1,
38+
code='DATASHEET',
39+
label='Datasheet',
40+
description='Datasheet//Datenblatt',
41+
)
42+
43+
datasheet_msds = VocabularyTerm(
44+
version=1,
45+
code='DATASHEET_MSDS',
46+
label='Material Safety Datasheet',
47+
description='Material Safety Datasheet (MSDS)//Sicherheitsdatenblatt',
48+
)
49+
50+
datasheet_technical = VocabularyTerm(
51+
version=1,
52+
code='DATASHEET_TECHNICAL',
53+
label='Technical Datasheet',
54+
description='Technical Datasheet//Technisches Datenblatt',
55+
)
56+
57+
delivery_note = VocabularyTerm(
58+
version=1,
59+
code='DELIVERY_NOTE',
60+
label='Delivery Note',
61+
description='Delivery Note//Lieferschein',
62+
)
63+
64+
diagram = VocabularyTerm(
65+
version=1,
66+
code='DIAGRAM',
67+
label='Diagram',
68+
description='Diagram//Diagramm',
69+
)
70+
71+
fabrication_order = VocabularyTerm(
72+
version=1,
73+
code='FABRICATION_ORDER',
74+
label='Fabrication Order',
75+
description='Fabrication Order//Fertigungsauftrag',
76+
)
77+
78+
inspection_certificate = VocabularyTerm(
79+
version=1,
80+
code='INSPECTION_CERTIFICATE',
81+
label='Inspection Certificate',
82+
description='Inspection Certificate//Inspektionszeugnis',
83+
)

0 commit comments

Comments
 (0)