pentominos:pidiod
Table of Contents
Pidiod
Functionality
- Map Patient and Operator IDs to Pseudo IDs
- Map Pseudo IDs to locations
- Map Genuine IDs to locations
- Detect if a Patient or Operator IDs are used instead of Pseudo IDs
- Solve Locations to Patient and Operator IDs
- Solve Pseudo IDs to Genuine IDs
- 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
- 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
Current Version
pentominos/pidiod.txt · Last modified: 2010/04/27 12:03 by jsc