@@ -88,11 +88,21 @@ def _fulfillment_item_refs_for_instance(self, instance) -> list[dict[str, str]]:
8888 if ref_type != self .PROCESS_ITEM_REFERENCE_TYPE :
8989 continue
9090 fulfillment_item_euid = str (
91- payload .get ("atlas_test_fulfillment_item_euid" ) or ""
91+ payload .get ("atlas_test_fulfillment_item_euid" )
92+ or payload .get ("atlas_fulfillment_slot_euid" )
93+ or ""
94+ ).strip ()
95+ atlas_test_euid = str (
96+ payload .get ("atlas_test_euid" )
97+ or payload .get ("atlas_order_test_euid" )
98+ or ""
9299 ).strip ()
93- atlas_test_euid = str (payload .get ("atlas_test_euid" ) or "" ).strip ()
94100 atlas_tenant_id = str (payload .get ("atlas_tenant_id" ) or "" ).strip ()
95- atlas_trf_euid = str (payload .get ("atlas_trf_euid" ) or "" ).strip ()
101+ atlas_trf_euid = str (
102+ payload .get ("atlas_trf_euid" )
103+ or payload .get ("atlas_order_euid" )
104+ or ""
105+ ).strip ()
96106 if not (
97107 fulfillment_item_euid
98108 and atlas_test_euid
@@ -105,6 +115,16 @@ def _fulfillment_item_refs_for_instance(self, instance) -> list[dict[str, str]]:
105115 "atlas_trf_euid" : atlas_trf_euid ,
106116 "atlas_test_euid" : atlas_test_euid ,
107117 "atlas_test_fulfillment_item_euid" : fulfillment_item_euid ,
118+ "atlas_order_euid" : str (
119+ payload .get ("atlas_order_euid" ) or atlas_trf_euid
120+ ).strip (),
121+ "atlas_order_test_euid" : str (
122+ payload .get ("atlas_order_test_euid" ) or atlas_test_euid
123+ ).strip (),
124+ "atlas_fulfillment_slot_euid" : str (
125+ payload .get ("atlas_fulfillment_slot_euid" )
126+ or fulfillment_item_euid
127+ ).strip (),
108128 }
109129 return list (refs .values ())
110130
@@ -272,7 +292,27 @@ def _replace_fulfillment_item_references(
272292
273293 atlas_tenant_id = str (atlas_context .get ("atlas_tenant_id" ) or "" ).strip ()
274294 atlas_trf_euid = str (atlas_context .get ("atlas_trf_euid" ) or "" ).strip ()
295+ atlas_order_euid = str (
296+ atlas_context .get ("atlas_order_euid" ) or atlas_context .get ("order_euid" ) or ""
297+ ).strip ()
275298 fulfillment_items = list (atlas_context .get ("fulfillment_items" ) or [])
299+ for fulfillment_slot in list (atlas_context .get ("fulfillment_slots" ) or []):
300+ atlas_fulfillment_slot_euid = str (
301+ fulfillment_slot .get ("atlas_fulfillment_slot_euid" ) or ""
302+ ).strip ()
303+ atlas_order_test_euid = str (
304+ fulfillment_slot .get ("atlas_order_test_euid" ) or ""
305+ ).strip ()
306+ if not (atlas_fulfillment_slot_euid and atlas_order_test_euid ):
307+ continue
308+ fulfillment_items .append (
309+ {
310+ "atlas_test_euid" : atlas_order_test_euid ,
311+ "atlas_order_test_euid" : atlas_order_test_euid ,
312+ "atlas_test_fulfillment_item_euid" : atlas_fulfillment_slot_euid ,
313+ "atlas_fulfillment_slot_euid" : atlas_fulfillment_slot_euid ,
314+ }
315+ )
276316 direct_fulfillment_item_euid = str (
277317 atlas_context .get ("atlas_test_fulfillment_item_euid" ) or ""
278318 ).strip ()
@@ -288,13 +328,23 @@ def _replace_fulfillment_item_references(
288328
289329 for fulfillment_item in fulfillment_items :
290330 atlas_test_euid = str (fulfillment_item .get ("atlas_test_euid" ) or "" ).strip ()
331+ atlas_order_test_euid = str (
332+ fulfillment_item .get ("atlas_order_test_euid" ) or atlas_test_euid or ""
333+ ).strip ()
291334 atlas_test_fulfillment_item_euid = str (
292- fulfillment_item .get ("atlas_test_fulfillment_item_euid" ) or ""
335+ fulfillment_item .get ("atlas_test_fulfillment_item_euid" )
336+ or fulfillment_item .get ("atlas_fulfillment_slot_euid" )
337+ or ""
338+ ).strip ()
339+ atlas_fulfillment_slot_euid = str (
340+ fulfillment_item .get ("atlas_fulfillment_slot_euid" )
341+ or atlas_test_fulfillment_item_euid
342+ or ""
293343 ).strip ()
294344 if not (
295345 atlas_tenant_id
296- and atlas_trf_euid
297- and atlas_test_euid
346+ and ( atlas_trf_euid or atlas_order_euid )
347+ and ( atlas_test_euid or atlas_order_test_euid )
298348 and atlas_test_fulfillment_item_euid
299349 ):
300350 continue
@@ -305,8 +355,11 @@ def _replace_fulfillment_item_references(
305355 "foreign_reference" : atlas_test_fulfillment_item_euid ,
306356 "atlas_tenant_id" : atlas_tenant_id ,
307357 "atlas_trf_euid" : atlas_trf_euid ,
358+ "atlas_order_euid" : atlas_order_euid ,
308359 "atlas_test_euid" : atlas_test_euid ,
360+ "atlas_order_test_euid" : atlas_order_test_euid ,
309361 "atlas_test_fulfillment_item_euid" : atlas_test_fulfillment_item_euid ,
362+ "atlas_fulfillment_slot_euid" : atlas_fulfillment_slot_euid ,
310363 "validation" : {},
311364 }
312365 created_payloads .append (properties )
@@ -743,8 +796,21 @@ def _atlas_context_for_instance(self, instance) -> dict[str, Any]:
743796 patient_ref ["atlas_patient_euid" ] if patient_ref is not None else ""
744797 ),
745798 "fulfillment_items" : [],
799+ "fulfillment_slots" : [],
746800 }
747801 first = fulfillment_items [0 ]
802+ fulfillment_slot_payloads = [
803+ {
804+ "atlas_order_test_euid" : item ["atlas_order_test_euid" ],
805+ "atlas_fulfillment_slot_euid" : item ["atlas_fulfillment_slot_euid" ],
806+ }
807+ for item in sorted (
808+ fulfillment_items ,
809+ key = lambda item : item ["atlas_test_fulfillment_item_euid" ],
810+ )
811+ if item .get ("atlas_order_test_euid" )
812+ and item .get ("atlas_fulfillment_slot_euid" )
813+ ]
748814 return {
749815 "atlas_tenant_id" : first ["atlas_tenant_id" ],
750816 "atlas_order_euid" : atlas_order_euid ,
@@ -781,6 +847,7 @@ def _atlas_context_for_instance(self, instance) -> dict[str, Any]:
781847 key = lambda item : item ["atlas_test_fulfillment_item_euid" ],
782848 )
783849 ],
850+ "fulfillment_slots" : fulfillment_slot_payloads ,
784851 }
785852
786853 def _first_reachable_reference_value (
0 commit comments