Pidiod
Functionality
Map Patient and Operator IDs to Pseudo IDs
Map Pseudo IDs to locations
Map Genuine IDs to locations
Solve Locations to Patient and Operator IDs
Solve Pseudo IDs to Genuine IDs
Automatic removal of expired maps
Terminology
Pitfalls
Pseudo ID not registered
Genuine ID invalid (out of scope)
Location has no mapped Operator ID and/or Genuine ID
Difference between ID types (It must be possible to skelne between ID types)
Design
Tables
[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)
Database maintenance
Data maintenance is done every time a table is written too or read from.
Protocol
Format is as follow: (“<FUNCTION>”, “<PARAMETERS…>” ⇒ “<SUCCESS>, <ERROR” | “<fields>”):
Example:
Send:
("PUT", "id1 id2 location ttl" "OK") => "OK"|"FAILED" : "PUT\n"
"id1: <id>\n"
"id2: <another id>\n"
"location: <location>\n"
"ttl: <ttl>\n"
"\n"
Answer (on success):
"status: OK\n"
"msg: <STATUS MSG>\n"
"\n"
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, UNKNOWN_ID"
Put IDs (Genuine or Pseudo) on location with ttl.
("GET", "location") => "OK, FAILED, UNKNOW_ID"|"pa_id, op_id"
Get list of IDs (Genuine IDs) mapped to location.
("CLEAR", "location") => "OK, FAILED"
Clear all IDs (Genuine IDs) on location.
("MAP", "id1 id2 ttl") => "OK, FAILED, WRONG_ID_TYPE"
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 Pseudo ID from a genuine ID.
("LOOKUP", "id") => "OK, FAILED, WRONG_ID_TYPE"|"type={ps_id, ge_id}, id"
Lookup of ID mapped to id and its type (of the mapped to id).
TODO
Next Version
Use microhttpd.
Rewrite database comm.
Refactorize reply.cc
Testing…
Current Version