User Tools

Site Tools


pentominos:pidiod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pentominos:pidiod [2009/05/01 12:02] jscpentominos:pidiod [2010/04/27 12:03] (current) jsc
Line 7: Line 7:
   * Map Genuine IDs to locations   * Map Genuine IDs to locations
     * Detect if a Patient or Operator IDs are used instead of Pseudo IDs     * Detect if a Patient or Operator IDs are used instead of Pseudo IDs
-  * Resolve Locations to Patient and Operator IDs+  * Solve Locations to Patient and Operator IDs 
 +  * Solve Pseudo IDs to Genuine IDs
   * Automatic removal of expired maps   * Automatic removal of expired maps
 +
 +==== Terminology ====
 +  * ID types:
 +    * Pseudo ID (ps_id): A pseudo ID
 +    * Genuine ID (ge_id): An non-pseudo ID (Patient ID or Operator ID)
 +    * Operator ID (op_id): A string s of 4 digits where s[0] > 3
 +    * Patient ID (pa_id): A string s of 10 characters where s[0] < = 3 (how does this comply with dummy CPR?)
 +  * Location: A location of an Apparatus
  
 ===== Pitfalls ===== ===== Pitfalls =====
Line 18: Line 27:
  
 ===== Design ===== ===== Design =====
- 
-==== Terminology ==== 
-  * ID types: 
-    * Pseudo ID (ps_id): A pseudo ID 
-    * Genuine ID (ge_id): An non-pseudo ID (Patient ID or Operator ID) 
-    * Operator ID (op_id): A string s of 4 digits where s[0] > 3 
-    * Patient ID (pa_id): A string s of 10 characters where s[0] < = 3 (how does this comply with dummy CPR?) 
-  * Location: A location of an Apparatus 
  
 ==== Tables ==== ==== Tables ====
Line 31: Line 32:
   * [A]: location: (VARCHAR op_id, VARCHAR pa_id, VARCHAR location, TIMESTAMP create_time, TIMESTAMP expire_time)   * [A]: location: (VARCHAR op_id, VARCHAR pa_id, VARCHAR location, TIMESTAMP create_time, TIMESTAMP expire_time)
   * [B]: idmap: (VARCHAR ps_id, VARCHAR pa_id, TIMESTAMP create_time, TIMESTAMP expire_time)   * [B]: idmap: (VARCHAR ps_id, VARCHAR pa_id, TIMESTAMP create_time, TIMESTAMP expire_time)
 +
 +==== Database maintenance ====
 +
 +Data maintenance is done every time a table is written too or read from. 
  
 ==== Protocol ==== ==== Protocol ====
  
-Format is as follow: ("<FUNCTION>", "<PARAMETERS...>" => "<SUCCESS>"|"<ERROR"):+Format is as follow: ("<FUNCTION>", "<PARAMETERS...>" => "<SUCCESS>, <ERROR" | "<fields>"):
  
 Example: Example:
 <code> <code>
 Send: Send:
- ("PUT", "id1 id2 location ttl" "OK") => "OK"|"FAILED" : "PUT\r\n"  + ("PUT", "id1 id2 location ttl" "OK") => "OK"|"FAILED" : "PUT\n"  
-                                                    "id1: <an id>\r\n" +                                                    "id1: <id>\n" 
-                                                    "id2: <another id>\r\n" +                                                    "id2: <another id>\n" 
-                                                    "location: <location>\r\n" +                                                    "location: <location>\n" 
-                                                    "ttl: <ttl>\r\n" +                                                    "ttl: <ttl>\n" 
-                                                    "\r\n"+                                                    "\n"
 Answer (on success): Answer (on success):
-                                                    "OK\r\n"+                                                    "status: OK\n" 
 +                                                    "msg: <STATUS MSG>\n" 
 +                                                    "\n"
 </code> </code>
  
-Ie. every line terminated by "\r\n" and each parameter takes an argument and has its own line. The request is terminated by "\r\n". NOTE! Similar to input parameters an answer can to be a list.+Ie. every line terminated by "\n" and each parameter takes an argument and has its own line. The request is terminated by "\n". NOTE! Similar to input parameters an answer can to be a list.
  
-=== ("PUT", "id1 id2 location ttl") => "OK"|"FAILED WRONG_ID_TYPE" === +=== ("PUT", "id1 id2 location ttl") => "OKFAILEDWRONG_ID_TYPE, UNKNOWN_ID" === 
-Put IDs (Genuine or Pseudo) on location with ttl. The server detects type of IDs.+Put IDs (Genuine or Pseudo) on location with ttl.
  
-=== ("GET", "location") => "pa_id op_id"|"FAILED" ===+=== ("GET", "location") => "OK, FAILED, UNKNOW_ID"|"pa_id, op_id" ===
 Get list of IDs (Genuine IDs) mapped to location. Get list of IDs (Genuine IDs) mapped to location.
  
-=== ("CLEAR", "location") => "OK"|"FAILED" ===+=== ("CLEAR", "location") => "OKFAILED" ===
 Clear all IDs (Genuine IDs) on location. Clear all IDs (Genuine IDs) on location.
  
-=== ("MAP", "id1 id2  ttl") => "OK"|"FAILED WRONG_ID_TYPE" ===+=== ("MAP", "id1 id2  ttl") => "OKFAILEDWRONG_ID_TYPE" ===
 Map Pseudo ID to Genuine ID with ttl. Note! One of the IDs must be a Pseudo ID. Map Pseudo ID to Genuine ID with ttl. Note! One of the IDs must be a Pseudo ID.
  
-=== ("UNMAP", "id" ) => "OK"|"FAILED WRONG_ID_TYPE" ===+=== ("UNMAP", "id" ) => "OKFAILEDWRONG_ID_TYPE" ===
 Unmap Pseudo ID from a genuine ID. Unmap Pseudo ID from a genuine ID.
  
-=== ("LOOKUP", "id") => "OK|FAILED WRONG_ID_TYPE" === +=== ("LOOKUP", "id") => "OKFAILEDWRONG_ID_TYPE"|"type={ps_id, ge_id}, id" === 
-Lookup of ID mapped to id.+Lookup of ID mapped to id and its type (of the mapped to id). 
 + 
 + 
 +===== TODO ===== 
 + 
 +==== Next Version ==== 
 +  * {{:check.png}} Use microhttpd. 
 +  * {{:check.png}} Rewrite database comm. 
 +  * {{:uncheck.png}} Refactorize reply.cc 
 +  * {{:uncheck.png}} Testing... 
 + 
 +==== Current Version ====
pentominos/pidiod.1241172162.txt.gz · Last modified: 2009/05/01 12:02 by jsc