Organ-states: I-Available = Available for individual patients. I-Offered = Offered to an individual patient. I-Accepted = Accepted by an individual patient; DUOBLOCK becomes false after accepting. TC-Wait = Fallback TC-Available = Available for transplant centers. TC-Offered = Offered to a transplant center. TC-Accepted = Accepted by a transplant center. NotAccepted = Not accepted by an individual or transplant center. NotAvailable = Not available Table 0: Assign the heart to an individual patient or a transplant center. If: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10| 'DUOBLOCK/Fallback is (still) possible' | Y| Y| Y| Y| N| N| N| N| N| -| -| H_Stat_inp is NotAvailable | -| -| -| -| Y| N| N| N| N| -| -| H_Stat_inp is TC-Wait | Y| N| N| N| -| Y| N| N| N| -| -| H_Stat_inp is I-Available | -| Y| Y| N| -| -| Y| Y| N| -| -| 'Another patient on Heart Prio List' | -| Y| N| -| -| -| Y| N| -| -| -| H_Stat_inp is TC-Available | -| -| -| -| -| -| -| -| -| Y| N| Then: H_Stat is I-Offered | | X| | | | | X| | | | | H_Stat is TC-Wait | | | X| | | | | | | | | H_Stat is TC-Available | | | | | | X| | X| | X| | # ....... Attribute: H_Stat_inp Obtain_value_from_database_view: organ_block.heart_status Proposition: 'Another patient on Heart Prio List' Obtain_instance_from_database_view: high_prio_heart_list Table 1: assign the lungs to an individual patient or a transplant center If: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10| 'DUOBLOCK/Fallback is (still) possible' | Y| Y| Y| Y| N| N| N| N| N| -| -| L_Stat_inp is NotAvailable | -| -| -| -| Y| N| N| N| N| -| -| L_Stat_inp is TC-Wait | Y| N| N| N| -| Y| N| N| N| -| -| L_Stat_inp is I-Available | -| Y| Y| N| -| -| Y| Y| N| -| -| 'Another patient on Lung Prio List' | -| Y| N| -| -| -| Y| N| -| -| -| L_Stat_inp is TC-Available | -| -| -| -| -| -| -| -| -| Y| N| Then: L_Stat is I-Offered | | X| | | | | X| | | | | L_Stat is TC-Wait | | | X| | | | | | | | | L_Stat is TC-Available | | | | | | X| | X| | X| | # ....... Proposition: 'Still organs to offer' Obtain_instance_from_database_view: organ_block Attribute: L_Stat_inp Obtain_value_from_database_view: organ_block.lung_status Proposition: 'Another patient on Lung Prio List' Obtain_instance_from_database_view: high_prio_lung_list rTable 2: DUOBLOCK/fallback policy still applies. If: | 0| 1| 'Still organs to offer' | Y| N| H_Stat_inp is NotAvailable | N| -| H_Stat_inp is I-Accepted | N| -| L_Stat_inp is NotAvailable | N| -| L_Stat_inp is I-Accepted | N| -| Then: 'DUOBLOCK/Fallback is (still) possible' | X| | Action is No_Organs_To_Offer | | X| # ....... # The Duoblock proposition indicates whether a fallback scenario is possible. # DUOBLOCK is false when a Heart-Lung-block contains 1 organ only; the other organ has status NotAvailable. # DUOBLOCK becomes false when one of the organs is accepted by an individual patient. # DUOBLOCK is true as long as both organs are offered to individual patients. rTable 3: Assign a heart-lung block to a transplant center for the first time (fallback-scenario) If: | 0| 1| 2| H_Stat is TC-Wait | Y| Y| N| L_Stat is TC-Wait | Y| -| Y| H_Stat_inp is TC-Wait | -| -| Y| L_Stat_inp is TC-Wait | -| Y| -| Then: 'Heart-Lung Block to TC for the first time' | X| X| X| # ....... Proposition: 'Another Transplant Center on TC list' Obtain_instance_from_database_view: transplant_center Table 4: Assign heart and/or lungs to a next transplantation center. If: | 0| 1| 2| 3| 4| 5| 6| 7| 8| 'Heart-Lung Block to TC for the first time' | Y| Y| N| N| N| N| N| N| N| H_Stat is TC-Available | -| -| Y| Y| Y| Y| N| N| N| L_Stat is TC-Available | -| -| Y| Y| N| N| Y| Y| N| 'Another Transplant Center on TC list' | Y| N| Y| N| Y| N| Y| N| -| Then: Action is HL->TC | X| | X| | | | | | | Action is HL_NotAccepted | | X| | X| | | | | | Action is H_NotAccepted | | | | | | X| | | | Action is L_NotAccepted | | | | | | | | X| | Action is H->TC | | | | | X| | | | | Action is L->TC | | | | | | | X| | | # ....... Table 5: Assign heart and/or lungs to next patient. If: | 0| 1| 2| 3| H_Stat is I-Offered | Y| Y| N| N| L_Stat is I-Offered | Y| N| Y| N| Then: Action is H->I | X| X| | | Action is L->I | X| | X| | # ....... Table 6: Only the heart or the lungs come into a wait state (fallback scenario) If: | 0| 1| 2| 3| 4| 'Heart-Lung Block to TC for the first time' | Y| N| N| N| N| H_Stat is TC-Wait | -| Y| Y| N| N| L_Stat is TC-Wait | -| Y| N| Y| N| Then: Action is H->TC-Wait | | | X| | | Action is L->TC-Wait | | | | X| | # ....... Database_view: organ_block With_attributes: organ_block_id,donorid,name,heart_status,lung_status,organ_availability_date Query: SELECT a.organ_block_id, b.donorid, b.name, c.status AS heart_status, d.status AS lung_status, a.organ_availability_date FROM organ_block AS a INNER JOIN donor AS b ON (a.donorid = b.donorid) INNER JOIN organstatus AS c ON (a.h_stat = c.statusid) INNER JOIN organstatus AS d ON (a.l_stat = d.statusid) WHERE c.status IN ("I-Available", "TC-Available") OR d.status IN ("I-Available", "TC-Available") ORDER BY organ_availability_date LIMIT 1 End_Query Database_view: high_prio_heart_list With_attributes: high_prio_heart_listid, patient_id, placement_date, priority, availability_id Query: SELECT * FROM high_prio_heart_list WHERE availability_id = 1 ORDER BY priority DESC, placement_date ASC LIMIT 1 End_Query Database_view: high_prio_lung_list With_attributes: high_prio_lung_listid, patient_id, placement_date, priority, availability_id Query: SELECT * FROM high_prio_lung_list WHERE availability_id = 1 ORDER BY priority DESC, placement_date ASC LIMIT 1 End_Query Database_view: transplant_center With_attributes: transplant_center_id, name, tc_availability_id Query: SELECT transplant_center_id, name, tc_availability_id FROM transplant_center WHERE tc_availability_id = 1 LIMIT 1 End_Query GoalAttribute: Action Repeat_until: No_Organs_To_Offer MultiValued_until: No_Organs_To_Offer Case: No_Organs_To_Offer Print: "============================Result=========================================" Print: "No organs with status 1 (I-Available) or status 5 (TC-Available) to offer. " Print: "The offering service has been finished" Print: "===========================================================================" Case: H->I Print: "============================Result==================================" Print: "H->I" Print: "Assign the heart to patient %s on the heart prio list" high_prio_heart_list.patient_id Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "====================================================================" >SQL: "UPDATE organ_block SET h_stat = 2 " SQL: "INSERT INTO heart_offer (organ_block_id, patientid, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " high_prio_heart_list.patient_id SQL: "UPDATE high_prio_heart_list SET availability_id = 2 " I Print: "============================Result==================================" Print: "L->I" Print: "Assign the lungs to patient %s on the lung prio list" high_prio_lung_list.patient_id Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "====================================================================" >SQL: "UPDATE organ_block SET l_stat = 2 " SQL: "INSERT INTO lung_offer (organ_block_id, patientid, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " high_prio_lung_list.patient_id SQL: "UPDATE high_prio_lung_list SET availability_id = 2 " TC-Wait Print: "============================Result==================================" Print: "H->TC-Wait" Print: "The heart is waiting now for a block-offer to a transplant center." Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "====================================================================" >SQL: "UPDATE organ_block SET h_stat = 4 " TC-Wait Print: "============================Result==================================" Print: "L->TC-Wait" Print: "The lungs are waiting now for a block-offer to a transplant center." Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "====================================================================" >SQL: "UPDATE organ_block SET l_stat = 4 " TC Print: "============================Result==================================" Print: "HL->TC" Print: "Assign a heart and lung-block to a next transplant center" Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "Status of the heart is now: 6. (TC-Offered)." Print: "Status of the lungs is now: 6. (TC-Offered)." Print: "Transplant center %s is temporarily unavailable for following organ offers" transplant_center.name Print: "====================================================================" >SQL: "UPDATE organ_block SET h_stat = 6, l_stat = 6 " SQL: "INSERT INTO heart_offer (organ_block_id, transplant_center_id, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " transplant_center.transplant_center_id SQL: "INSERT INTO lung_offer (organ_block_id, transplant_center_id, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " transplant_center.transplant_center_id SQL: "UPDATE transplant_center SET tc_availability_id = 2 " TC Print: "============================Result==================================" Print: "H->TC" Print: "Assign the heart to a next transplant center" Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "Status of the heart is: 6. (TC-Offered)." Print: "Status of the lungs remains: %s." organ_block.lung_status Print: "Transplant center %s is temporarily unavailable for following organ offers" transplant_center.name Print: "====================================================================" >SQL: "UPDATE organ_block SET h_stat = 6 " SQL: "INSERT INTO heart_offer (organ_block_id, transplant_center_id, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " transplant_center.transplant_center_id SQL: "UPDATE transplant_center SET tc_availability_id = 2 " TC Print: "============================Result==================================" Print: "L->TC" Print: "Assign the lungs to a next transplant center" Print: "This concerns organ block %s from donor %s." organ_block.organ_block_id organ_block.name Print: "Status of the lungs is now: 6. (TC-Offered)." Print: "Status of the heart remains: %s." organ_block.heart_status Print: "Transplant center %s is temporarily unavailable for following organ offers" transplant_center.name Print: "====================================================================" >SQL: "UPDATE organ_block SET l_stat = 6 " SQL: "INSERT INTO lung_offer (organ_block_id, transplant_center_id, offerdate) " -SQL: "VALUES (%s, " organ_block.organ_block_id -SQL: "%s, " transplant_center.transplant_center_id SQL: "UPDATE transplant_center SET tc_availability_id = 2 " SQL: "UPDATE organ_block SET h_stat = 8, l_stat = 8 " SQL: "UPDATE organ_block SET h_stat = 8 " SQL: "UPDATE organ_block SET l_stat = 8 "