Triage Tag Structure - ProjectRipple/Ripple-NFC GitHub Wiki
Current Structure
The latest User Interface incorporated in the NFCRWwithDrawing app is shown above. The user inputs data into the EditText views and can draw on the human body diagram. The Drug Solution field is an AutoCompleteTextView that uses a drug database to autocomplete the drug solution after the user enters the first 3 letters of the drug. Each TextView has a header corresponding with it, and the headers and TextViews are stored in separate ArrayLists.
When a Triage Tag is detected in Write Mode, a Map<String, String> object, which creates a list of mappings where the first is a header and the second is a value, is added to with any non-empty TextViews.
Map<String, String> map; map = new HashMap<String, String>(); for(int i = 0; i < textViews.size(); i++){ if(!textViews.get(i).getText.toString().equals("")){ map.put(headers.get(i), textViews.get(i).getText().toString());}}
Next, the points on the drawing panel are converted into an array of bytes. Two bytes with value -127 are prepended to the beginning of each path as delimiters to help parse the paths on reading.
Using MessagePack's Packer object, the Map and ByteArray are packed into one MessagePack. These are converted into a single byte array and encrypted using Cipher. The encrypted bytes are then written to an NFC tag.
When a Triage Tag is detected in Read Mode, the bytes of the payload are first decrypted. Then, using MessagePack's Unpacker object, the ByteArray of drawn points and the Map of headers and text are unpacked from the MessagePack. These are then handled to update their appropriate fields.
Future Structure
Ripple wants to create a standard structure for storing and transferring patient data. This structure will govern the format and content of the data that is sent to NFC tags, the Cloud, and wherever else the data needs to go.
Prioritization
Due to the limited memory available on NFC tags, it could happen that not all of the information that a user writes or draws into the UI can fit on the tag. In this circumstance, a prioritization of data will have to be implemented to ensure that the most vital information is stored on a tag. The following image is of a popular triage tag, which will be used as a notional example for all the data that will be written to the tag.
The priority of this information is as follows:
- Tag ID
- Patient ID
- Category (Minor, Delayed, Immediate, or Morgue) and Why (RPM)
- Drugs and Dosages administered, and Times
- Vital Signs and corresponding Times
- Drawing of Injury Location
- Type of Injury
- Personal Information
- Other (Comments, SLUDGEM, Auto Injector Type, Radiological/Biological/Chemical Agent, etc)
#Local Data Storage
The patient data will be stored locally on the Android devices in for future reference and more general back up. Instead of simply creating the data, reading/writing the tags, and overwriting the variables, the data for each patient will be stored in either a text file or a SQLlite database. A text file would be more difficult to navigate once the data is input but easier to implement.