/* file: mimic2.h G. Moody 19 January 2009 Last revised: 9 February 2009 ------------------------------------------------------------------------------- mimic2.h: definitions and functions shared by MIMIC II utility software Copyright (C) 2009 George B. Moody This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this file; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. You may contact the author by e-mail (george@mit.edu) or postal mail (MIT Room E25-505A, Cambridge, MA 02139 USA). For updates to this software, please visit PhysioNet (http://www.physionet.org/). _______________________________________________________________________________ */ /* In MIMIC II Clinical Database log annotation files, the subtyp [sic] field of each annotation is the source code (a number that indicates where the information contained in the rest of the annotation originated). This function translates between source codes and short strings that describe them. */ char *subtyptostring(int n) { switch (n) { case 1: return ("ad"); case 2: return ("cd"); case 3: return ("ce"); case 4: return ("ch"); case 5: return ("de"); case 6: return ("ic"); case 7: return ("id"); case 8: return ("io"); case 9: return ("md"); case 10: return ("me"); case 11: return ("po"); case 12: return ("so"); case 13: return ("to"); case 14: return("nu"); case 15: return("wf"); default: return ("??"); } } /* This variant of the function above translates to longer descriptions. */ char *subtyptodesc(int n) { switch (n) { case 1: return ("Additive"); case 2: return ("Chart Event Duration"); case 3: return ("Census Event"); case 4: return ("Chart Event"); case 5: return ("Delivery"); case 6: return ("ICD9"); case 7: return ("I/O Event Duration"); case 8: return ("I/O Event"); case 9: return ("Med Event Duration"); case 10: return ("Med Event"); case 11: return ("Physician Order"); case 12: return ("Solution"); case 13: return ("Total I/O Event"); case 14: return ("Numerics Record"); case 15: return ("Waveform Record"); default: return ("??"); } } /* This function does the reverse translation, from strings to code numbers. */ int stringtosubtyp(char *p) { if (strcmp(p, "ad") == 0) return (1); if (strcmp(p, "cd") == 0) return (2); if (strcmp(p, "ce") == 0) return (3); if (strcmp(p, "ch") == 0) return (4); if (strcmp(p, "de") == 0) return (5); if (strcmp(p, "ic") == 0) return (6); if (strcmp(p, "id") == 0) return (7); if (strcmp(p, "io") == 0) return (8); if (strcmp(p, "md") == 0) return (9); if (strcmp(p, "me") == 0) return (10); if (strcmp(p, "po") == 0) return (11); if (strcmp(p, "so") == 0) return (12); if (strcmp(p, "to") == 0) return (13); if (strcmp(p, "nu") == 0) return (14); if (strcmp(p, "wf") == 0) return (15); else return (0); }