Skip to main content
. Author manuscript; available in PMC: 2014 Sep 5.
Published in final edited form as: IEEE Trans Inf Technol Biomed. 2011 Oct 17;16(1):166–175. doi: 10.1109/TITB.2011.2171701

Algorithm 2 Joining patient records with Sovereign Join: SCP side
Input: Request messages (MSG)
Output: Matching results
 1: bufferCtr ← 0
 2: while TRUE do
 3:  wait for new message MSG in blocked state
 4: if get_DB_ID(MSG) = “DB1then
 5:   dataDB1 [bufferCtr] ← decrypt(get_record(MSG))
  {buffer the record}
 6:   recordDB1 [bufferCtr] ← get_recordID(MSG)
 7:   bufferCtr ← bufferCtr + 1 {update buffer counter}
 8: else
 9:   if get_DB_ID(MSG) = “DB2then
10:    dataDB2 ← decrypt(get_record(MSG))
11:     recordDB2 ← get_recordID(MSG)
12:    for i = 0 to BUFFER_SIZE do
13:     if distanceMetric(dataDB1[i], dataDB2) < 1 then
14:      matchedDB1Id ← recordDBl [j]
     {send match result}
15:     end if
16:     matchedDB1Id ← “No match”
17:     send_ACK2(matchedDB1Id) {no match found}
18:    end for
19:    bufferCtr ← 0 {reset buffer counter}
20:   end if
21: end if
22: end while