File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 130
130
"$ref" : " #/definitions/Constituent"
131
131
}
132
132
},
133
+ "synthesis_products" : {
134
+ "title" : " Synthesis Products" ,
135
+ "default" : [],
136
+ "type" : " array" ,
137
+ "items" : {
138
+ "$ref" : " #/definitions/Constituent"
139
+ }
140
+ },
133
141
"synthesis_description" : {
134
142
"title" : " Synthesis Description" ,
135
143
"type" : " string"
Original file line number Diff line number Diff line change @@ -17,9 +17,23 @@ class Sample(Item):
17
17
synthesis_constituents : List [Constituent ] = Field ([])
18
18
"""A list of references to constituent materials giving the amount and relevant inlined details of consituent items."""
19
19
20
+ synthesis_products : List [Constituent ] = Field ([])
21
+ """A list of references to constituent materials giving the amount and relevant inlined details of relevant sythesis products."""
22
+
20
23
synthesis_description : Optional [str ]
21
24
"""Free-text details of the procedure applied to synthesise the sample"""
22
25
26
+ @root_validator
27
+ def add_self_product (cls , values ):
28
+ if not values .get ("synthesis_products" ):
29
+ values ["synthesis_products" ].append (
30
+ Constituent (
31
+ quantity = None , item = {"type" : values ["type" ], "item_id" : values ["item_id" ]}
32
+ )
33
+ )
34
+
35
+ return values
36
+
23
37
@root_validator
24
38
def add_missing_synthesis_relationships (cls , values ):
25
39
"""Add any missing sample synthesis constituents to parent relationships"""
Original file line number Diff line number Diff line change @@ -882,7 +882,7 @@ def get_item_data(
882
882
)
883
883
884
884
# Must be exported to JSON first to apply the custom pydantic JSON encoders
885
- return_dict = json .loads (doc .json (exclude_unset = True ))
885
+ return_dict = json .loads (doc .json ())
886
886
887
887
if item_id is None :
888
888
item_id = return_dict ["item_id" ]
You can’t perform that action at this time.
0 commit comments