Home
Documentation
Contents
1. 4 FORMAT TRANSLATION EZ XLATE 94 else SRULES SRCOUNT sPrepareRule dr SCOLLOOKUP the above can DIE if bad line RCOUNT y v0 53 modification identify SBP DBP MBP column Nos here my SiSBP SiDBP SiMBP SiSBP COLLOOKUP NBP s index of column for SBP SiDBP COLLOOKUP NBP d if etc SiMBP COLLOOKUP NBP m LE Tig E EHE HEE HHH HE ibni Ta EE ERE TEUER AERE HEE HH ER here pre process INDATA to create datum for each minute for each item first column must always be a time in nasty Format yyyy mm ddThh mm ss write results to MID NB first column is JULIAN date modified from T Gregorie my MID f the following are used to fix IDAS bug where the same NIBP is repeatedly inte my lastSBP lastDBP 99 99 my SthisSBP thisDBP thisMBP every 1 min will add new rov to MID Need to know index of most recent good value for each column in MID so can backfill my LASTGOOD my 3 0 while j lt 100 ugh max of 100 columns unvarying SLASTGOOD j 1 default 1 signals good item yet j y my MIDIDX index into MID my SILEN S INDATA 4 do
2. E MsgBox 0 Debug Stem is amp SFILESTEM file is amp CURRENTFILE amp Mogrify EZPATH FILESTEM CURRENTFILE CAPTURECOUNT DESTPATH SKIPPER Wend END BIG LOOP EXIT terminate unused Pr Pr 7 FUNCTIONS here s the main Mogrify rtn E we ve modified it to put in a full image every 10 frames E Func Mogrify EZPATH FILESTEM FILENAME COUNT SAVEPATH SKIPPER SFILENAME includes m or s at end at present we do NOT use SAVEPATH get files in order mogrify each in turn using transping bat SDIDSKIP 0 fpath EZPATH amp png amp SFILESTEM Shr 1 fileB SFILENAME amp MakeSerial fi 3 SfileD fileB destination file name While FileExists fpath fileB png If Mod fi DIDSKIP 10 1 Then key frame Ssnipargs FILESTEM 6 amp fileD 6 amp fileB amp 820 455 25 dosok RunWait ComSpec c justsnip bat 6 snipargs QGSW HIDE Else Ssnipargs FILESTEM fileA amp amp fileB amp 820 455 25 amp fi dosok RunWait ComSpec c transping bat 6 snipargs SW_HIDE If dosok gt 0 Then MsgBox 0 Oops Bad transping bat Is ImageMagick installed Args 6 IMAGE TRANSFORM
3. 49 r Case msg MOGm doit MsgBox ONTOP 1 Confirm Mogrify In BACKGROUND alerts for 5s once If doit 1 Then OK button pressed 2 cancel GuiSetState SW_MINIMIZE perlok RunWait ComSpec c _ SEZPATH amp ez mogrify au3 SEZPATH GuiSetState 80SW RESTORE Else MsgBox ONTOP Nol NOT mogrifying EndIf 1 IMAGE CLICKS Case msg imCSV LogNotepad EZPATH SFILENAME capt Case msg SimDAT LogNotepad EZPATH FILENAME m c2d Case msg imADD LogNotepad SEZPATH SFILENAME m play Case msg SisGET LogNotepad EZPATH FILENAME iar Case msg isXML LogNotepad EZPATH SFILENAME xml Case msg SisCSV LogNotepad EZPATH SFILENAME x2c Case msg SisDAT LogNotepad EZPATH FILENAME s c2d Case msg isADD LogNotepad EZPATH FILENAME s play 5 view actual resulting files in Notepad or even Excel Case msg vwCSV ViewNotepad EZPATH csv FILENAME amp m csv Case msg SvwCSV2 ViewNotepad EZPATH csv FILENAME amp s csv 2 EZ CAPTURE MANUAL DATA CAPTURE 50 Case msg SvwXML ViewNotepad EZPATH xml FILENAME xml
4. IOC E Bd H 10 WORKING PHP CODE 242 Sdat SQLManySQL handDB qry rating details PrintDetailTable dat 11 4 print table of 11 columns print lt lt lt HTML3 lt table gt lt div gt lt p gt lt a href eZ view php View more lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 10 8 5 Graphical view of a case Here we will stack the handwritten and electronic images each about 800 wide by 360 high On the left we will have a control panel 10 8 6 Graphical view of assessments test page Here display time course of interventions vertically in 5 min epochs for all 10 2 pairs of cases We start off with a relatively simple DHTML page that is written by a PHP function The page displays the final background images for a given case e g 3044 and individual assessor eg code 1015 manual image above electronic one and then overlays coloured boxes one for each intervention The position of the box along the x axis indicates the time at which the intervention occurred in 5 minute epochs and the vertical height of the box depends on the importance attached to the intervention Interventions are colour coded and we pass along the whole y axis for a particular colour before moving on to the next colour We need a button tha
5. 54 the beginning SNSINDEX 0 ENUMB ER ses Sanr ES Sosk q DoSQ 4 SNSIND q DoSQ D I get next sionarray ec have moved to next Case ntry from N explode Ssessionarray SNSIND First case is 1 EXTS ESSIONS SNSLIST EX if zero based indexing Ek ry EXT we want N Write new ON ES ESSION entry FetchKey na ndDB Onesession INSERT INTO ON ESESSION onesession Person osCaseNumber Anrecord VAI Sosk SUS ER KEY L handDB q r Update NEXTS EX ESSIONS r UPDA 7 QN EXTS SSIONS 51 L ShandDB q F q SE ECT Manual list ANUAL zi TO n if MAN SMAN else SMAN D I UAL re might fail Images TALIMAGES CASENUMBER anrec make nev session note what if crash midway explore fix mell F ERE ET nsIndex SNSINDEX WH nextsessions index SNSKEY nextsessions update Subject FROM ANRECORD WHE subj GetSQL handDB if null values F RE 54 anrecord anrec get record details 1 UAL m UA Ta e S q
6. SOTHERLOGONID POST editperson SNEWROLE POST newrole SNEWLOCATION POST newlocation SNEWSPECIALTY POST newspecialty SNEWSURNAME POST newsurname SNEWFORENAME POST newforename SQUALYEAR POST qualyear we might check and forbid a new role of superuser CheckCode OTHERLOGONID Bad logon id 4 or fail CheckCode NEWROLE Bad role code CheckCodeNull QUALYEAR if QUALYEAR NULL STHISYEAR WhatYearIsIt if QUALYEAR lt 1950 SQUALYEAR gt STHISYEAR QUALYEAR NULL 1 y Sanitise NENSURNAME Sanitise NENFORENAME if strlen SNEWSPECIALTY lt 1 SNEWSPECIALTY SNEWSPECIALTY NULL else CheckCode SNEWSPECIALTY Bad specialty code if strlen NEVLOCATION lt 1 SNEWLOCATION SNEWLOCATION NULL else CheckCode NEVLOCATION Bad location code SOTHERSURNAME FetchSurname handDB SOTHERLOGONID SOTHERFORENAME FetchForename handDB SOTHERLOGONID qry UPDATE PERSDATA SET pdForename NEVFORENAME pdSurname SNEWSURNAM PersonRole SNEWROLE CurrentSpecialty NENSPECIALTY CurrentLocation SNEW
7. N txt and backticks txt preg_replac txt fdouble quote gt single txt preg replac Stxt duplicate any quote if SDEBUGGING 12 ANCILLARY CODE 303 print lt br gt lt b gt Sanitised lt b gt amp lt S txt amp gt y return vith altered txt It s by reference 12 1 4 WhatYearlIsIt Simply retrieve the current year function WhatYearIsIt return date Y y 12 2 Handling lists 12 2 1 PrintPoplist PrintPoplist obtains the desired primary key the first item specified in the SQL SELECT statement and elems extra items elems is not an explicit param eter The elems extra items are concatenated into a single string Each key elems concatenation pair is printed as an option within an HTML lt SELECT gt statement function PrintPoplist handDB listname Squery print lt select name Slistname gt lt option selected value 0 gt lt option gt n ShandQ mysql_query query ShandDB if is resource handQ debug print lt br gt SQL QUERY error mysql error Scount 0 while row mysql fetch array handQ MYSQL NUM mykey Srow 0 Smyvalue ConcatenateArray array_slice Srow 1 concatenate remaining elements print lt option value Smykey gt Smyvalue lt option gt n Scount 1 print
8. lt p gt The eZ suite of programs is freely available under the GNU Public licence and all source code and documentation is available a href GPL htm gt here lt a gt lt p gt To return to the log in page you can click on the link below or the eZ logo in the top left hand corner of the page lt p gt lt div align center table width 150 border 5 cellpadding 4 cellspacing 4 bgcolor FOF8FF gt lt tr gt lt td align center gt lt a href index htm Return to the main page lt a gt lt td gt lt tr gt lt table gt lt div gt lt p gt lt div align right gt Regards Jo amp nbsp nbsp lt div gt lt div gt lt td gt lt tr gt lt table gt lt div gt lt html gt 7 1 2 Help page This page help index htm is rudimentary at present 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 128 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN http www w3 org TR htm14 loose dtd gt lt html lang en gt lt head gt lt title gt Help with eZ lt title gt lt link type text css rel stylesheet href css eZstyle css lt head gt lt body gt table width 95 tr td width 150 a href mainpage php img border 0 title Back alt eZ logo src images tinyezlogo png gt lt a gt td td lt h2 gt Help lt h2 gt td tr table hr div
9. print COUTFILE h s h d h m systolic diastolic mean b else amp Print An Header h 3 print COUTFILE h print header name 1s Es f next print line by line there is a catch for names in the TRIPLETS list pressures we must either pull out 3 values sys dia mean or if not there insert 3 NAs my t v n foreach St sort keys SALLTIMES print COUTFILE An t n SALLTIMES St get sequence number of time or could just increment fa foreach h headers Sv S LABELS h n if exists TRIPLETS h pressure in format S D M if defined v if Sv 9 N C 5 NCC 92 9 might have debug stmt here print COUTFILE 1 2 3 b else print COUTFILE NA NA NA amp Print An WARNING bad value h line n lt v gt SWARNINGS SEXITCODE 0x01 signal warning y else print COUTFIL E NA NA NA E else if defined v print COUTFILE Sv else E 4 FORMAT TRANSLATION EZ XLATE 87 print COUTFILE NA D I E y y y close COUTFILI E if SWARNINGS gt 0 print An xxxNOTExxx There was were NARNINGS warning s Please consult the log y print An Finished n sCloseLog LOGPRINT exit EXITCODE A debugging print routine sub Print
10. require once ValidFx php our login validation script Susername POST username Spswd POST pswd salt POST salt ff print lt p gt Debugging password is pswd salt is salt if strlen username 532 strlen Spswd gt 80 strlen Susername lt 4 strlen pswd lt 6 print lt p gt Bad password user name Force_Html_InitialLogon Invalid password username exit y Sanitise username Sanitise psud 8But it might be accessed directly in this case the POST variable username will not be set in which case we simply direct the user to the login htm file Section 9 1 9 PHP ACCESS CODING 184 CheckCode salt bad SALT value Worrying ShandDB eZ_database_connect SUSERKEY processLogon username pswd handDB salt Prepare to load main page SLOGGED_IN 1 Sqry SELECT PersonRole pValue ROM PERSON PERSDATA WHERE PERSON person PERSDATA Person AND PERSON person SUSERKEY list Suserstatus SOLDPAGE GetSQL ShandDB qry get status old Ssuccess USER Susername STATUS Suserstatus OLDPAGE SOLDPAGE clumsy duplication of validate_login ValidFx php require mainpage php Hj The above duplication of success is clumsy but if we repeat the log in at tempt at ma
11. return if NULL H row mysql fetch array handQ MYSQL NUM if DEBUGGING Gl print amp gt print r row DEBUGGING DH return row f return array 12 6 2 DoSQL function DoSQL handDB qry message Sok mysql_query qry handDB if 1 ok print lt p gt Query error amp lt qry amp gt Se mysql error print lt p gt Error message e if DEBUGGING print lt br gt DEBUGGING Stmt to execute vas amp lt qry amp gt 12 ANCILLARY CODE 313 simply return 12 6 3 SQLManySQL Obtain array of arrays all data function SQLManySQL handDB qry msg ShandQ mysql query qry handDB if is resource handQ f debug print lt br gt SQL QUERY error msg mysql error exit serious failure 1772771 y SoutAry array if is resource handQ print lt br gt SQL QUERY error msg mysql error return outAry D I i while row mysql fetch array handQ MYSQL NUM SoutAry i row array of arrays Si D I return outAry 12 ANCILLARY CODE 314 12 7 FetchKey Within ancillary php we initially had a FetchKey function as follows but there are substantial albeit infrequent problems with this approach function FetchKey handDB ky start atomic list keyval GetSQL handDB
12. 12 ANCILLARY CODE 305 Sactiveusers SQLManySQL handDB qry get active users Sactiveusers Flatten activeusers Susers GetLinkedUserDetails handDB activeusers link MyDoubleSort users 1 0 fsort by surname then forenamel PrintDetailTable users 5 f print table vith 5 columns 12 3 Tables arrays and sorting 12 31 MyDoubleSort Given 2 D array of rovs sort first by the first column then by the second if first column entries ar qual similar to MySort function MyDoubleSort s arry coll col2 GLOBAL CLUMSY INDEX CLUMSY INDEX coll GLOBAL CLUMSY_INDEX2 CLUMSY INDEX2 co12 usort arry my dblsort function my dblsort first second CLUMSY INDI OBAL CLUMSY INDI r strcmp S first CLUMSY INDEX second CLUMSY INDEX f Sr if nonzero not the same return r y two items are equal so compare sub items return strcmp first S CLUMSY INDEX21 second CLUMSY INDEX21 bw 02 12 3 2 ConcatenateArray Join all array elements into a single string separating elements with blanks There is a terminal blank function ConcatenateArray ary opt foreach ary as itm Sopt Sitm D I return opt D I 12 ANCILLARY CODE 306 12 3 3 Flatten Given an array of many dim
13. r r 54 if Stringlen XLpath gt 5 Then isXL 1 TARGET Microsoft Excel EndIf EndIf If isXL 1 Then Run XLPATH amp amp fnam amp SUFFIX EZPATH 6 EZDIR QSW MAXIMIZE Else Run Notepad exe amp fnam SUFFIX EZPATH EZDIR SW_MAXIMIZE EndIf WinWaitActive TARGET NinNaitClose TARGET GuiSet State SW_RESTOR 30 E EndFunc Queue entries for replay by SAFERsleep AddToSSList open the file SSLIST TXT and search for an entry FILENAM if the entry exists return t ESSUFFIX DAT he index of the entry suffix is s or m z if it doesn t insert the entry and return MINUS the index on failure return 0 r Also create a log file FILENAMESSUFFIX play LOG Func AddToSSList SEZPATH FILENAME SUFFIX DURATION partname FILENAME amp SUFFIX do NOT add DAT here fpath EZPATH amp ez replayNSSLIST TXT Slogname EZPATH 6 log 6 FILENAME 6 SUFFIX amp play LOG might confirm DURATION is numeric epochs 1 Int SDURATION 4 5 NO we want minutes If FileExists fpath 0 Then Sfh FileOpen fpath 2 Create new file If fh 1 Then FileWriteLine logname Error 1 Bad file 6 fpath xx vrite to log rr Re
14. 0 0 2 EZ CAPTURE MANUAL DATA CAPTURE SsISIAR 0 does IAR exist SsISXML 0 SsISCSV 0 SsISDAT 0 SsISSS 0 is automatic name in SS submission list make the GUI GuiCreate 7 Dim mygui SFILENAME 6 EZ Data Manipulation 6 SDATETIME Case No 41 800 600 30 10 SWS_CAPTION WS SYSMENU WS MINIMIZEBOX SWS_EX_TOPMC FONT Sfont Comic Sans MS e GUISetFont 8 400 1 font Size 8 font labels GuiCtrlCreateLabel MANUAL RECORD Acquire using calipers keyboard 10 12 2x labw h SAFERSLEEP RECORD Obtain from 10 6 3x pitch 2 labw h Valid 2 6 hskip 0 7xS pitch GuiCtrlCreateLabel GuiCtrlCreateLabel buttons database Slabw h Dim SbSBP GuiCtrlCreateButton SBP Sx lea pitch Sw h Dim bDBP GuiCtrlCreateButton DBP Sx 2xSpitch Sw Sh Dim bHR GuiCtrlCreateButton HR Sx 3xSpitch Sw Sh Dim bSpO2 GuiCtrlCreateButton SpO2 x 4x pitch Sw Sh Dim SbETCO2 GuiCtrlCreateButton ETCO2 x 5x pitch Sw h Dim mCSV GuiCtrlCreateButton Parse to CSV 1 6 Shskip 3 Spitch Sbigw h Dim mDAT GuiCtrlCreateButton CSV to DAT 4 Shskip 3x pitch Sbigw h Dim mSS GuiCtrlCreateButton Add to SS list 5x hskip 3x pitch Sbigw h Dim sGE
15. ION SFAT SE SFAT SEZ ISLIS ED SFAT SEZ VALI hen D Then wa FAT ENUMB GUIC DFLAGS s Done EZ CAS ER SFA EZ CASEDATE SFA F EZ_CASETIME SFA EZ CASEEN F D SFA EZ_S URGERY G FA durat For ESCRIPTION MsgBox SONTOP EA D ion Validate Ty trlRead caseID GUICtrlRead my GUICtrlRead myTIME GUICtrlRead myEND UICtrlRead mySURGERY GUICtrlRead myDESCRIP AllInputs FAT SEZ CAS SFAT SEZ CAS SFAT SEZ CAS SFAT SEZ CAS Duration is DATE I r D ION ENUMBER DATE TIME END s Sdurat F F F ebug If duration gt 0 Then GUIDelete mygui SFAT O SEZ_MAXLINE SFAT SEZ DURATION SFAT SEZ ISLISTED SFAT SEZ VALIDFLAGS and here WRITE fil EZPATH amp ez i SFAT fn 5 Vomit fn rr 5 Sduration Sislisted Svalidfla e gs button pressed F r ion number of items ER ER amp inf Then s inf ESCRIPTION FIX THE FOLLOWING nfo s SFAT S vrite file EZ CAS ENUMB Aint ER s INF file for this case 2 EZ CAPTURE MANUAL DATA CAPTURE 64 Return FAT Else GuiCtrlSet
16. my SEZPATH ez my SOUTPATH SEZPATH csv my SLOCALPATH SEZPATH xml my EXITCODE 0 code on exiting Perl my DEBUG 3 0 debug off l overview 2 detail 3 nitpicking my LOGPRINT 1 print to log my SWARNINGS 0 see usage the following are global my SLOCALFILE SARGV 0 get filenam g S0012 WITHOUT suffix my PARAMS SARGV 1 eg debug 3 logprint 0 if SPARAMS debug d command line control SDEBUG 1 if PARAMS logprint d SLOGPRINT 1 4 FORMAT TRANSLATION EZ XLATE 85 sOpenLog LOGPRINT SLOCALFILE start writing to error debug log if LOCALFILE S d 4 i amp Die Bad file name lt SLOCALFILE gt my FILENAME LOCALFILE xml f e g S0012 xml my LINECOUNT 0 SFILENAME SLOCALPATH SFILENAME open FILE FILENAME or amp Die Unable to open file lt SFILENAME gt sPrint Debugging file FILENAME 1 my QINDATA lt FILE gt close FILE my coutf SOUTPATHSLOCALFILE s csv note s suffix for sAFERsleep Print An Source file lt SFILENAME gt n Output path lt SOUTPATH gt An Local file 51 open COUTFILE gt Scoutf or amp Die xCRASH Could not open output CSV FILE coutf n
17. HOLESTRING as contains pipes bad rank value numeric bad value bad coded value for Seen Before SMA manual if SMANUALORAUTOMATIC SMA automatic SSB no if SEENBEFORE 2 SSB yes SCH no if SCHOICE 2 SCH yes here simply print results print lt lt lt HTML2A manual automatic 155 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 156 lt h3 gt Raw data outputs lt h3 gt lt p gt Patient ID SPATIENTID lt p gt Start time STARTTIME lt p gt Final ranking coded SFINALRANK lt p gt Manual automatic SMA lt p gt Seen before SSB lt p gt Would want similar anaesthetic SCH HTML2A turn array into table print lt lt lt HTML3 lt p gt lt table width 906 border 1 lt tr gt lt td gt lt i gt Image lt i gt lt td gt lt td gt lt i gt Timestamp lt i gt lt td gt lt td gt lt i gt iFlags lt i gt lt td gt lt td gt lt i gt First comment lt i gt lt td gt lt lt td gt lt i gt Importance lt i gt lt td gt td gt lt i gt aFlags lt i gt lt td gt lt td gt lt i gt Second comment lt i gt lt td gt lt tr gt HTML3 Srowarray explode SWHOLESTRING foreach Srowarray as Sr print lt tr gt ca explode r foreach ca as c print lt td gt cval explode c c Sanitise cval 2 print
18. SEXITCODE 128 ib fatal Print n nExit code 128 exit SEXITCODE caution SEE http perldoc perl org functions exit html die An Fatal T Here s how we read a line we use the INDATA array previously shlurped in sub ReadLine SINDATA SLINECOUNT SLINECOUNT chomp get rid of cr lf amp Print n Check LSLINECOUNT datum is lt S_ gt 2 if 1 7 dt dt d amp Die Ain Bad datum at line SLINECOUNT value is my ln 1 d 2 Sln SLINECOUNT 1 4 amp Print in Bad line number LINECOUNT value is 0 SWARNINGS F temporarily remmed out D I return d We require a Store routine where we append data to the relevant time within ALLDATA 2 EZ CAPTURE MANUAL DATA CAPTURE 25 sub Store my St Sy St Sy _ my a if length SALLDATA St gt 0 SALLDATA S t else a time St start with time my Sv SVARIABLES SIDX SALLDATA St Sa v Sy amp Print n gt SSTORECOUNT Store Sy at time St type is v 2 SSTORECOUNT We concatenate in a value to sort out the potential if infrequent problem where two data values are stored against the same time We might later test for and warn about this anomaly Similar are StoreZero and StoreYCal and a smaller stack to store the few
19. lez iar S CAS XxCRASH Could not op OUTFIL TFIL TFILE gt Close g SLOGPRINT E E Sanswer exit SEX Here are sub SOLFet my my myODBC amp DoSQL my dat myODBC dat return sub DoSQL my my retcode if myODBC Data SmyODBC SmyODBC Sretcode ITCODE E the SQL handling routines chDatum ODBC SQLstmt SOLstmt myODBC H SSQLstmt gt FetchRow get dat SSQLstmt SQLstmt Q SmyODBC gt Sq my retcode if problem sqlErrors NUM IAR 3 7 ODBC stmt nimum SREALNUM fetch failed exit or dead 1 I en OUTPUT FILE ez iar CAS ENUM IAR n data L SSQLstmt Length just anlen 3 RETRIEVE FILES FROM SAFERSLEEP USING PERL if retcode 1 amp Die ERROR SOL failed code else SsqlErrors myODBC sError if sqlErrors y sPrint SQL problem retcode D I SEXITCODE Sretcode 80 n lt SQLstmt gt 17 911 4 E1 4 TO T7 1 signal warning n lt SSQLstmt gt sql Errors n Subsidiary routines follow in the next sections They are pretty standard The log file is identified by iar after the file name sub Die my Se Se _ amp Print
20. CASI NOTI NO SCASENUMBER RENOTE m D m P WriteForm ACTION PATIENTID TIMESTAMP SIDEHEIGHT BIGHEIGHT 25 INNERWIDTH 750 INNERHEIGHT 350 XINNERMARGIN parseInt BIGWIDTH INNERWIDTH 2 YINNERMARGIN parseInt BIGWIDTH INNERWIDTH 2 CNORMX LEFTINDENT SIDEWIDTH XINNERMARGIN two CNORMY TOPDOWN YINNERMARGIN WriteBottomNote CASENO NOTE LEFTINDENT TOPD WriteSidepanel LEFTINDENT TOPDOWN SIDEWIDTH E WriteDisplaypanel LEFTINDENT SIDEWIDTH TOPDOWN B WriteControlpanel CNORMX CNORMY INNERWIDTH i OWN SID ENT 5 SI EH EIGH IGWIDTH INNE RH EIGH EN css gt SIDEWIDTH 114 these variables won t be altered often at all tion FF buttons not clicked TOPDOWN 5 BIGWIDTH BIGE mportant globals DEHEIGHT BIGWIDTH SIDEWIDTI BIGHEIGHT 11 ACTUAL ENTRY OF DATA 266 WriteFinalReport L EndForm script head HTMLO Se dE He e adjacent in the output array SINARR function SpecialRandom SOUTA array i Slasti while if T force first not Si 9 4 first 9 items SDEBUGGING print lt br gt Debug random y Sidx if Rand
21. amp Die Unable to open etco2 file rawdata SRAWFILENAME hdr FILE my 6ETCO2 FILE close FILE my sz 1 4SPO2 if sz 1 numobs SEXITCODE 16 signal problem with etco2 data or use SSERIESCOUNT amp Print n nExit code 16 observationse numobs sz F3 amp XferData ETCO2 sub XferData my X X _ my d c t inp Dr foreach d X chomp d if length d gt 1 ignore blank lines t 5x c time in minutes 5 count 2 EZ CAPTURE MANUAL DATA CAPTURE if d 1 sStore t 1 signals NA elsif Sd 17 Nw x Nd Md X 2Adx Awx amp Die Bad data line c value d else Sinp 2 if 1 c amp Print An Warning time mismatch c SWARNINGS y sStore t inp store value D I c E bump count 2 3 6 Write data 31 Note that in the following we should perhaps round the output data to four sig nificant digits but at present we don t adulterate them sub WriteAllData my STIMESTAMP STIMESTAMP QL my qd c 0 for starters c 1 if DEBUG simply print each datum to the log Print An Debug raw data 1 foreach d ALLDATA if length d gt 0 amp Print c y y y
22. black 9900CC yellow 4FF9900 4990000 white INTERVENTIONS new Array fluid analgesia vasoconstrictor inotrope vapouriser vent end of initialisation section start of FUNCTIONS nction Writel id Img x0 y0 w h document write div id Layer document write id document write style position absolute background color transparent left document write x0 document write px top document vrite y0 document vrite px mvidth document vrite v document vrite px height document vrite h document vrite px z index document vrite 0 for nov deep document write gt lt img srce Img width document write w document write Un height document write h document write id XImage document write id document document write writeln div split for TIDY nction WriteData id 0 y0 w DAT datlen we can pull out all we require from DAT each line of DAT is an array containing rlImage rlIflags rlimportance rAflags rTime rIcomment rAcomment index 0 1 2 3 4 5 6 We start with rIflags rIimportance int rImage 5 gives us the horizontal offset 24 bins rIflags can be masked for each item in turn and rImportance gives us the vertical extent of the 10 WORKING PHP CODE 246 For each 5 min inte
23. else alert WARNING Cookies are NOT working You need to enable cookies for thi function SubmitLogon myform if myform username value length lt 4 alert Invalid user name Must be at least 4 charactersl return false y password myform pswd value if password length lt 6 alert Invalid password At least 6 characters are required return false y salt SSALT now md5 as required alert Debug You input password password myform pswd value hex_md5 salt hex_md5 password alert Debug encrypted value for hex_md5 password is myform x return true D I function Set_Cookie name value expires path domain secure var today new Date today setTime today getTime if expires expires expires x 1000 x 60 x 60 x 24 var expires date new Date today getTime expires document cookie nam escapel value expires expires expires date toGMTString path path path domain domain domain secure secure function Get Cookie check name var a all cookies document cookie split var a temp cookie var cookie name var cookie value var b cookie found false set boolean t f default f 9 PHP ACCESS CODING 180 for 1 0 i lt a al
24. amp amp NotPair 1 lasti return i y i Y return 0 hmm 0 and 1 are a pair but not 1 and 2 function NotPair i j if i 3 1 amp amp j 5 2 return 0 function to read in CSV file containing randomised study cases function FetchStudyList SINSTUDY 11 ACTUAL ENTRY OF DATA 268 open and read relevant line from file csv RandomStudyCases csv CSVFILE csv RandomStudyCases csv if stat SCSVFILE if not exists print lt br gt File not found SCSVFILE return Signal error SBIGLINES file CSVFILE get all lines if sizeof BIGLINES lt SINSTUDY print lt br gt No random array for Study Participant No INSTUDY return 4 2 bl SBIGLINES SINSTUDY 4 what if fails bl preg replace 501 replace commas with spaces NO terminal return bl We don t provide a sample CSV array you have to create one yourself 11 2 Storing the data The following page eZ_store php takes POST data from the preceding script and writes them to the database It s similar to the corresponding page that follows demo15 htm but that page doesn t write to the database merely displaying the values onscreen header Cache control no cache require once ValidFx php our login validation script SMINUSERSTATUS NOBODY
25. the background for the electronic record TOPGAP VSEPARATION parselnt ISCALE IMAGEH IMAGI OPGAP VSEPARATION parselnt ISCALE IMAGEH 5 100 50 Writel 1 DrawMsg 2 WriteData what about left panel new Array 1 16 0 new Array 5 32 0 Array 10 6 0 Array 15 1 0 Array 20 2 0 Array 25 3 0 Array 118 0 write top fin SImage0 XIND XINDENT 77 erlay data 0 XINDENT X E 5 Fr 1 47 28 56 27 255 Ar Ld Fr 5 7 O y 244 115 20090214155457 Another note 14 20090214155721 consider something 137 20090214155947 Y 16 20090214160100 r III 20090214160209 why 15 20090214160612 maybe something 15 20090214160756 depending on total op al background image handwritten record I ENT EFT SImagel XIND ENT XINDENT 77 1 XINDENT X EFT end of main Javascript gt lt script gt lt head gt TOPGAP IMAGEW parseInt ISCALE x IMAG TOPGAP 5 100 50 lt h3 gt Handwritten lt h3 gt transparent I EH 0 r ie TOPGAP parselInt ISCALE 0 YBOTTOM IMAGEW XLEFT TO PGAP VSEPARATION parselnt ISCALEx IMAGEH
26. y y D I 10 8 Viewing data We ll start with a simple list of who has done what referenced from a main view ing page 10 8 1 eZ view php header Cache control no cache STHISPAGE eZ view php require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS View delete data 0 Gl added code for showing artefacts Sqry SELECT distinct sCode FROM SUBJECT ANRECORD ONESESSION PERSON WHERE ONESESSION Person PERSON person AND ONESESSION Anrecord ANRECORD anrecord ANI ANRECORD Subject SUBJECT subject AND 10 WORKING PHP CODE PERSON instudy IS NOT NULL ORD cases Scaselist end artefact code print lt lt lt HTMLO Flatten SQLManySQL handDB rtrim ConcatenateArray cases 238 ER BY sCode Sqry get cases remove terminal space lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View delete data lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER lt p gt lt a href main
27. 88 4 2 Translate from CSVto DAT 90 4 2 1 Interpolation uod a R AUR dis 91 4 2 2 code to translate to DAT 92 4 2 3 A DOS batch file csv2dat 105 5 ez replay Replaying data via SAFERsleep 107 3 1 Autolt code for monitor replay 2 2 2 ee ewe 107 544 Invoke ez replay from DOS ooo zo vers ee 115 6 Image transformation 115 6 1 Using ImageMagick 22 4 2s eed eee x eS 115 6 2 Autolt code ez mogrify au3 118 6 3 Trimmed final images A EE a 121 7 ez shw An interactive web based application 125 Sch TAR 2 ok RARA HH ERS 125 Td TONKS PIES A od od ee SS EER ES 126 AI Helppa ea eae be ee PES 30 RERO e e 903 127 jo s s AR He Gee He Go AA A 130 Ta Cascading style shest on sw te ERE drid oo RS 152 7 3 1 Process the demonstration page 154 8 Database definition 158 Sl PERSON alfa ROI av arda oe ald Wa up 158 8 2 PERSDATA CURRENTSPECIALTY CURRENTLOCATION 160 83 SUBIECT 229 pos d y an d Bey gin a se s b 161 B ANRECORD a Roe 161 5 5 ONESESS ON uoc AE sas a we S9 OS 3 za Foe x 162 10 RATING Cn 163 87 NEXTSESS ONS 6 2 e G6 s da Y BUY LG 163 05 BUS SAT e Lc Goeck Be e bod E b 3X eee 165 A A DC 166 5 10 Database SUCHE o s e deu boy egy Pacs EERE ERS 168 8 11 Testing the dat
28. If s 1 listed Then Sarr EZ_ISLISTED s 2 Else SWARNINGS VARNINGS 1 EndIf parameters added in v 0 37 Sv FileReadLine f end time s StringSplit v If s 1 end Then Sarr EZ_CASEEND s 2 Else SWARNINGS VARNINGS 1 EndIf Sv FileReadLine f description s StringSplit v If s 1 surgery Then Sarr SEZ SURGERY 55121 Else SWARNINGS SWARNINGS 1 EndIf Sv FileReadLine Sf surgery s StringSplit v If s 1 description Then Sarr S EZ DESCRIPTION s 2 Else SWARNINGS VARNINGS 1 EndIf Sv FileReadLin SEIS duration derived s StringSplit v If s 1 duration Then Sarr SEZ DURATION s 2 Else SWARNINGS SWARNINGS 1 EndIf If SWARNINGS 0 Then 2 EZ CAPTURE MANUAL DATA CAPTURE 67 MsgBox ONTOP Warning In reading file 6 fnam _ s there was were amp SWARNINGS 6 line s containing bad data EndIf FileClose f Sarr 0 SALEN Ps sige Return arr j return an ARRAY EndFunc The reverse function Vomit writes an array that was Slurped Badly written and nasty Func Vomit fnam S ARR Dim SALEN 1 SARR 0 get item count here might check this vs EZ DURATION
29. can add more to the above if chirp alert Operation details must be 4 128 characters long return false y return true function ConfirmClear if confirm Are you sure you want to clear the form Click OK to clear itl return true return false gt lt script gt lt head gt lt body gt SMYHEADER HTMLO SDEBUGGING 1 remove me later fix me print lt lt lt HTML2 lt FORM name eZ_adda ACTION eZ_anaestheticadded php METHOD POST onSubmit return CheckInput this gt lt h3 gt Subject anaesthetic details lt h3 gt lt table width 658675 tr td td td S code td td lt input type text name scode sizez 7 onChange ValidSCode this 1 gt lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt Description lt td gt lt td gt textarea name description rows 4 cols 50 onChange ValidDescription t td tr tr td td td Operation td td textarea name operation rows 2 cols 50 onChange ValidOperation this td tr 11 ACTUAL ENTRY OF DATA 297 lt tr gt lt td gt lt td gt lt td gt Age lt td gt lt td gt lt input type text name ageyears size 5 onChange ValidAge this 1 gt lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt Number of images lt td gt lt td gt lt input type text name
30. id incvent id decrvent lt span gt id ilabelg gt decrease ventilation lt span gt type checkbox name upfio2 id upfio2 onClick onClick gt onClick onClick oncliecke onClick gt id ilabelh gt increase FiO sub 2 sub lt span gt type checkbox id ilabeli other colse 30 valign top gt table width 400 border 0 td colspan 2 lt span class invisible mymenu lt br gt name iother onClick ShowTheRest onClick CancelIntervention id iother id rankingl lt b gt Please rate the importance of the intervention lt b gt span i lt td gt lt tr gt lt tr gt lt td colspan 2 div class invisible mymenu 0 lt table gt lt tr gt lt td rowspan 2 gt minor lt td gt td rowspan 2 critical td lt tr gt lt tr gt lt td lt td lt td lt td lt td lt tr gt lt table lt div gt lt td gt XZtrET J lt tr gt lt td colsp lt br gt lt br gt lt b gt lt span class invisible mymenu lt td gt lt tr gt lt td lt td lt td lt td lt td align center gt 1 lt td gt align center gt 2 lt td gt align center gt 3 lt td gt align center gt 4 lt td gt a
31. in case SetClock TICKTIME function ZeroClock document images clock src MYCLOCK 01 src TICKER 0 buffered image loading sequential function NextBuffer if BUFFERING 6 MODIM 0 Tick4 132 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 133 y if BUFFERING lt TOTALIMAGES either loadNextImage preload an image else or ZeroClock finally display first image document getElementById loadingLabel style visibility hidden document images mainimage src MYIMAGES 0 src ugh NextOn y function loadNextImage uses globals BIGWIDTH BIGHEIGHT MYIMAGES BUFFERING new Image BIGWIDTH BIGHEIGHT MYIMAGES BUFFERING onload NextBuffer var j PATIENTID indexOf get stem of patient ID if j 1 alert Oh bugger Bad filename PATIENTID return y var pathname png PATIENTID substring 0 3 var serial MakeSerial BUFFERING 3 serial number var myname pathname PATIENTID serial x png alert Debug File is myname MYIMAGES BUFFERING src myname function PreloadImages NextOff IntOff Artoff if document getElementByld loadingLabel document getElementById loadingLabel style visibility visible y loadNext Image function MakeSerial i lgth while i toString length lt lgth i 0 i toString y
32. new Function arg this color arg toLowerCase function x this stroke x LE 11 41 this drawLine mkLinDott this mkOv mkOvDott this drawRect mkRectDott else if x 1 gt 0 this drawLine mkLin2D this mkOv mkOv2D this drawRect mkRect else this drawLine mkLin this mkOv mkOv this drawRect mkRect this setPrintable function arg this printable arg this mkDiv mkDivle arg htmPrtRpc htmRpc v jg n4 mkLyr arg mkDivPrt mkDiv function fam sz sty am ty Font PLAIN ine this drawPolyLine function x y s i x length 1 i x i ylil x i 1 y i 1 5 function x y w h y w h 285 11 ACTUAL ENTRY OF DATA 286 ct this drawPolygon function x y this drawPolyline x y his drawLine x x length 1 y x length 1 x 0 v 01 this drawEllipse this drawOval function x y w h this mkOv x y w h this fillEllipse this fillOval function left top w h var a w 1 gt gt 1 b h 1 gt gt 1 wod w 1 1 hod 1 41 cx left a cy toptb x 0 y b ox 0 oy b aa2 axa 1 aa4 aa2 1 bb bx b lt lt l st aa2 gt gt 1 1 b lt lt 1 bb tt bb gt gt 1 aa2x b lt lt 1 1 pxl dw dh if w 1 while y gt 0 if st 0 st bb x 1 3 tt bb lt lt l x else if tt lt 0 st bb
33. this htm lt div style position absolute left x px c topi r zb Berta width wit amp height h amp lt img srce imgSrc width w height h a a EE y this clear function this htm if this cnv this cnv innerHTML this defhtm 288 ry ESA ae 11 ACTUAL ENTRY OF DATA this mkOvQds function cx cy xl xr yt yb w h this mkDiv xr cx yttcy w h this mkDiv xr cx ybtcy w h this mkDiv xl cx ybtcy w h this mkDiv xl cx yttcy w h 289 this setStroke 1 this setFont verdana geneva helvetica sans serif String fromCharCode 0x31 0x32 0x70 0x78 Font this color 4000000 this htm this und wnd window if jg ie jg dom jg ihtm chkDHTM if typeof id string id this paint pntDoc else this cnv document all this wnd document all id null document getElementById this wnd document getElementById id null null this defhtm this cnv amp amp this cnv innerHTML this cnv innerHTML this paint jg dom pntCnvDom jg ie pntCnvIe jg ihtm pntCnvIhtm pntCnv this setPrintable false function integer compare x y return x y 1 x gt y 1 Here s the pie graph script x This notice must remain at all times pie js Copyright c Balamurugan S
34. while bkcnt lt SMIDIDX Sbkent Sbkval delta amp Print An SMID Sbkent lt gt SMID S bkcnt amp Backfill j amp Trunc S bkval note truncation to 6 decimals amp Print MID S bkcnt 3 print x y y END OF BACKFILL keep value SLASTGOOD j SMIDIDX amp Print n writing v to current line at index j MID STHISLINE 3 v y else amp Print SKIPPED non numeric 3 y nd while LINECOUNT final line here SMID MIDIDX Commaline QTHISLINE Print An FINAL LINE at MID index MIDIDX THISLINE 3 f end pre processing amp Print n n BACKFILLED ARRAY 3 foreach MID amp Print An 3 y Print inn print gt signal end of pre processing Tir Ta EE ER E HA HERE ERE E ER Tig ERE HHHH my SILEN S MID do NOT add 1 my LINECOUNT 1 4 DO NOT skip first line while SLINECOUNT SILEN 4 FORMAT TRANSLATION EZ XLATE 98 SLINECOUNT 5 SMID SLINECOUNT was bug in v0 38 here my QD split fix Julian gt Gregorian amp Print An Gregorian D 01 gt 3 my STHISTIME SD 0 SD 0 amp ModGregorian STHISTIM amp Print SD 0 3 show progress for command line print my r foreach r RULES my Sopt gExtractDAT r QD if length opt 5 0
35. Q SEZPATH Nez VN SDESTPATH SEZPATH ez shwNphpNpng s SREPLAYPATH SEZPATH 6 ez replay V SLISTNAME SREPLAYPATH SSLIST TXT SCURRFILENO 1 1 BIG LOOP SISMORE 1 SSKIPPER 0 While ISMORE SFD GetFileList SLISTNAME CURRFILENO If SFD 0 0 Then sgBox ONTOP Finished mogrifying Last line vas amp CURRFILENO Exit EndIf If IsNumber 0 FD 3 1 Then SSKIPPER FDI31 MsgBox SONTOP Debug Skipper is amp SKIPPER Else MsgBox SONTOP Debug Dud skipper amp SFD 3 EndIf SCURRFILENO 1 bump count SCURRENTFILE SFD 1 SCAPTURECOUNT SFD 2 If IsNumber CAPTURECOUNT 0 Then 6 IMAGE TRANSFORMATION 119 sgBox 0 Error Bad count 6 CAPTURECOUNT _ for line CURRFILENO amp File is CURRENTFILE Exit EndIf Sstub StringSplit CURRENTFILE will remove suffix SFILESTEM Sstub 1 SSAVEPATH SDESTPATH amp SFILESTEM subdirectory to save to If FileExists SAVEPATH 0 Then If Not DirCreate SAVEPATH Then sgBox Error Failed to create directory 6 SSAVEPATH Exit EndIf EndIf debugging stuff mogrify a set of images
36. Xn c a 1 1 get a solid Y calibration value what about subtracting avg zeroes 777 my ycal amp GetYCal SRECORDTYPE amended v0 53 2 Pull out data values using tags first open file for writing EMP E 2 EZ CAPTURE MANUAL DATA CAPTURE 32 open OUTFILE csv SRAWFILENAME m csv or amp Die xCRASH Could not open OUTPUT FILE csvloutSRAWFILENAME n m suffix indicates it s a manual file s is SAFERsleep print OUTFILE Time NBP s NBP d HR Sp02 ETCO2 NBP m rawSBP rawDBP rawHR names correspond to SAFERsleep DAT names NBP m is calculated below foreach d ALLDATA if length d gt 0 amp Print n n Extracting lt d gt 3 if Sd if no terminal comma Sd Sd ensure terminal comma iz sPullLine d ycal TIMESTAMP D I close OUTFILI D I El Here s the routine to extract all data for one ALLDATA line and write to output We first extract the data to an array v Because we also wish to record the mean blood pressure a value calculated from the systolic and diastolic and the raw values we introduce the variable NASTYOFFSET which is the offset in v of the mean pressure Raw values are stored sequentially to the right of this offset sub PullLine my d ycal TIMESTAMP Sd ycal TIMESTAMP _ my time
37. amp SFILENAME amp s amp datrules txt SEZPATH If perlok 0 Then MsgBox ONTOP Note Conversion was successful TestFile sSS SEZPATH amp dat SFILENAME s dat se MsgBox ONTOP Problem See log Return code was amp perlok EndIf Case msg 5595 If AddToSSList SEZPATH FILENAME s SDURATION gt 0 Then if success SISLISTED BitOR SISLISTED 2 bit 1 set ss file StoreParam SEZPATH FILENAME EZ ISLISTED SISLISTED Store listed sgBox ONTOP Success Added to play list amp FILENAME 6 s DAT If SISLISTED 3 Then if both flags set myEnable REPL EndIf or make this a rtn Else 2 sgBox ONTOP Oops Failed to add 6 SFILENAME 5 to playlist EndIf Case msg REPL Sdoit MsgBox SONTOP 1 Confirm Do you want to replay the files If doit 1 Then OK button pressed 2 cancel GuiSetState SW_MINIMIZE Sperlok RunWait ComSpec c amp _ SEZPATH ez replay ez replay au3 SEZPATH GuiSetState 80SW RESTORE E 2 EZ CAPTURE MANUAL DATA CAPTURE Else EndIf MsgBox SONTOP Cancelled rr PNG file mogrification Nothing done
38. function StoreArtefact if StoreAndThanks 0 0 artefact MessageOn Thanks 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 140 RestartClock RestoreControlPanel else alert Please select artefact one of SBP EtCO2 Ta function StoreAndThanks annotated jvs vary depending on artefact annotation var datastring var firstcomment NoPipes document myform intervention value firstcomment NoSemicolons firstcomment var secondcomment NoPipes document myform variablecomment value secondcomment NoSemicolons secondcomment var sbp document myform sbp checked var dbp 2 xdocument myform dbp checked var mbp 4 xdocument myform mbp checked var hr 8 xdocument myform hr checked var spo2 16xd3ocument myform spo2 checked var etco2 32 document myform etco2 checked var flagall sbp dbp mbp hr spo2 etco2 if flagall 0 return 0 try return and see how this fails silently y ixa document myform fluid checked ixb 2 xdocument myform analgesia checked ixc 4 xdocument myform vasocons checked ixd 8 document myform inotrope checked ixe 16 xdocument myform bblock checked ixf 32 document myform incvent checked ixg 64 document myform decrvent checked ixh 128xd3ocument myform upfio2 checked ixi 256xdocument myform iother checked ixall ixa ixb ixc ixd ixe ixf ixg ixh ixi var rankall if annotated ranka
39. perlok RunWait prog FILENAME amp amp seqname amp amp SDURATION amp amp SDATETIME SEZPATH SW_MAXIMIZE run the Perl program in DOS with relevant arguments 7 last Run parameter specifies working directory If perlok 0 Then Return 1 EndIf 2 EZ CAPTURE MANUAL DATA CAPTURE MsgBox EndFunc SONTOP OOPS 7 2 4 5 Decrypt SAFERsleep LAR file to XML Error in keyboard input 59 It is also possible to retrieve automatically captured records from SAFERsleep but these are encrypted A decryption tool is provided with XML output but it is inconvenient to use this tool manually on multiple records We therefore automate the process again using Autolt and Perl Here s the code that coordinates the translation from TAR to XML Func Iar2Xml FF EZPATH VezN SXPATH SIARPATH SXMLPATH ERRORLOG ClipPut Pi ESF Run SXPATH amp WinWaitActive WinAc Sleep rr rr 51 5 tivate 1000 EZPATH EZPATH amp SEZPATH SEZPATH xx NB xx at present we assu SIARFILE lar xmi EZPATH 6 log NAME ez xlateN As NUS amp m th xist nc SIARFIL ENAM s clear clipboard t bat tivate SAFERsleep viewer xla SAFI SAFI amp rary HERE
40. print p render pieCanvas Pie Graph print lt script gt lt div gt function WriteOneRating ShandDB session r Stags array img t iflags cl rank aflags c2 f my standard tags ca explode r print lt br gt Debug one row print_r ca i X array foreach ca as c Scval explode c if strcmp cvall01 Stags i if broken bad tags print lt br gt Bad data item amp lt c amp gt value cval 0 tag readfile badcode htm exit y Scval 1 Sanitise v by reference ugh SX i v keep datum in order Si D I SIMG X ST X SIFLAGS X 5 1 X SRANK X 4 if strlen RANK lt 1 SRANK NULL SAFLAGS 5 151 C2 SX 6 ugh might formalise formatting using rule template here might check that IMG IFLAGS AFLAGS are all numeric Srkey FetchKey handDB Rating 11 ACTUAL ENTRY OF DATA 274 Sq INSERT INTO RATING rating rlmage rTime rlflags rIcomment rlimportanc 02 VALUES rkey SIMG TIMESTAMP T SIFLAGS C1 RANK SAFLAGS DoSQL ShandDB q write one assessment note that artefact and standard assessment are stored in th What about a pie graph Here s the javascript x This notice must be untouched at all times wz_jsgraphics js Vo 2233 The
41. sub GetLocalTime my sec min hour mday mon year Swday yday isdst sec min hour mday mon year Swday yday isdst CORE localtime time Syear 1900 fix y2k Ssec amp DoubleDigit sec Smin amp DoubleDigit min Shour amp DoubleDigit Shour Smday amp DoubleDigit mday Smon amp DoubleDigit mon Smon january is zero return year mon mday hour min sec 2 EZ CAPTURE MANUAL DATA CAPTURE 12 sub DoubleDigit my i i Q7 if length i 1 return i return 051 sub Print concatenate my p level 4 level is debugging level f O none l overview 2 detail 3 picky p level 8 if SDEBUG gt level f if level is 0 always print if LOGPRINT print LOGFILE p return D I print p f console print D I sub Die my e Se _ my 1 SLINECOUNT 1 Print n n DIED Data line 1 X Index was IDX Xn Message e 0 SEXITCODE 128 fatal exit SEXITCODE caution SEE http perldoc perl org functions exit html die n Fatal Reading console values sub ReadConsole my Sdattype Sdattype my jd my gd my Syy mm if C 1565 17 Y SDURATION ts SDURATION S ts Q dd hr mi ss N3 2 7 d 2 NV
42. 1 109 v EndIf rr simply write to xml file Soutn StringSplit IARFILENAME get rid of suffix SOUTNAME outn 1 amp xml might check for error SfHandle FileOpen XMLPATH 6 SOUTNAME 2 7 Write erase prior contents If Qerror lt gt 0 Then x AF farleg sgBox ONTOP FATAL Error Failed to open file for writing amp filename Exit EndIf FileNrite fHandle XMLDATA need to do so repeatedly FileClose fHandle WinClose SAFERsleep IAR Viewer WinWaitClose SAFERsleep IAR Viewer Sleep 500 Wait just in case FileWrite SERRORLOG Apparently successful translation 6 SIARFILENAME 7 Return 0 1 success EndFunc 2 EZ CAPTURE MANUAL DATA CAPTURE 61 Enter Case Number Appendectomy Fit young male 5 Figure 3 Initial screen for record information 2 5 Obtain basic record information XGetFileAndTimestamp pops up a GUL and obtains a file name as well as a date and time and certain other information The date is in NZ format DD MM Y Y Y Y and the time is limited to hours and minutes HH MM This interface screen is shown in Fig 3 Func XGetFileAndTimestamp make a simple GUI to check the log in Local x y Bn h pitch skip x 50 Sy 10 Sw 120 h235 Sskip 150 Spitch 50 Dim SFAT 1 SEZ_MAXLINES return array Dim SEZPA
43. 2 my datumA amp ReadLine datumA ZERO amp Die Bad initial zeroing datumA y amp StoreZero STIME SdatumA BBB 3 33 3 T y SdatumB amp ReadLine amp Print An Debug Y cal value is datumB 1 y MAXVALlo MAXVALhi SALPHAlo SALPHAhi MINVALlo MINVALhi RECORDTYPE sTestYCal TIME datumB y MINVAL MINVALlo MINVALhi y MAXVAL MAXVALlo SMAXVALhi y MAXVALm MAXVAL1LO SMAXVALhi 2 f SRECORDIYPE eq D SBASELINE 0 f clumsy hack v0 53 y3 very different record measurements y datumC amp ReadLine sPrint An Debug X cal value is datumC 1 y SDURATION amp TesttCal S TIME SdatumC amp Print An Duration DURATION 1 y truealpha datumC int DURATION 5 y ALPHA SZEROhi truealpha 0 10 0 10 is tolerance y SALPHAm truealpha amp Print An True alpha Struealpha n 1 here check derived DURATION vs TRUEDURATN as STRUEDURATN is in minutes and truealpha corresponds to 5 min datumC truealpha should equal int STRUEDURATN 4 5 2 EZ CAPTURE MANUAL DATA CAPTURE 23 but we can simply say if DURATION 5 1 int TRUEDURATN14 5 amp Print n Minor WARNING duration mismatch DURATION TRUEDURATN 0 SWARNINGS D I wh
44. EBUGGING nce ValidFx php SMINUSERS TATUS NOBODY SMAXUSERS success list SMYHEAD TATUS EVERYONE valida ER no cache f our login validation script te login SHOW USER SUSERSTATUS SMINUSERSTATUS ZHeaderGreet success SMAXUSERSTATUS 10 WORKING PHP CODE 254 Review of data entry 0 here obtain data assessor images S view assessors Sassessor GET assessor Scase GET case Sassi Sassessortl Sasslist _GET ASSESSORS space delimited no terminal space SASSESSORS explode Sasslist Scaselist _GET CASES likewis SCASES explode caselist Snextassi Sassessor l if Snextassi gt sizeof SASSESSORS nextassi 0 if wrap im thiscase CASES casel Sthisass ASSESSORS Sassessor Snextlink showcase php case case amp assessor nextassi amp CASES caselist amp ASSESSOR write header reference to javascript print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View pair for one assessor for given CASE lt title gt LINK href css eZstyle css type text css rel stylesheet gt lt link type text css rel stylesheet href css eZstyle css gt lt script src
45. HTML3 10 2 Assess an anaesthetic 10 2 1 Demonstration page This has been described previously The functionality is as for the demonstration module 1 Identification of the user as usual 2 Presentation of the first screen 3 Timing so the anaesthetic by default advances at 1 minute per minute 4 The user can scan forward in time 5 The user can annotate the anaesthetic at will stating what motivated their decision to intervene 6 The user can identify artifacts 7 All user annotations are stored as long lived cookies 8 At the end the cookie data are written in a mock fashion to the server 9 The user is then thanked for participating Note that the user can pause the assessment at any time but they cannot go back in time We should store the images in a separate png directory that is not the same as the usual images directory We might even have relevant subdirecto ries within the png directory 10 WORKING PHP CODE 200 10 2 2 Actual assessments The actual user assessment is as above but note that a block of ten anaesthetics will be randomised and this order will be preserved There are several other wrinkles e If the assessment is halted and the user exits on return the current state will be retrieved This suggests that we should make some indication of points Of assessment and even permit the user to mouseover these with a popup or overlay of details e For the same a
46. a You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change 13 LICENSING 323 b You must cause any work that you distribute or publish that in whole or in part contains or is derived from the Program or any part thereof to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when run you must cause it when started running for such interactive use in the most ordinary way to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty or else saying that you provide a warranty and that users may redistribute the program under these conditions and telling the user how to view a copy of this License Exception if the Program itself is interactive but does not normally print such an announcement your work based on the Pro gram is not required to print an announcement These requirements apply to the modified work as a whole If identifiable sections of that work are not derived from the Program and can be reasonably considered independent and separate works in themselves then this License and its terms do not apply to those sections when you distribute them as separate works But when you distribute the same sections as part of a whole which is a work based on the Program the distribution of the whole must be on
47. 1 VVe vvish to be selective in the columns vve export from the CSV file 2 Pressures are compound in the IDAS DAT file so we need to amalgamate three columns to create a DAT pressure column 3 In their manual records most anaesthetists do not differentiate betvveen intra arterial blood pressures and non invasive blood pressures We should accordingly render all pressures as NBP in the DAT file 4 IDAS doesn t respect the timestamp in the DAT file simply taking data for each sample as needed Regardless of other settings in demonstration mode IDAS seems to take a sample as originating every 30 s unless sample timestamps are identical in which case the samples are taken as originating at the same time Display in demonstration mode is every minute so if we wish to skip samples we must a Provide dummy samples every 30 s using a modality that isn t com monly displayed b Provide our actual samples as required Although ironically enough the original XML is close enough to make direct translation from XML to DAT attractive 7A subsidiary problem we must explore is the case where either the diastolic or systolic is missing We determine the mean according to Razminia s formula rather than the usual physio logical formula where we add a third of the pulse pressure to the diastolic although there s not much in it 8For example ST3 or disable display of the chosen item from within I
48. Case msg vwDAT ViewNotepad EZPATH dat FILENAME amp m dat Case msg SvwDAT2 ViewNotepad EZPATH dat FILENAME amp s dat Case msg SvwSS ViewNotepad EZPATH ez replay SSLIST txt EndSelect Wend EndFunc Simple subsidiary routines a simple enabling routine Func myEnable ct1 Sst bitAND GUICtrlGetState ctl GUI ENABLE If st 0 Then 7 prevent flicker GUICtrlSetState ctl GUI ENABLE EndIf EndFunc a simple control Func myDisable ct1 GUICtrlSetState EndFunc similar check unc Func myCheck ct1 GUICtrlSetState EndFunc Func myUncheck ct1 GUICtrlSetState EndFunc A routine to chec seq might be one d r rr Func IsRawFile seq SEZPATH VezN SPATHNAME SEZPATH disabling routine ctl GUI_DISABLE heck ctl GUI CH ECKE ctl GUI UNCH ECKE k whet of sbp dbp SFILENAM E amp rawdataV her a particular raw datum file exists etc 2 EZ CAPTURE MANUAL DATA CAPTURE 51 FILENAME SFILENAME amp seq 6 csv SWHOLEFILE SPATHNAME amp FILENAME If FileExists WHOLEFILE Then return 1 success EndIf return 0 ad Y EndFunc to determine vh xSBP xDBP P a oubin Func CheckRaw my5 0
49. Development support by Jexp 2005 sbalamurugan 8 hotmail com Inc http www jexp com This package is free software It is distributed under GPL legalese removed Latest version can be downloaded from http www sbmkpm com This library 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 pie js provides a simple mechanism to draw pie charts It wz_jsgraphics js which is copyright of its author uses Usage var p new pie p add titlel valuel p add title2 value2 it means that you can u 11 ACTUAL ENTRY OF DATA p render canvas_name graph title where canvas name is a div defined INSIDE body tag body lt div id 2 canvas name x hD 0123456789ABCDEF function d2h d var h hD substr d amp 1 return h function h2d h return parselnt h 16 function pie style overflow 5 1 290 auto position relative height 400px width 400px gt lt div gt while d gt 15 d gt gt 4 h hD substr d amp 15 1 h this ct 0 this data new Array this x_name new Array this max 0 this c_array new Array this c_array 0 new Array 255 92 95 this c array 1 new Array 80 127 175 this c array 2 new Array 176 48 96 altered to maroon this c array 3 new Array 111 120 96 this c arr
50. EndIf If overv 1 Then GuiSetState G8 SW MINIMIZE GetSequence dbp FILENAME DATETIME FAKEDCMS myCheck xDBP SFIVEITEMS BitOR FIVEITEMS 2 GuiSetState 80SW RESTORE EndIf Case msg bHR Soverw 1 If IsRawFile hr FILENAME 1 Then Soverw MsgBox ONTOP 1 Warning Rav HR data already captured Overvrite If Soverw 1 Then cancel 2 create single backup fnm EZPATH 6 rawdataX FILENAME amp hr csv FileCopy fnm fnm amp BAK 1 overwrite if exists EndIf EndIf If overv 1 Then GuiSetState G8 SW MINIMIZE GetSequence hr FILENAME DATETIME GEAR myCheck xHR SFIVEITEMS BitOR SFIVEITEMS 4 GuiSetState 0SW RESTORE EndIf EDCMS 2 EZ CAPTURE MANUAL DATA CAPTURE Case msg 505 Soverw qs If IsRawFile Soverw po2 spo2 MsgBox ONTOP 1 Raw SpO2 da ENAM SFIL E 46 1 Then Warning ta already captured Overwrite If Soverw 1 Then cancel 2 create single
51. HTML2 lt p gt lt a href eZ add anaesthetic php Add lt i gt another lt i gt subject lt a gt lt p gt lt a href mainpage php Return to main page lt a gt HTML2E 12 ANCILLARY CODE 301 12 Ancillary code The following ancillary functions are used throughout the database They are all contained within ancillary php The image tinyezlogo png is also required as is the trivial vbar png 12 1 General purpose functions 12 1 1 eZHeaderGreet Return text string and add in header with image function eZHeaderGreet success SMINUSERSTATUS SMAXUSERSTATUS title previous previous is or 1 matches list SUSER SUSERSTATUS OLDPAGE PullOutUserInfo success if SUSERSTATUS SMINUSERSTATUS SUSERSTATUS gt MAXUSERSTATUS readfile failedaccess htm exit fail print lt br gt Debug user status is USERSTATUS SOLD 4 might try eg Welcome hmm if previous if strlen OLDPAG SOLD previously at lt a href OLDPAGE gt SOLDPAGE lt a gt Lu gt 3 Nn Stxt 0 lt p gt lt div align center gt table width 95 lt tr gt lt td width 150 align center lt a href GPL htm img border 0 title Click here alt eZ logo src images tinyezlogo png gt lt a gt lt td gt lt td width 4 gt lt img alt vidthe 4 height 64 src ima
52. SELECT person pPassword FROM PERSON WHERE pLoginName Susername list Suk SMD5PWD GetSQL ShandDB Sqry get md5 password if strlen SMD5PWD lt 31 hack for startup SMD5PWD md5 SMD5PWD print lt p gt Debug md5 pud for username is MD5PUD SCHECKVAL md5 salt MD5PWD concatenate then md5 print lt p gt Debug salted password md5 is CHECEVAL if psud CHECEVAL Force Html InitialLogon Invalid password username exit create expiry time and SID Sexpiry time eZ TIMEOUT SSID Spswd ugh qry UPDATE PERSON SET pSID SSID pExpiration Sexpiry WHERE person Suk DoSQL ShandDB qry set db SID expirn and store SID in a cookie setcookie eZ 510 SSID Sexpiry COOKIE_EXTRA_WAIT Sdqry SELECT pSID FROM PERSON WHERE person Suk list SSID GetSQL handDB dqry debug get sid print p Debug cookie set to 5510 timeout expiry return uk return user key 9 PHP ACCESS CODING 187 Force Html InitialLogon All the following does is read an HTML warning file See section 7 1 and enclose the supplied message It would be possible to fancy things up a bit function Force Html InitialLogon msg fancy dressing up might go here
53. bx b lt lt 1l st aa gt gt 1 x 1 b lt lt 1 bb tt bb gt gt 1 aax b lt lt 1 1 if s 4 0 amp amp s 2 width 51 gt 0 amp amp height 51 gt 0 var ox 0 oy b w h pxl pxr pxt pxb pxw vhile y 5 0 LE det ox DJ st bbx x lt lt 1 3 5 tt bb lt lt l x else if tt lt 0 st bb x 1 3 aa lt lt 1 x y 1 tt bb lt lt l x x aax y lt lt 1 3 5 W X OX h oy y if w 1 h 281 11 ACTUAL ENTRY OF DATA pxw wtl s amp l h s else if h 1 pxw s h 1 s amp 1 else pxw h s this mkOvQds cx cy x 1l Ox pxw w wod oy h oy hod pxw h OX x oy Y else tt aax yxx1 3 st aa 1 y this mkDiv cx a cy oy s oy lt lt 1 hod this mkDiv cx ta wod s 1 cy oy s oy lt lt 1 hod else var width s 1 lt lt 1 gt gt 1 _b height s 1 lt lt 1 gt gt 1 x 0 pb aa _ax_a lt lt 1 _bb _bx _b lt lt l ast _aa gt gt 1 1 _b lt lt 1 bb tt _bb gt gt 1 _aax _b lt lt 1 1 pxl new Array pxt new Array _pxb new Array px1 0 0 pxt 0 b pxb101 _b 1 while y gt 0 XE 184 D st bbx x lt lt 1 3 tt bb lt lt l x pxl pxl length x pxt pxt length y else if tt lt 0 st
54. dbp hr spo2 etco2 note the order my SIDX 0 my MAXIDX 3 my STIME 0 my LINECOUNT 1 f will skip first line my SSERIESCOUNT 1 f doubled for each new series my RANFILENAME SARGV 0 source filename from command line NO suffix NO path my STIMESTAMP SARGV 1 timestamp DD MM YYYY HH MM my TRUEDURATN ARGVI21 ADDED in v 0 37 my PARAMS SARGV 3 eg debug 3 logprint 0 This is clumsy and a bit nasty Consider submitting the path to the destination directory as an extra command line parameter to the Perl program 16 etco2 2 EZ CAPTURE MANUAL DATA CAPTURE if PARAMS debug Xd SDEBUG 1 D I if PARAMS logprint d SLOGPRINT D I amp OpenLog amp Print wit HERE An Opening file h timestamp TIMESTAMP we 1 21 command line control SLOGPRINT EZDIR SRAWFI ENAME STIMESTAMP start writing to error c WwW 1 sbp then append thes open FILE EZDIR my close FI GINDATA FILE E f print OGFILE n nDebugging A 2 dbp open FILE2 Shdr hdr my GIN2 close FI my EZDIR i lt FILE2 gt lt FILE2 gt E2 print 3 hr n nDebugging B open FILE 3 SEZDIR hdr my
55. exit D I check t don t Sqry S list it du dups readfile duplicate ht exit D I f write t Sqry U W DoSQL ha fetch e SOTHERSURNAME 0 hat new us use UNIQUE doesn t EL AN ps 0 0 PDAT p p EP HE ye person qry candy FetchSurname handDB r nam US D person lt gt OTH GetSQL handDB xist for somebody else constraint as can be null ECT COUNT person pLoginName FROM P RLOGON ERLOGONI Sqry ERSON WHERE E DS get dup logon m he new password ERSON 51 LoginName SUSER Password RE ndDB ET OGON 5 SOTHER update user id password jOGONID SOTHERLOGONID 10 WORKING PHP CODE SOTHERFORENAME FetchForename handDB SOTHERLOGONID print lt lt lt HTML3 lt p gt Log on password have been updated for user SOTHERFORENAME SOTHERSURNAME Log on name is USERLOGON lt p gt lt a href mainpage php Return to main page lt a gt lt p gt lt a href eZ edit logon php gt Edit another logon lt a gt body html HTML3 function XorString strA strB lgth strlen strA if lgth strlen strB return D I Souts while lgth gt 0 lgth 1 SichA Fix
56. fetch key for role Sqry SELECT PERSONROLE rText FROM PERSDATA PERSONROLE WHERE PERSDATA PersonRole PERSONROLE personrole AND PERSDATA persdata Spd list SPersonRole GetSQL ShandDB Sqry fetch role return PersonRole 12 5 CSV processing The variable STOTALLINESREAD is declared as global in SaveCsvLine and in cremented there for each successful line inserted Note that the header array is exploded willy nilly so you re likely to get duff SOL code if the format of this line isn t exactly correct Another good reason not to allow users to submit such CSV files Here s the meaty routine to parse lines and insert them as database TOVVS function SaveCsvLine TABLENAME headarray thisline handDB GLOBAL SDEBUGGING GLOBAL STOTALLINESREAD Scols count headarray if cols 1 print br Column has no length for table TABLENAME return 1 4 fail 12 ANCILLARY CODE 310 D I first fix up format of thisline convert to a temporary backtick We will convert this back to comma later FormatOneltem thisline preg replace NNNN thisline split up the line at each comma Sitemarray explode thisline if count itemarray 1 cols Sc count itemarray print lt br gt lt b gt Error lt b gt Mismatch between column count cols and line thisline c
57. my SNASTYOFFSET 5 use to offset raw datum at NASTYOFFSET we have NBP m followed by ravSBP rawDBP rawHR if d 17 time d x amp Die n Bad timestamp in line lt Sd gt time 51 Sd 52 my target my lv my 1 0 5We might even store the relative time offset but don t bother 2 EZ CAPTURE MANUAL DATA CAPTURE 33 my val my NIBs NIBd NIBm myHR 0 0 NA 0 foreach target VARIABLES Sval d amp PullDatum target d sPrint Ain Datum val leaves lt d gt 1 i target Starget 3 TENSE lt 3 for the first three values E Sv Si S NASTYOFFS if val gt 0 val ycal Sval SBASELINE usually add 20 ex v0 53 type D record T 1 val keep raw copy here pull out values for later mean BP determination if target eq sbp SNIBs val actual value in mmHg elsif target eq dbp SNIBd Sval likewise elsif target eq hr SmyHR val actual BPM use HR in formula 4 nd mean values D I if val 0 val only option for nov vi il val i 4 end foreach HERE OBTAIN THE MEAN BLOOD PRESSURE if NIBs gt 10 amp amp SNIBd gt 10 default NIBm is NA 4 formula DBP coef
58. n Value above upper cal range 2 if SRECORDTYPE ne D amp Store t MAXVALm signal above upper cal else v0 53 special case of type D record inconstant scale range from 160 to 200 is SMAXVALm 8 my over8 SMAXVALm 8 my delta y MAXVALhi if delta gt over8 if over 200mmHg amp Store t MAXVALlmrT2 over8 store as 200mmHg else amp Store t SMAXVALm 2 S delta scale by 2 y Lu ren D I return t 5 2 EZ CAPTURE MANUAL DATA CAPTURE 29 else amp Store St Sy return t 5 The movement between data series e g from SBP to DBP is so important we define the function sub Nex my amp Reca SIDX tSeries t 52 Sy2 t Sz Sy2 _ librate t 52 qur y2 SSTORECOUNT 1 4 for debugging amp Prin t n n n DEBUG transition IDX at line LINECOUNT 2 Here s the subsidiary routine sub Rec alibrate my t z y2 t 52 y2 Q amp Stor amp Stor eZero t z eYCal S t y2 amp Die Repeat zeroing failed z f can happen AXVAL amp Die Repeat Y calibration failed y2 can happen 5 was added by default if amp ISIN z ZERO if amp ISIN y2 Q my tcorr t 5 if tcorr DURATION D I Baseline is WARNINGS Print An WARNIN
59. rel stylesheet head body SMYHEADER lt p gt lt div align center table width 90 border 2 lt tr gt lt td gt lt i gt Assessor lt i gt lt td gt lt td gt lt i gt Number of assessments lt i gt lt td gt lt tr gt HTMLO Sqry SELECT PERSDATA pdSurname COUNT onesession as hits FROM PERSDATA ONESESSION PERSON WHERE ONESESSION Person PERSDATA Person AND PERSDATA Person PERSON person AND PERSON inStudy IS NOT NULL GROUP BY PERSDATA pdSurname ORDER BY hits DESC Sdat SQLManySQL ShandDB qry view counts PrintDetailTable Sdat 2 print table of 2 columns print lt lt lt HTML3 lt table gt lt div gt lt p gt lt a href eZ_view php gt View more lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 10 8 3 An overview of session assessments Here we provide summary information for each ONESESSION entry We order sessions by Person and session id providing case number start end and reported server timestamps and osFinalRank osAutomatic or manual osSeenBefore and osChoice fields We also show the associated comment and via the Anrecord reference the Manual status and SUBJECT sCode header Cache control no cache STHISPAGE view sessions php require once ValidFx php our login validation
60. return year mon mday hour min sec sub DoubleDigit i Si if length i gt 1 return i im return 0 i 4 concatenate my 2 EZ CAPTURE MANUAL DATA CAPTURE 39 2 4 A comprehensive GUI We here describe an Autolt GUI that allows the user to perform all the necessary capture and format translation both from SAFERsleep automated records and from manual caliper data Here s the initialisation code include lt GUIConstants au3 gt include lt WindowsConstants au3 gt Suserd11 DllOpen user32 dll for frequent use of dll FAKEDCMS suppresses activation of DCMS gives time to open Excel and paste data into Excel nasty SFAKEDCMS 0 use numeric seconds for Excel pause SFAKEDCMS 30 if use numeric seconds for Excel pause ER useful constants a Const SONTOP 0x40000 Const SEZ_CASENUMBER 1 Const SEZ CASEDATE 2 Const EZ CASETIME 3 Const SEZ VALIDFLAGS 4 Const EZ ISLISTED 5 Const SEZ CASEEND 6 Const SEZ SURGERY 7 Const SEZ DESCRIPTION 8 Const EZ DURATION 9 Const SEZ MAXLINES 9 77 counts the above constants here request patient ID Smore 1 While more 1 Snad XGetFileAndTimestamp SFILENAME nad EZ_CASENUMBER SFILENAME StringUpper S FILENA
61. return false y return true 10 WORKING PHP CODE 204 function ConfirmClear if confirm Are you sure you want to clear the form Click OK to clear itl return true im return false ar lt script gt lt head gt lt body gt SMYHEADER HTML0 SDEBUGGING 1 print HTML2 lt FORM name eZ persadd ACTION eZ admin personadded php METHOD POST onSubmit return CheckInput this gt lt input type hidden name confirmation value 0 gt lt h3 gt Person s details lt h3 gt lt table width 655675 lt tr gt lt td gt lt td gt lt td gt Forename lt td gt lt td gt lt input type text name forename size 32 onChange ValidForename this 1 gt lt td gt lt tr gt tr td td td Surname td td input type text name surname size 32 onChange ValidSurname this 1 gt lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt Year lt i gt primary anaesthetic qualification lt i gt gained lt td gt lt t lt input type text name startyear size 5 onChange ValidStartYear this 1 gt lt td gt lt tr gt lt tr gt lt td width 5 amp nbsp td td width 14 Gender td td width 81 select name gender size 1 gt lt option selected value 0 gt lt option gt lt option value 1 gt F lt option gt lt option value 2 gt M lt option gt lt sel
62. var b64pad base 64 pad character for strict RFC compliance var chrsz 8 bits per input character 8 ASCII 16 Unicode x These are the functions you ll usually want to call They take string arguments and return either hex or base 64 encoded strings x function hex md5 s return binl2hex core md5 str2binl s s length x chrsz function b64 md5 s return binl2b64 core md5 str2binl s s length x chrsz function str md5 s return binl2str core md5 str2binl s s length x chrsz function hex hmac md5 key data return binl2hex core hmac md5 key data function b64 hmac md5 key data return binl2b64 core hmac md5 key data function str hmac md5 key data return binl2str core hmac md5 key data Perform a simple self test to see if the VM is working x function md5 vm test return hex_md5 abc 900150983cd24fb0436963f7d28e17f72 Calculate the MD5 of an array of little endian words and a bit length x function core md5 x len x append padding x xllen gt gt 5 0x80 lt lt len 32 x len 64 gt gt gt 9 lt lt 4 14 len var a 1732584193 var b 271733879 var c 1732584194 var d 271733878 for var i 0 i x length i 16 var olda a var oldb b var oldc c var oldd d a md5 ff a b c d x i 0 7 680876936 d md5_ff d a b c 114 1 12 389564586
63. write write write lt div gt div id myControls style position absolute top y px left x px width vu px height 4 h px visibility visible background color transparent z index 50 table width w cellpaddinge 0 cellspacinge 0 border 0 gt lt tr gt 5 td width 30 amp nbsp td 7 td width 280 valign top lt div class invisible mymenu ide sectiona lt br gt lt span id labela b Please select your intervention lt b gt lt span gt lt br gt lt input type checkbox name fluid ide fluid onClick gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document write write write write write write write write write write write write write write w
64. 5 cellpadding 4 cellspacinge 4 bgcolor FOF8FF lt tr gt lt td align center a href eZ assess php Assess another case lt a gt lt td gt lt tr gt lt table gt lt p gt STENMSG lt p gt lt a href mainpage php Back to main page lt a gt lt td gt HTML2A print lt td width 2 amp nbsp td print lt td vidth 736 align center gt spiffy graphic follows if SISTEN PieGraph mySE else BarGraph allS IN SmyCORRECT I EN myS EEN print lt lt lt HTML6 lt td gt lt tr gt lt table gt lt body gt lt HTML gt HTML6 xxx THINK ABOUT CAPTURING TIME OF EVERY FF gt gt BUTTON PRESS xxx fix me T function BarGraph allS Snumcols sizeof SallSEEN Simgwidth int 600 Snumcols assumes under about 100 columns if Simgwidth lt 5 EN mySEEN 11 Simgwidth if imgvidth gt Simgwidth SSCALE 7 9 SleftBARh 390 StopNUM 50 Smaxht T 5 115 1 ACTUAL ENTRY OF DATA 5 60 60 r EN numcols 1 if maxht gt 5 SCALE 4 topNUM y Stcols numco print print print print td va td va i while i nu print lt td Simgname Sht Salls 0 88 80 TS 47235 r lign 2 top mco
65. 8 amp OxF return str Convert an array of little endian words to a base 64 string x function binl2b64 binarray var tab ABCDEFGHIJKLMNOPORSTUVWXYZabcdefghijklmnopgrstuvwxyz0123456789 var str for var i 0 i lt binarray length x 4 i 3 var triplet binarrayli m DAA en 64 xFF lt lt 16 binarray i 1 gt gt 2 gt gt 8 x i 1 4 6 OxFF lt lt 8 binarray i 2 gt gt 2 gt gt 8 x 1 2 4 xFF for var j j 4 j 9 PHP ACCESS CODING 192 if i x 8 j 6 gt binarray length x 32 str b64pad else str tab charAt triplet gt gt 6 3 amp 0x3F return str 9 PHP ACCESS CODING 193 9 2 Validate user Note that invocation of ValidFx php implies availability of all the functions in ancillary php The following script contains the function va idate login which should be in voked at the start of all PHP scripts which wish to access eZ This function checks that the current user is actually logged on and if so permits access to the relevant page If the user isn t logged on then a log in screen is popped up Do not confuse this with the initial log on performed by the script InitialLogon php The reason why we need to validate the user for every page is that HTML is stateless we need to identify a particular user by comparing a cookie stored on their machine with a value in the database T
66. AS NumberSeen FROM ON ER BY NumberSeen FROM ONES ES q Person manual You ve completed ANOTH The maroon part of the pie chart is t SUSERKEY 1 AND ON 0 AND ON q E ESSION data includes curren ESSION WH get cases seen SSTARTTIM E o ERE Person GK ES 505 ESSION GROU ERK EXT P BY PERSON HAV get ordered list of all counts ESSION ANRECORD WH hic te appropriate message if 10 cases seen mySE ERE ON ES AND ES ES ESSION osAutomatic See how you do on the next tenl Just 4 more cases until the target of 24 ER 10 cases he proportion of cases where you ve i c ESSION osAutomatic Your bar is the red one ESSION Anrecord get correct matches r The graphic on the right shows how many cases you ve done compared with all other active participants AM 2 lt span class smaller We lt i gt really lt i gt appreciate your contributic 11 ACTUAL ENTRY OF DATA 271 the source manual or automatic SNEXTTEN D I print HTML2A table width 100 tr td width 25 lt h3 gt THANKS lt h3 gt lt p gt The data have been written to the database lt p gt SRIGHTNO E lt p gt lt table vidthe 150 border
67. Details updated User Superuser Data have been updated for Johan van Schalkwyk Name is now Johan van Schalkwyk role specialty and location are superuser Mainly public Back to previous page Return to main page Figure 10 Updated eZ update php We accept personal details from the preceding page and update the database ac cordingly Submitted items are otheruserid newrole newlocation newspecialty newsurname and newforename Each of these values should be valid with a few exceptions e If the new role is not a registrar then newspecialty can and must be null zero e f the new role is neither registrar nor nurse then newlocation can and must be null zero header Cache control no cache THISPAGE ei update php require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Details updated 0 print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC N3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Details updated lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER 10 WORKING PHP CODE 226 HTMLO
68. If IsRawFile sbp ther to tick various acquisition boxes xHR xSpO2 xETCO2 SFILENAME SFIL ENAME 1 Then myC my EndIf If Is myC my EndIf If Is myC heck xSBP 5 BitOR my5 1 RawFile dbp heck SxDBP 5 BitOR my5 SFI 21 I ENAM RawFile hr SFIL ENAME heck SxHR Smy5 BitOR my5 EndIf 1 Then 1 Then If IsRawFile spo2 myCheck xSp02 my5 BitOR my5 EndIf If IsRawFile etco2 myCheck xETCO2 my5 BitOR my5 EndIf return Smy5 ndFunc ri routine to tick Vali tGoodItems GOOD heck vSBP tAND GOODIT heck vSBP iF Func Se myUnc If bi myC EndIf Gl MS k SvDBP D GOODIT k SvDBP myUnc If bi myC EndIf hec CAN hec Gl MS myUncheck vHR ENAM E 1 Then ENA M 1 Then E d ITI box MS D T 1 es five SvSBP based on flags in GOODITI SvDBP vHR S vSpO2 Sv EMS ETCO2 0 Then 0 Then 2 EZ CAPTURE MANUAL DATA CAPTURE 52 If bitAND GOODITEMS 4 0 Then myCheck SvHR EndIf myUncheck vSpO2 If bitAND GOODITEMS 8 0 Then myCheck vSpO2 EndIf myUncheck SvETCO2 If bitAND GOODITEMS 16 Then myCheck vETCO2 EndIf EndF
69. If anything the systolic mark is before the time line Here we have chosen to use common sense making the interpretation that the anaesthetist signalled a recording on the time line so the tiag can be disregarded However note that even if we had accepted this lag time the x axis calibration value would have extended to the same vertical pre printed line as per our rules above We signal data capture as follows SEE USER MANUAL FOR MORE DE TAIL p An initial ZERO must always be present indicating that the Calipers have been zeroed close the calipers so that they read zero or very close to zero e g 0 01 but do not press the ZERO button The initial ZERO is always followed by a measurement in the range of MAX VAL indicating the initial Y axis calibration value 20 200 mmHg Then we enter the X axis time calibration measurement measured as de scribed above Here follow measurements of Systolic BP Each value represents an off set in millimeters from the 20 mmHg or min 1 baseline taken at 5 min intervals The value should never be below MINVAL Special values are discussed below After the last measurement simply stop recording Export to Excel our Autolt script will take you back to the main GUI For the diastolic BP series zero and Y calibrate once more but do not per form the X calibration at any time Just terminate after the last DBP read ing For the heart rate series
70. MUS Sdudtext CHI Error ControlGetText FileWriteLine SERRORL ECK FOR simply close down If WinExists don hen OG Error box t capture E NB SIARPATH SIARFIL ERsleep IAR Viewer ERsleep IAR Viewer arbit Error rror MsgBox SONTOP WinActivate Send ENT S1eep 100 Return 1 A EndIf Sleep 1000 the following seems not to work well rr rr MouseClick left ControlClick Sleep 100 Parse failu SAFERsleep IAR Viewer 560 Error ER rr e 414 Error acknowledge in file batch file mus ENAME amp amp why wn and if appears log the error xml LOG CLASS Static t be defined IAR INSTANCE ENAM F s IARFIL te TAR viewer forced error logged CLASS TcxCustomInnerMemo SXPATH of all of the paths listed below ugh 21 Tea get xt dudte 5 INSTAD 2 EZ CAPTURE MANUAL DATA CAPTURE 60 Send a Sleep 100 Send c Sleep 2000 this delay seems important 7 debug WinWaitClose SAFERsleep IAR Viewer get data from clipboard SXMLDATA ClipGet get xml from clipboard If StringLen XMLDATA lt 1000 Then FileNriteLine ERRORLOG Warning tiny XML file amp SIARFILENAME
71. Stot file While Slastfile 2 1 error I SFA Stot DIM SFA 0 Stot 1 rr rr 1 Sfile FileFindNextFil amp SFIL e S fnam ILENAME SSUFFIX ENAME F amp SUFFIX amp x LOG LOG File not found just playing h hen tot Sfile Stet i ReDim S FA Stot 1 WEnd P FileClose h Run run notepad GuiSetState SW_MINIMIZ Notepad exe F D ExitLoop amp lastfile amp Sfnam for now later select from list Lj SEZPATH 6 Loch QSW MAXIMIZI r Sleep 1000 F ENAME 6 SSUFFIX E WinWaitClose FIL GuiSetState 8SW R ESTOR EndFunc Similar but filename specific is ViewNotepad Func ViewNotepad fnam If Not File SEZ PATH SEZ EZDIR FNAME PATH amp SEZDIR SFNAM Exists fnam amp SUFFIX SSUFFIX E Then MsgBox ONTOP Oops File not found 6 fnam 6 SSUFFIX Return EndIf GuiSetState 6SIV MINIMIZE TARGET FNAME SisXL If SUFFIX csv Then XLpath RegRead HKEY CLASSES ROOTN mhtNOpenWithListMMicrosoft Office E XLpath RegRead HKEY CLASSES ROOTVApplicationsNVEXCEL EXENshellVeditNcommae 2 EZ CAPTURE MANUAL DATA CAPTURE 2 4 2
72. User johanvs Please choose one of the following options Add a person DEMONSTRATION Edit a person Edit log on View delete data Back up and restore data Log out Documentation Figure 4 The main page 10 Working PHP code 10 1 The main page mainpage php header Cache control no cache require once ValidFx php f our login validation script f if invoked by InitialLogon php then IT defined success and set LOGGED IN otherwise if SLOGGED IN success validate login SHOW USER returns SUSERKEY handDB for our use if success exit D I D I SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE STHISPAGE mainpage php list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS eZ Assess amp nbsp Anaesthetics amp nbsp Online 1 print HTML1 DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN html lang en head L1 10 WORKING PHP CODE 198 title eZ Main Page lt title gt lt LINK href css eZstyle css type text css rel stylesheet gt lt head gt lt body gt table vidthe 1005 height 98 gt lt tr gt lt td classe middling align center gt OUTER TBL still no good CSS equivalent 7 gt table class heavybox tr td middle TBL gt SMYHE
73. WG ELE F sCode sDes list SCO NOT AS m 2 if ENDE F 56 1 SGEN DE female else SGEN DE male r if strle SASA n SASA lt 1 unknovn F c ERE subject get subject dete SASA SGEND sSex FROM SUBJ GetSQL handDB ECT WH 54 sASAe ER cription A SASAE 11 ACTUAL ENTRY OF DATA if SASAE 1 SASA E SNOTE ASA SASA gender GENDER NOTE preg_replace Ns SNOTE PATIENTID SCODE MANUAL print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional http www w3 org TR html4 loose dtd html lang en head lt title gt Assess an anaesthetic record lt title gt 265 Javascript chokes on unterminatec lt link type text css rel stylesheet href css eZstyl script src 3s eZ15 3 s type text javascript script script type text javascript t ACTION eZ store php BIGWIDTH 820 BIGHEIGHT 455 LEFTINDENT 10 TOPDOWN 10 OTALIMAGES STOTALIMAGES PATIENTID SPATIENTID IMEOUT 3 minutes until pauses if Interven eZStart TOTALIMAGES PATIENTID SIDEWIDTH LEFTIND
74. X axis time calibrations we do sub StoreZero my 56 z St z _ amp Print n Debug ZERO is z 3 SZEROES St z sub StoreYCal my St y St Sy 8 amp Print An Debug Y cal is y 3 SYCALS t Sy push YCALS Sy f discard t sub StoretCal my 56 x St x _ sPrint An Debug X cal is x n 3 StCAL St x 2 3 3 Tests of calibration We must be able to test Y calibration At the same time based on the Y calibra tion value we determine the type of record and hence set the alpha value We 2 EZ CAPTURE MANUAL DATA CAPTURE 26 also return the MINVAL TestYCal returns three pairs of values corresponding to low and high values for maximum alpha and minimum values for one of three possible anaesthetic forms and the record type added in v0 53 sub TestYCal my 56 c St c _ amp StoreYCal t c my Stiny 1 my SalphaAlo 2 25 0 10 my SalphaAhi 2 25 0 10 my SalphaBlo 4 25 2 Not 10 min Must have 5 min my SalphaBhi 4 45 2 average was 4 352 allow 0 1 Amended 6 1 2009 my SalphaClo 3 11 my SalphaChi 3 31 my SalphaDlo 1 96 0 10 added v0 53 my alphaDhi 1 96 0 10 my minlo tiny t 10 must justify this check me my minhi tiny t 10 if amp ISIN c CALA amp Print An Debug record type is A 1
75. bb x 1 3 aa lt lt 1 x y 1 tt bb lt lt 1 x aa y 1 3 pxl pxl length x pxt pxt length y else tt aax y lt lt 1 3 st aa 1 y L oy 5 03 282 11 ACTUAL ENTRY OF DATA 283 Im et 0 ost 1 43 tt bb 1 _x _pxb _pxb length y 1 else if tt 0 st x 1 3 aa 1 y 1 _tt _bb lt lt 1 _x aa y 1 3 _pxb _pxb length _y 1 else tt 1 3 st Laa ssl y _pxb _pxb length 1 var ox 0 oy b oy _pxb 0 pxl length w h for var i i lt 1 i if typeof _pxb i undefined if _pxb i oy pxt i lt oy x pxllil this mkOvQds cx cy x 1 ox wod oy _oythod x ox oy oy OX x oy pxtlil oy pxblil else x pxl i this mkDiv cx x 1 cy oy 1 oy lt lt 1 hod this mkDiv cx ox wod cy oy 1 oy lt lt 1 hod OX x oy pxt i this mkDiv cx a cy oy 1 oy lt lt 1 hod this mkDiv cx ox wod cy oy 1 oy lt lt 1 hod function mkOvDott left top width height var a width gt gt 1 b height gt gt 1 wod width amp l hod height amp l cx left a toptb x 0 y b 2 ax a lt lt 1 aa4 aa2 lt lt 1 bb bxb 1 11 ACTUAL ENTRY OF DATA st aa2 gt gt 1 x 1 b lt lt
76. center gt 3 lt td gt td align center gt 4 lt td gt td align center gt 5 lt td gt td rowspan 2 amp nbsp amp nbsp excellent amp nbsp amp nbsp amp nbsp amp nbsp td SEES y lt tr gt td align center gt lt input type radio name rankF value 1 id al t td align center gt lt input type radio name rankF value 2 id a2 t td align center gt lt input type radio name rankF value 3 id a3 t td align center gt lt input type radio name rankF value 4 id a4 t td align center gt lt input type radio name rankF value 5 id a5 gt lt t lt tr gt table lt td gt x tr5 As lt tr gt lt td colspan 2 lt b gt In similar circumstances would you be happy for someone close to you to have a similar anaesthetic lt b gt lt td gt lt tr gt y lt tr gt lt td align right width 5 input type radio name fChoice value 1 id lt td width 95 gt no lt td gt lt tr gt lt tr gt lt td align right input type radio name fChoice value 2 id fc9 td lt tr gt lt td colspan 2 gt lt b gt Do you think this record was lt b gt lt td gt lt tr gt lt tr gt lt td align right gt lt input type radio name fRec value 1 id a6 td td lt tr gt lt td align right gt lt input type radio name fRec value 2
77. despite the name bblock in version 0 52 we altered beta blocker to adjust vapouriser 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 7 3 Cascading style sheet Here s eZstyle css eZstyle css my tiny style sheet x 1 Broad brush strokes x body margin left 3 margin right 2 color 00008B font family Garamond serif text align left div margin top Oem Bl hy h3 h4 h5 h6 color 000040 font family sans serif margin bottom 0 margin top 0 3em hr border lpx AAAAAA border style dashed 2 My special classes x nomargin margin left 0px margin right px invisible visibility hidden invisiblevarning visibility hidden color black font size 120 font weight bold shocking color red 152 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 153 prominent border width 5px border style solid border color black heavybox border width 5px border style solid border color 2F1D1D margin top 0px margin right px margin bottom px margin left Opx nymenu font family Helvetica sans serif smaller font family Helvetica sans serif font size 70 table feedback padding top Opx padding right px padding bottom Opx padding left 1px margin top px margin right px margin bottom Opx margin l
78. i 1 f FileOpen fnam 2 rewrite Dim VALS SEZ MAXLINES 1 cumbersome SVALS SEZ_CASENUMBER casenumber SVALS SEZ CASEDATE date SVALS SEZ CASETIME time SVALS SEZ VALIDFLAGS valid SVALS SEZ_ISLISTED listed VALSI EZ CASEEND end SVALS SEZ SURGERY surgery SVALS SEZ DESCRIPTION description SVALS SEZ DURATION duration While i lt SALEN VALS i amp ARRI il FileNriteLine f v Si i 1 Wend FileClose f EndFunc Func ValidTimestamp d t f KiwiJulian d t Sbackdate KiviGregorian Sf if backdate lt gt Sd amp St 00 Then MsgBox SONTOP Debug _ We compared amp Sd amp amp St amp 00 with amp Sbackdate Return 0 EndIf Return f EndFunc 2 EZ CAPTURE MANUAL DATA CAPTURE 68 Func KiwiJulian d t ds StringSplit d dd Sds 1 day mm ds 2 month yy Sds 3 year tt sStringSplit St Mi Shr Stt 1 Smi Stt 2 Sss 0 return Julian yy mm dd hr mi ss EndFunc Func Julian fy fm fd fh fmi fs Sal 367xSfy a2 Int 7 fy Int fm 9 12 4 5 a3 Int 3x Int Sfy Sfm 9 7 100 1 4 a4 Int 275 fm 9 d 1721028 5 Gab fh fmi fs 60 60 24 f al a2 a3 a4 a5 return f EndFunc Given Julian date
79. lt 1 alert Minimum forename length is 1 character might perform other checks return false y return true r function CheckAllInputs myform we will not check the poplists if CheckInputForename myform CheckInputSurname myform clumsy return false Nn return true D I gt lt script gt lt head gt lt body gt SMYHEADER HTMLO 10 WORKING PHP CODE check user ID or fail 225 SOTHERSURNAME FetchSurname handDB OTHERLOGONID SOTHERFORENAME FetchForename handDB SOTHERLOGONID qry SELECT pLoginName FROM PERSON WHERE person SOTHERLOGONID list SOTHERLOGIN GetSQL handDB ary get user login the value in OTHERLOGIN may be null f in the following ve assume only one valid PERSDATA entry ugh qry SELECT PersonRole FROM PERSDATA WHERE Person SOTHERLOGONID list SOTHERROLE GetSQL handDB Sqry get role qry SELECT CurrentSpecialty FROM PERSDATA WHERE Person SOTHERLOGONID list SOTHERSPECIALTY GetSQL handDB ary get role qry SELECT CurrentLocation FROM PERSDATA WHERE Person SOTHERLOGONID list SOTHERLOCATION GetSQL handDB ary g
80. lt select gt return count 12 ANCILLARY CODE 304 12 2 2 TextPoplistSelected This function is similar to PrintPoplist It accepts the key of the selected item which is then flagged as selected function TextPoplistSelected handDB listname query k opt Ss if k lt 1 s selected Sopt opt sprintf lt select name S listname gt lt option s value 0 gt lt option gt n ShandQ mysql_query query ShandDB Scount 0 while Srow mysql fetch array handQ MYSQL NUM mykey Srow 0 Smyvalue ConcatenateArray array slice rov 1 f concatenate remaining elements Ss if k Smykey s selected y Sopt opt sprintf lt option s valuem d 5 sc option Nn mykey myvalue Scount 1 y opt opt sprintf lt select gt return opt 12 2 3 PrintActiveUserlist function PrintActiveUserlist handDB link print lt lt lt HTMLpau lt p gt lt div align center lt table width 90 border 2 lt tr gt lt td gt lt i gt Forename lt i gt lt td gt lt td gt lt i gt Surname lt i gt lt td gt lt td gt lt i gt Role lt i gt lt td gt lt td gt lt i gt Started lt i gt lt td gt lt td gt lt i gt Click here lt i gt lt td gt lt tr gt HTMLpau Sactiveusers array Sqry SELECT distinct Person FROM PERSDATA WHERE PersonRole gt 0
81. my REALNUM SOO 1 my CONSTRING amp GetConnectionString EZDIR CONFILENAME if CONSTRING 17 4 7 amp Die An Connection String must be quoted CONSTRING else SCONSTRING 1 my myODBC ODBC connection my Sdead 0 amp Print n Connection string is lt SCONSTRING gt 2 SmyODBC new Win32 ODBC SCONSTRING or dead 1 if Sdead amp Die Error Win32 ODBC Error im my SOUTTEXT unless myODBC Connection amp Die CRASH Failed to connect Dearie me n 3 RETRIEVE FILES FROM SAFERSLEEP USING PERL y Print myODBC my stmt Anaesthe Anaesthe Anaesthe Patien sPrint N my my if anle anle amp Die y here o my dea open OU if dea amp Di binmode print OU close OU myODBC amp Close 10 Sanswer An Set nnection work ze 500000 DBC co axBufSi SELECT AnaestheticMon 79 ed n 2 set buffer size itorData Data FROM AnaestheticMonitorData Patient Patient WH tic ERE onitorData Anaesthet ticPatient PatientId P EG icId AnaestheticPatient AnaestheticId AND atient PatientId AND NHI SREALNUM n SOL query is lt stmt gt amp SQLFetchDatum my n length ansver n 256 arbitrary mi Error Tiny IAR file pen IAR file wri nd d 0 TFILE d el te a D I
82. pdCreated pdSurname pdForename pdGender VALUES SiPERSDATA SNEWID role CURRENTSPECIALTY CURRENTLOCATION TIMESTAMP now SURNAME SFORENAME gender DoSQL myODBC qry insert person data return NEVID 4 hmm function GetUserDetails handDB similarnames Ssimilarnames is array of IDs this fx is cumbersome and slow 1 returns array of arrays surname role date of 1st qualifn as year 0 Sopt array i 0 foreach similarnames as p Sdetl array Sdet1 0 FetchForename handDB p det1111 FetchSurname handDB p Sdet1 2 FetchRole ShandDB p list det1 3 GetSQL handDB SELECT FirstQualified FROM PERSON WHERE person p GET yr of 1st qualification detl141 p Sopt i detl i 1 im return opt HTML file lostdata htm key of PERSON table each subarray containing forename 1 01 and ID If odd or missing data are submitted to a PHP script which processes POST data the following tiny page will be displayed 10 WORKING PHP CODE 211 lt head gt lt lt body gt lt h2 gt Lost lt p gt The informa title gt Lost data lt title gt lt head gt information lt h2 gt POST data submitted to this form do not contain the expected tion This suggests that you ve randomly accessed this page or inserted really weird text in the previou
83. 14 Hardware software useful files Change Log Hardware Please see our BJA paper 2011 for a brief overview Notes on languages and programs At present SAFERsleep runs under Microsoft Windows and therefore all of our code has been developed in this environment The code might however be mod ified for similar purposes on dissimilar operating systems Autolt is a scripting language designed to compensate for the inadequacies of Windows but Perl is cross platform We assume that the user can interact in a basic fashion with the DOS console under Windows The code runs well under Windows 2000 and Win dows XP This code has not been tested under Windows Vista and it is likely owing to the somewhat paranoid behaviour of this incarnation of Windows that problems will be encountered with this platform At present all files used in this suite of programs can be generated from a single source the file ez XXX tex where XXX is the version number e g 035 for version 0 35 The documentation this document is generated from the same source using HIN To generate the various files use our application Dogwagger version 2 1 or greater In summary our code requires the following software for development All that is needed to interact with the final product is a recent web browser with Javascript and cookies enabled 1 Driving software for the digital calipers STATE DETAILS 2 SaferSleep state version number with server acces
84. 321 13 Licensing Here s the file GPL htm that describes the licensing of the project It can be ac cessed easily from within the PHP pages The GPL follows lt head gt lt title gt Log in to eZ lt title gt LINK href css eZstyle css type text css rel stylesheet lt head gt lt body gt table vidthe 1005 heighte 985 lt tr gt lt td classe middling align center gt lt table class heavybox width 50 gt lt tr gt lt td gt lt div align center gt lt h2 gt About eZ lt h2 gt lt p gt This is version 0 60 lt p gt eZ was created by Darran Lowes and Jo van Schalkwyk in December 2008 The user interface is written in PHP version 5 is good and the database is mySQL lt br gt This program is copyright amp copy J van Schalkwyk 2008 2009 lt p gt The lt a href tex ez 060 tex gt Complete source code lt a gt is made available under the GNU General Public Licence as explained in the lt a href pdf ez 060 pdf gt Documentation lt a gt lt p gt lt a href mainpage php gt RETURN to main page lt a gt lt div gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt lt body gt GNU Public Licence Copyright C 1989 1991 Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document but changing it is not allowed
85. 8x png 6 IMAGE TRANSFORMATION 117 For the time we ve hard coded part of the destination path into the above but ideally should submit it as an argument This assumes that ImageMag ick has been installed A command line DOS example is transping 0061 S0061 m 001 S0061 m 002 820 455 0 25 S0061 m 002 The above assumes that the directory 50067 exits within the directory ez png Do not attempt to further mogrify the image after renaming back to png or binary transparency won t be preserved We also create a tiny batch file called justsnip bat that copies a file to an x file which it then crops but doesn t modify in any other way This is to make the first file the same size as the others It takes similar arguments but the second argument is the destination file name without the terminal x png rem echo off rem cls copy ez png 1 3 png ez ez shw php png 1 2x png mogrify crop 4x 5 6 7 ez ez shw php png 1 2x png Use it as follows justsnip S0061 S0061 m 001 S0061 m 001 820 455 0 25 It would be great to have a preview from within our GUL There is also a prob lem with Internet Explorer versions under version 7 This is because IE doesn t natively support the alpha channel and ImageMagick doesn t seem to support binary transparency One solution is to use MS code as follows lt span style widrh 927px height 52lpx display inline block the height and width should match those of the image
86. A flags 1 1 time person comment We preserve the 7 column structure for compatibility with similar display Wr we need the following tables because SUBJECT contains the identifying sCode thiscase RATING contains the rating values ONESESSION determines which non duplicate sessions are linked to the ratings PERSON lets us determine who the assessor was and that they were in the study ANRECORD lets us identify the manual automated nature of the record Sqry SELECT rImage rAflags 1 1 rTime PERSON person rAcomment FROM RATING ONESESSION PERSON SUBJECT ANRECORD WHERE SUBJECT subject ANRECORD Subject AND ANRECORD anrecord ONESESSION anrecord AND RATING Onesession ONESESSION onesession AND ONESESSION Person PERSON person AND PERSON inStudy IS NOT NULL AND SUBJECT sCode thiscase AND ANRECORD manual 1 AND rlimportance IS NULL AND ONESESSION onesession NOT IN SELECT max onesession FROM ONESESSION PERSON 10 WORKING PHP CODE WHERE AND GROUP BY ONESES HAVING count an ORDER BY rImage SMANA manlen si print HTML3 SOLManySQL handDB zeof MANA ONESES
87. And you must show them these terms so they know their rights We protect your rights with two steps 1 copyright the software and 2 offer you this license which gives you legal permission to copy distribute and or modify the software Also for each author s protection and ours we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on we want its recipients to know that what they have is not the original so that any problems introduced by others will not reflect on the original authors reputations Finally any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses in effect making the program proprietary To prevent this we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for copying distribution and modification follow TERMS AND CONDITIONS FOR COPYING DISTRIBUTION AND MODIFICATION 1 This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The Program below refers to any such program or work and a work based on the Program means either the Program or any derivative work under copyright law that is to s
88. D if 1 valid alert Please answer all questions return false y var fr document getElementByld FinalRank fr value rank store value for PHP script to read var fm document getElementByld FinalManual fm value rec likewise var fs document getElementByld FinalSeenBefore Es valwe b4 ditto var fc document getElementByld FinalChoice fc value choice ditto var ft document getElementByld FinalTime ft value GetTimestamp var fk document getElementByld WebKeyData v0 51 fk value EncodeKeyArray THISIMAGE 1 alert Debug key data are fk value ClearRadiobuttons document myform rankF ClearRadiobuttons document myform fRec ClearRadiobuttons document myform fBefore ClearRadiobuttons document myform fChoice ClearCookieSoon eZ Remember PATIENTID return true allow PHP submis function ClearLayeredImages var i while i lt 10 document getElementById XImage i sre du cbe y function ReviewData sion CLEARIMAGE src 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 138 outpeStringifyData return outp function StringifyData uses globals ALLWEBDATA DATUMCOUNT var outp var i while i lt DATUMCOUNT outp outp ALLWEBDATA i i Ft return outp function HideThanks document getElementBylId thanks1 style visi
89. EndIf SSAVENAME SSAVEPATH amp N amp SCURR I INTFILE HERE WE OVERWRITE THE DEMO DAT FILE Scurrentpath EZPATH dat amp CURRENTFILE amp dat If FileExists currentpath 0 Then sgBox ONTOP Error Source DAT file not found amp currentpath Exit EndIf Sdestpath C Program Files Safer Sleep IDAS Client devicedata DEMO DAT If FileExists destpath 0 Then sgBox ONTOP Error DEMO DAT not found amp destpath Exit EndIf FileCopy currentpath destpath 1 overwrite might check for success START NEW ANAESTHETIC SetConstantTime set timestamp to 30 4 2008 12 00 00 If STESTNOSERVER 0 Then RunSaferSleep TESTNOSERVER 352 620 ugh Else RunSaferSleep TESTNOSERVER 352 570 pi sigh EndIf MsgBox ONTOP Debug New Anaesthetic waiting 5 Sleep 1000 If WinExists Start New Anaesthetic 0 Then Send ENTER MsgBox ONTOP HMM Try again Click OK to start new anaesthetic Else MsgBox ONTOP Seems ok The menu exists EndIf WinWaitActive Start New Anaesthetic Send SFAKENHI Sleep 500 Send ENTER enter fake patient details MsgBox ONTOP Debug Enter fake details
90. Finished source trim Number of files copied was amp COUNT Exit E Ej rr mv 7 FUNCTIONS 6 IMAGE TRANSFORMATION Func TrimFile MYFILE DESTF now trim write to destination SIMGCMD convert 6 MYFILE 6 crop 846x510 10 102 6 MsgBox ONTOP Debug Command is amp SIMGCMD dosok RunWait ComSpec amp c 6 SIMGCMD Q0SW HIDE if dosok lt gt 0 Then Return Conversion failed amp SIMGCMD Clumsy error EndIf Return 0 7 success EndFunc 124 DESTF 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 125 7 ez shw An interactive web based application Here we provide stand alone HTML code that demonstrates the core functionality of our web application Note that the actual HTML used in our project is written dynamically by our PHP code but is very similar to the following code which is intended mainly for demonstration and debugging purposes This application sequentially displays PNG files within a web page that allows the anaesthetist viewing the page to scroll through the record in faster than real time and annotate the record where they believe they would have intervened A record is kept of the viewing anaesthetist s progress and these data are written to an SQL database for later analysis 7 1 HTML code Here we describe the pages used in displaying the
91. Gl I print HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt html lang en head title View rating details lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER lt p gt lt div align center table width 90 border 2 tr td i Assessor ID i td td i Case Number lt i gt lt td gt lt td gt lt i gt Manual lt i gt lt td gt lt td gt lt i gt Subject code lt i gt lt td gt lt td gt lt i gt Image lt i gt lt td gt lt td gt lt i gt Timestamp lt i gt lt td gt lt td gt lt i gt I flags lt i gt lt td gt lt lt lt lt td gt lt i gt A flags lt i gt lt td gt td gt lt i gt Importance lt i gt lt td gt td gt lt i gt I comment lt i gt lt td gt td gt lt i gt A comment lt i gt lt td gt lt tr gt HTMLO Sqry SELECT ONESESSION Person osCaseNumber ANRECORD Manual SUBJECT sCode RATING rImage RATING rTime RATING rIflags RATING rAflags RATING rlimportance FROM ONESESSION ANRECORD SUBJECT RATING PERSON WHERE RATING Onesession ONESESSION onesession AND ONESESSION Anrecord ANRECORD anre ANRECORD Subject SUBJECT subject AND ONESESSION Person PERSON person AND PERSON inStudy IS NOT NULL ORDER BY ONESESSION Person ONESESSION onesession RATING rating
92. GuiSetState display the GUI While 1 Dim msg GuiGetMsg If SFIVEITEMS 31 Then if all 5 acquired myEnable mCSV ugh EndIf Select START GIANT SELECT STATEMENT Case msg bQuit GUIDelete mygui Return 0 0 quit Case msg SbNew GUIDelete mygui Return 1 1 resume Case msg bSBP Soverw 1 If IsRawFile sbp SFILENAME 1 Then Soverw MsgBox SONTOP 1 Warning _ Raw SBP data already captured Overwrite If Soverw 1 Then cancel 2 create single backup 2 EZ CAPTURE MANUAL DATA CAPTURE 45 fnm SEZPATH amp rawdataN FILENAME amp sbp csv FileCopy fnm fnm amp BAK 1 overwrite if exists EndIf EndIf If overv 1 Then GuiSetState G8 SW MINIMIZE GetSequence sbp FILENAME DATETIME FAKEDCMS myCheck xSBP SFIVEITEMS BitOR SFIVEITEMS 1 say data GuiSetState SW_RESTORE EndIf Case msg bDBP overw 1 If IsRauFile dbp FILENAME 1 Then Soverw MsgBox ONTOP 1 Warning Raw DBP data already captured Ov acquired rwrite If Soverw 1 Then cancel 2 create single backup fnm SEZPATH amp rawdataN FILENAME amp dbp csv FileCopy fnm fnm amp BAK 1 overwrite if exists EndIf
93. HTML uses some javascript we must create the s subdirectory of eZ on anaesthetist com and place the md5 js script there Ulti mately we may wish to insert one or more pretty images that we ll then need to upload into the eZ images directory so we might as well make this directory now Note that if the javascript include isn t found you failed to upload it then the script will silently fail to perform correctly header Cache control no cache require once eZ GLOBALS php require once CONNECTIONPATH require ancillary php GLOBAL ShandDB ShandDB eZ_database_connect if 1 handDB mysql close handDB print An Failed to connect to database 4 ugh readfil rescue htm return 0 D I seed pseudorandom number generator Smt microtime if preg match 0 x mt matches Smt time ugh else mt Smatches 1 srand mt 9 PHP ACCESS CODING 178 find a free row to use SK SALTSIZE number of salt rows global STIMEOUT SALTTIMEOUT global constant Squiet 20 attempts while quiet gt 0 J rand 4 hmm SI U SK index into salt table Snow time 4 UNIX time Sqry SELECT sTime sValue FROM SALT WHERE salt I list SSTIME SVAL GetSQL handDB qry get salt if st
94. HTMLO OTHERLOGONID POST otheruserid SMYPSWD POST mypswd USERLOGON POST userlogon SNEWPWD1 5 POST newpasswordl CheckCode SOTHERLOGONID Error in logon or fail Sanitise MYPSUD Sanitise USERLOGON Sanitise SNEWPWD1 first check mypswd this is md5 md5 plaintextpvd 10 WORKING PHP CODE Sqry s list MD5 1f strle MD5 D I if MYPS pri EI PWD n PWD nt WD d pri nt ECT pPassword FROM PERSON WH GetSQL handDB print lt p gt Debug my md5 pwd is MD5PUD SMD5PWD md5 SMD5PWD md5 MD5PWD lt p gt Debug lt 30 md5 SMD5PWD lt p gt Debug Hack 218 ERE get USERK pwd person encr ac r Sqry hack for star tup bare password now SMD5PWD double md5 DEBUG this md5 is d readfile badpassword htm exit y SNEWPWD1 print if O user is US print lt p gt Debug doublemd5 is xor of new password md5 is SNEW ERLOGON with id SOTHERLOGONID db md5 pwd is SMD5PWD xor extract gave lt 31 YPSWD PWD1 extract new password using xor XorString MD5PWD lt p gt Debug strlen SNEWPWD1 SNEWPWD1 SNEWPWD1 readfile badpassvord htm
95. Mismatched conversion count for amp FILESTEM amp 6 Fr 6 IMAGE TRANSFORMATION ReDim S FDAT If SEDAT O Dim FDAT SFDAT 0 SFDAT 3 EndIf Return FDAT EndFunc 1 Pr Then 2 1 0 failed 0 no skipper 4 lt 4 6 3 Trimmed final images ensure 4 values fwiw 121 We also create an Autolt program to walk through all SO subdirectories of the png directory and pull out the highest numbered images These are trimmed and written to the subdirectory eZ ez shw php png finalimages Note that this silent background utility is only available from the command line Autolt Version 3 0 Program to vork through the ez png directory trim the image last file from each directory ez png finalimages pull out the numerically and vrite it to amp SSRCPATH Const SONTOP 0x40000 r EZPATH ez SSRCPATH SEZPATH amp png SDESTPATH SEZPATH ez shwNphpNpngNfinalimages V ShDIR FileFindFirstFile SRCPATH amp Sx Check if the search was successful If ShDIR 1 Then SgBox SONTOP Error No directories found in Exit EndIf jj BIG LOOP SCOUNT 0 While 1 SMYDIR FileFindNextFil If error Then ExitLoop process directory ShDIR rr Sr NriteTopFile SRCPATH MYDIR If r lt gt 0 Then Scont MsgBox SONTOP 1 Error If cont 2 Th
96. SEXITCODE 128 n Se nl exit SEX cautio ITCODE n SEE die VN sub Print my p Sp TL if D I sub OpenLog Sislog SEZDIR SFI Sislog SEZDIR SFI return amp GetLocalTime le SEZDIR my XE 1 my logf O none Slevel _ SDEBUG gt SLOGPRINT print LOGFIL Sis my STODAY i n Fatal eve Lrz x Exit code 4 http perl level fatal 128 0 Log Slevel l overvi W 2 detail is debugging level 3 picky if level return print p LOGFILE gt logfile print in Writing to log file E Sp f console print ENAME log SFILENAME iar TODAY LOG ENAME _ not logging if is alvays printl f clumsy ldoc perl org functions exit html or die CRASH Could not open LOG logfile Slogfile Ann 3 RETRIEVE FILES FROM SAFERSLEEP USING PERL 8l sub CloseLog my islog islog if Sislog close LOGFILE y _ sub GetLocalTime my sec min Shour Smday mon year Swday yday isdst sec min hour mday mon year Swday yday isdst CORE localtime time Syear 1900 fix y2k sec amp DoubleDigit sec min amp DoubleDigit m
97. SHDR An ColumnData we have the minimum possible key keymin but the actual minimum might be larger so check this Skeyname gt keymin st km GetSQL handDB qry get actual min strlen km gt 0 keymin km get the very first row so we can get field attribs Sqry SELECT x FROM tname WHERE keyname keymin SRSLT mysql query qry SFLDS mysql num fields RSLT 3 0 SHDR SFLDS print n Debug Number of fields is FLDS FLDLIST while j SFLDS f for each field Sfnam mysql_field_name RSLT j Sftype mysql field type RSLT 3 if preg_match PASSWORD i Sfnam no password 10 WORKING PHP CODE 237 SHDR fnam ftype SFLDLIST fnam 7 j t 1 SFLDLIST rtrim FLDLIST trim terminal comma if mysql fetch array RSLT f if any rows print HDR print header next get and print all data Sqry SELECT FLDLIST FROM tname WHERE keyname gt keymin print n S debug sql qry ALLDATA SQLManySQL handDB qry get all table data foreach ALLDATA as DROV f print Ant new row foreach DROW as DI replace CR within data with An SDI str_replace n An SDI replace comma with Y SDI stf replace NX SDT print SSDI
98. SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Your progress so far 0 print HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt html lang en lt head gt lt title gt Review of demonstration file lt title gt LINK href css eZstyle css type text css rel stylesheet lt script type text javascript src js wz jsgraphics js script script type text javascript src js pie3 js script Pie Graph script By Balamurugan S http www sbmkpm com Script featured available at Dynamic Drive code http www dynamicdrive con lt head gt lt body gt SMYHEADER HTMLO 11 ACTUAL ENTRY OF DATA 269 SWHOLESTRING POST WebDataString SPATIENTID _POST Patientld SSTARTTIME 5 POST StartTime SFINALRANK POST FinalRank SMANUALORAUTOMATIC POST FinalManual SEENBEFORE POST FinalSeenBefore SCHOICE POST FinalChoice SFINALTI POST FinalTime SFINALCOMMENT POST fComment SWEBKEYDATA POST WebKeyData E Sanitise CHOICE Sanitise FINALTIME Sanitise FINALCOMMENT can t yet sanitise WHOLESTRING as contai
99. Sky INTO SUBJECT subject scode sDescription sOperation sASA sASAE Sky SSCODE SDESCRIPTION OPERATION ASA ASAE SGENDER DoSQL ShandDB q insert new subject next create _two_ ANRECORD ENTRIES Sanky FetchKey handDB Anrecord f new key for Anaesthetic record if DEBUGGING TR 11 ACTUAL ENTRY OF DATA 300 print lt br gt Debug ANRECORD key is anky y Sq INSERT INTO ANRECORD anrecord Manual Subject Images VALUES anky 1 Sky SIMAGES DoSQL ShandDB q insert new anaesthetic record manual Sanky FetchKey handDB Anrecord new key for Anaesthetic record 1f SDEBUGGING print lt br gt Debug ANRECORD key 2 is anky D I Sq INSERT INTO ANRECORD anrecord Manual Subject Images VALUES Sanky 0 Sky IMAGES DoSQL ShandDB q insert new anaesthetic record automatic psex female if SGENDER 2 Spsex male y Spasa ASA if ASAE 1 pasa E print HTML2A p New subject anaesthetic records added lt p gt SCODE has been added to the database lt p gt Gender psex lt p gt Age SAGE amp nbsp years lt p gt ASA Spasa p Description SDESCRIPTION lt p gt Operation S OPERATION lt p gt Number of images SIMAG HTML2A T Gl ca print
100. Sy 3 Spitch Sx Sskip 3x pitch Sx 2x skip Sy 3x pitch SX x p 9X x 3 15 Sskip the patient s co morbidities Syt Spitch Sw Sw h h Sw Sh w h Sy S Spitch wx 5 h Sy 7xSpitch wx5 Sy 9xSpitch green button Sw h rr ICtrlCreatePic pathtoimagegoeshere gif 408 308 Sy 9 pitch red button r r HH MM h Sw h end t 2 EZ CAPTURE MANUAL DATA CAPTURE GuiSetState dis While 1 Dim msg r GuiGe If msg caselD play the GUI tMsg Then ENUMB ER GUICtrl SFAT SEZ CAS here migh If FileExists e oLirst SFAT Sil next writ SFAT O UICtrlSe UICtrlSe UICtrlSe UICtrlSe GUICtrlSet Sislisted Svalidflags EndIf EndIf EndIf rr If G G G G If msg SbQuit T Exit EndIf If msg buttonlI H amp ez in all values from EZPATH amp ez in lues to contr hen EZPA T Read caseID pre check validity of casenumber befor F 63 il Exists fo 6 SFAT S P Z CAS P NUMB file fo amp SFA Z_CAS P NUMB ols ta SmyDATE SE AT SEZ CASE I ta SmyTIME SE A ta SmyEND SEA SEZ_CASE SEZ_CASEE E SmySURGERY ta myDESCRIP SFAT SEZ_S RY
101. Table 3 Database table relationships 8 10 Database structure Table 3 provides a simple overview of the table relationships in our database An arrow from table A to table B indicates that table A references table B Major tables are shown as blocks 8 DATABASE DEFINITION 169 8 11 Testing the database We tested the database in two phases Testing on a DOS machine We first run Dogwagger 2 1 to generate the SQL code in the file eZ sql in the directory ez shw sql We create a database called eZ in a convenient SQL for example the old freeware Ocelot SQL and then submit the code manually gt Internet testing In our testing it s wise to consider everything but in particular file names and directory paths to be case sensitive We create a database in mySQL and upload a PHP script that submits our eZ sq file as follows We log onto anaesthetist com using FTP commander and in the public_html folder make a directory called eZ as well as a subdirectory of eZ called sql We then upload the file eZ sq from our local PC directory ez ez shw sql to the sql directory and the PHP script database create php described in Section 8 12 to the eZ directory Before we run the PHP script we log on to anaesthetist com using CPANEL and create the database anaes2_eZ from within the mySQL database section Af ter creating the database we add the system administrator with all privileges We manually insert the administrator and passwor
102. USER STATUS OLDPAGE Suserstring matches print lt br gt Error Bad user data Terminated String vas amp lt S userstring amp gt exit array_shift Smatches remove first element which is the whole match return Smatches 12 4 2 GetLinkedUserDetails The following is like GetUserDetails from eZ_admin_personadded php but the added parameter link is something along the lines of lt a href eZ_do_editlogon php editlogon USERID gt Go lt a gt A required component is the text string USERID replaced with the relevant key contained in the list link The URL represents a GET not POST to the page specified e g eZ_do_editlogon 12 ANCILLARY CODE 308 function GetLinkedUserDetails handDB unames link Sunames is array of IDs key of PERSON table this fx is cumbersome and slow returns array of arrays each subarray containing forename surname role date started practice as year 01 01 and link URL contains ID Sopt array i foreach unames Sp detl Sdet1 0 FetchForename handDB p Sdetl 1 FetchSurname handDB p det1 2 FetchRole handDB p list det1 3 GetSQL handDB SELECT FirstQualified FROM PERSON WHERE person p Sdet1 4 link year of 152 qualification use str_replace rather than regex Sd
103. YBOTTO L w XINDENT px Note that in the above coding multiple intervention flags for one intervention mean that a box of equal size is created for each intervention flag 10 8 7 Javascript for analysis Here s the associated javascript file analysis js Javascript to service the display of anaesthetic records in eZ initialisation section IMAGEW 820 IMAGEH 455 24We can argue about the wisdom of this 10 WORKING PHP CODE fu fu XINDENT 150 245 XLEFT 74 unused margin on left of image before 0 00 XRIGHT 44 space on right YBOTTOM 77 move plotting to above x axis of image YTOP 10 unused space at top of image ISCALE 0 750 1 000 scaling factor for image height VSEPARATION 10 vertical separation between two curves px TOPGAP 10 space at top what do the rIflags mean ixa document myform fluid checked dark blue ixb 2 xdocument myform analgesia checked blue light ixc 4 xdocument myform vasocons checked black ixd 8 xdocument myform inotrope checked purple ixe 16 xdocument myform bblock checked adjust vapouriser yellow or cyan or purple ixf 32 xdocument myform incvent checked orange ixg 64 document myform decrvent checked brown ixh 128xdocument myform upfio2 checked white black border ixi 256xdocument myform iother checked red the following is global COLOURS new Array 330099 33CCFF
104. ascending chole WriteForm ACTION PATIENTID TIMESTAMP this writes MYSTARTTIME SIDEHEIGHT BIGHEIGHT 25 INNERWIDTH 750 INNERHEIGHT 350 T XINNERMARGIN parseInt BIGWIDTH INNERWIDTH 2 YINNERMARGIN parseInt BIGWIDTH INNERWIDTH 2 E CNORMX LEFTINDENT SIDEWIDTH XINNERMARGIN two CNORMY TOPDOWN YINNERMARGIN important globals WriteBottomNote CASENO NOTE LEFTINDENT OPDOWN SIDEHEIGHT BIGWIDTH SIDEWIDTH WriteSidepanel LEFTINDENT OPDOWN SIDEWIDTH SIDEHEIGHT WriteDisplaypanel LEFTINDENT SIDEWIDTH TOPDOWN BIGWIDTH BIGHEIGHT WriteControlpanel CNORMX CNORMY INNERWIDTH INNERHEIGHT WriteFinalReport LEFTINDENT SIDEWIDTH 5 TOPDOWN 5 BIGWIDTH 2 BIGHEIGHT 10 EndForm gt lt script gt lt head gt lt html gt Initially we used a translucent image white png behind the control panel We made a grey PNG CCCCCC fill and then in ImageMagick said mogrify alpha on white png mogrify alpha copy vhite png mogrify modulate 130 white png We thus turned on the alpha channel copied the grey colour to the alpha chan nel and then lightened things because of the mucky colourspace of IE Note that without trickery this image will display as opaque in versions of Internet E
105. c md5 ff c d a b x i 2 17 606105819 b md5 ff b c d a x it 3 22 1044525330 a md5 ff a b c d x i 4 7 176418897 d ma ftfid a b c xli 5 12 1200080426 c md5 ff c d a b x i 6 17 1473231341 b mds ff b c d a x it 71 22 45705983 a md5 ff a b c d x i 8 7 1770035416 d md5 ff d a b c 114 9 12 1958414417 PHP ACCESS CODING 189 c md5 ff c d a b x i 10 17 42063 b md5 ff b c d a x i 11 22 1990404162 a md5 ff a b c d x i 12 7 804603682 d md5 ff d a b c x Ir 13 12 40341101 c md5 ff c d a b x i 14 17 1502002290 b md5_ff b c d a x i 15 22 1236535329 a md5 gg a b c d x i 1 5 165796510 d md5 gg d a b c x i 6 9 1069501632 c md5 gg c d a b x i 11 4 643717713 b md5_gg b c d a X i 0 20 373897302 a md5 gg a b c d x i 5 5 701558691 d md5 gg d a b c x i 10 9 38016083 md5 gg c d a b x i 15 14 660478335 b md5_gg b c d a X i 4 20 405537848 a md5 gg a b c d x i 9 5 568446438 d md5 gg d a b c x i 14 9 1019803690 c md5 gg c d a b x i 3 14 187363961 b md5_gg b c d a x i 8 20 1163531501 a md5 gg a b c d x i 13 5 1444681467 d md5 gg d a b c
106. class marginal lt p gt We believe we ve mad Z pretty intuitive If you disagree once you ve used tI However here are a few Frequently Asked Questions ul lt li gt lt i gt How do I get a username and password lt i gt lt br gt If you re an ADHB anaesthetis limited to anaesthetists at ADHB p li i Why do I sometimes get asked to try again when I log in lt i gt lt br gt If you wal Screen your ticket expires and you need a new one Just press reload in your Otherwise it s possible but unlikely that our server is too busy If you have recurrent problems give me a call p lt li gt lt i gt It takes ages to load Why lt i gt lt br gt Generally an anaesthetic should load y Only if you re on a very low bandwidth connection will you experience pronounced c we can to limit the bandwidth of these graphic intensive pages Typically ten sq 30K if you re interested in such things lt p gt li i I m having trouble viewing the pages Why lt i gt lt br gt We ve tested and tuned t Because IE7 is badly written occasional users may have problems with this browser little issues running other web applications and may wish to consider obtaining feel we ve screwed up let us know p li i Why does the program whinge about a screen resolution or b cookies i The program tests for cookies and examines the screen resolution and will warn y potenti
107. details 0 print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC N3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Edit details lt title gt LINK href css eZstyle css type text css rel stylesheet lt head gt lt body gt SMYHEADER lt p gt lt a href mainpage php Return to main page lt a gt lt h3 gt Select a user sorted by surname lt h3 gt HTML1 link lt a href eZ_do_edit php editperson USERID gt Go lt a gt PrintActiveUserlist handDB link print lt lt lt HTML3 lt table gt lt div gt 10 WORKING PHP CODE 221 lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 Edit details User Superuser Return to main page Alter details for Johan van Schalkwyk Login name is johanvs By default all values are left at their current settings a Alter sumame van Schalkwyk b Alter forename onn Change role superuser Change location Mainly public y only for nurse registrar Change specialty 4 registrar only Yeat of qualification 1994 Gol Back to list of people Return to main page Figure 9 Editing a person s details eZ do edit php The following PHP script is deceptively short because it uses GET and then sim ply invokes a much more complex script
108. distinct sCode FROM SUBJECT ANRECORD ONESESSION PERSON WHERE q ONESESSION Person PERSON person AND ONESESSION Anrecord ANRECORD anrecord ANI A NRECORD Subject SUBJECT subject AND RSON instudy IS NOT NULL ORDER BY sCode P cases Flatten SQLManySQL ShandDB Sqry get cases caselist rtrim ConcatenateArray cases remove terminal space gry SELECT person FROM PERSON WHERE PERSON instudy IS NOT NULL ORDER BY persor Sassessors Flatten SQLManySQL ShandDB qry get assessors Sasslist rtrim ConcatenateArray assessors f now create links supplying all 4 parameters starting with print ol Sasscount sizeof assessors i while 51 lt Sasscount link lt a href showl php case 0 amp assessor i amp CASES caselist amp ASSESSORS ass print li link li we use zero indexing i y print lt 01 gt later have similar link lt a href showcase php case i amp assessor l1 amp CASES caselist amp ASSESSORS as print lt lt lt HTML3 lt table gt lt div gt lt p gt lt a href mainpage php Return to main page lt a gt body html 10 WORKING PHP CODE 249 HTML3 10 8 9 PHP analysis page one assessor This page is show php We obtain the information for the first case assessed by a given
109. div align center gt lt h2 gt eZ log in to lt i gt live lt i gt database lt h2 gt lt img src images eZmediumlogo png alt Logo for this graphic intensive program si lt p gt lt FORM name initiallogon ACTION InitialLogon php METHOD POST onSubmit return SubmitLogon this gt lt input type hidden name salt value SSALT gt lt table gt lt tr gt lt td gt User Name lt td gt lt td colspan 2 gt lt input type text name username size 16 gt lt td gt lt tr gt lt tr gt lt td gt Password lt td gt lt td gt lt input type password name pswd size 16 gt lt td gt lt td gt lt input type submit name submit value Log in gt lt td gt lt tr gt lt table gt lt form gt lt div gt lt td gt lt tr gt lt table gt lt body gt lt html gt HTMLO Formerly we used login htm which is now largely just a redirection stub how ever the advantage of still providing this page to users as the initial logon is that it confirms that Javascript is enabled without which eZ won t work Here s the file lt head gt lt title gt Log in to eZ redirection lt title gt lt script type text javascript 2 vindov location replace login php ff script lt HEAD gt lt BODY gt lt h2 gt Loading eZ lt h2 gt lt p gt If nothing happens in a few seconds click lt a href http www anaesthetist com eZ login php gt her
110. float make Gregorian date time Func KiwiGregorian jd SEPSILON 0 00001 jd SEPSILON 2 Floor jd 1721118 5 SR jd 1721118 5 2 SG 52 0 25 A Floor G 36524 25 SB A Floor A 4 year Floor B G 365 25 C SB Z Floor 365 25 x year month int 5 x SC 456 153 day Int C int 153 month 457 5 SR If month 5 12 Then Syear year 1 month month 12 EndIf next HH MM SS gd 0 5 jd Int jd If gd gt 1 Then Julian starts at midday gd gd 1 EndIf 2 EZ CAPTURE MANUAL DATA CAPTURE 69 gh gd 7 Clumsy gh gh 24 gmi gh Sgh Int gh gmi gmi gh gmi gmi x 60 gs Bomi gmi Int gmi gs Sgs gmi gs Int gs x 60 return DoubleDigit day amp _ s DoubleDigit month amp 6 year amp _ amp DoubleDigit gh amp _ amp DoubleDigit gmi amp _ amp DoubleDigit gs EndFunc trivial function to turn 1 digit into two Func DoubleDigit d If StringLen d 2 Then d 0 amp d EndIf Return d EndFunc 2 5 1 DOS invocation of ez GUI We simply type in run from within the ez directory echo off cls Vezlez capturlez gui au3 Invoking the anaesthetic viewer We do so using a DOS batch file xlat bat stored in the ez ez xlate directory echo off cls Ana
111. gh amp DoubleDigit gmi sDoubleDigit int gs i sub DoubleDigit my i i if length i gt 1 return i y return O i concatenate Here s the rule processing routine A rule is in the format 100 4 FORMAT TRANSLATION EZ XLATE 101 D 0 1 1Sp02 1 D x where z is an integer greater than zero Even the following is possible q ISD 0 I NBP ISD 1 SDI2 D 3 1 Given a string along the lines of D 0 SpoO2 Spo2 We turn it into a rule by identifying all items in curly braces and replacing each by the relevant D x reference If a column reference isn t found we Die sub PrepareRule my dr COLLOOKUP dr SCOLLOOKUP my ismore 1 my pre Sv Spost while ismore if dr x N 4 N x pre v Spost 1 2 3 if exists COLLOOKUP v amp Print Fatal Column Sv not found 0 amp Die Column v not foudn 8 Sv COLLOOKUP v Sv is numeric Sdr pre SD Sv 1 post else Sismore 0 y y dr s N g replace all quotes with pipes my Sr q dr Print An Debug prepared rule is lt r gt 3 return r And next the template filling routine that uses a rule We handle a rule by 1 Evaluating it so that each D x value is substituted with a real value 2 Scanning it for NA if this is p
112. handDB nd TIMESTAMP ted IME Rank S MAN osStart 270 IM SFINAL 58 AME SFINALRANK UALO IME RA ESTAMP EPORTTI UTOMATIC SSE ENB EFO RE SCHOICE COMM EN SFINA SW 54 EBKEYDA sessio finalise SI TA piar A lit tle overviev get number seen by this person Sq SEL list SmySE EC EN COUN q en SELEC COUNT SallSEEN F COUN onesession f will la STENMSG i STHANKS SRIGHTNOTE T I f genera SISTEN if SISTEN Every 10 records we ll let you know the number you correctly dentified as being manually or automatically captured hank you 9 10 54 P LECT count x A list Smy SANOTHER SNEXTTEN if myS SAN ND ONES AN OR AN CORRECT rro ESSION RECORD RECORD I EN gt 10 OTHER another SNE XTTEN y STENMSG STHANKS SRIGHTNO Well done TE I onesession GetSQL ShandDB onesession 80 ORD latten SQLManySQL handDB ter use these data to create a spiffy grap ES manual GetSQL handDB FP FROM ON q
113. header Cache control no cache require once ValidFx php f our login validation script success validate login SHOW USER here GET user ID SOTHERLOGONID GET editperson CheckCode OTHERLOGONID Bad log on ID 4 or fail require subedit php subedit php Here s the much more complicated subedit php The reason for the above shenani gans is to allow us to POST data from within eZ do edit php to the POST version which can then invoke itself Why not simply use POST always It s easier in some circumstances to submit the user ID using GET 10 WORKING PHP CODE 222 SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Edit details 0 print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC N3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Edit lt title gt LINK href css eZstyle css type text css rel stylesh script type text javascript o E function CheckInputSurname myform valu myform newsurname value if valu length lt 2 alert Minimum surname length is 2 characters might perform other checks return false y return true function CheckInputForename myform valu myform newforename valu if valu length
114. i 13 21 1309151649 a md5 ii a b c d x i 4 6 145523070 d 1845 131 4 a b c 144111 l0 1120210379 7 md5_ii c d a b x i 2 15 718787259 b md5_ii b c d a x i 9 21 343485551 a safe add a olda b safe add b oldb c safe add c oldc 9 PHP ACCESS CODING 190 d safe add d oldd return Array a b c d x x These functions implement the four basic operations the algorithm uses function md5_cmn q a b x s t return safe add bit rol safe add safe add a q safe add x t s b function md5_ff a b c d x s t return md5_cmn b 6 c Cb s d a b x s t function md5 gg a b c d x s t return md5 cmn b amp d c 6 7d a b x s t function md5 hh a b c d x s t return md5 cmn b c d a b x s t function md5 ii b d X 5 t return md5 cmn c b d a b x s t x Calculate the HMAC MD5 of a key and some data x function core hmac md5 key data var bkey str2binl key if bkey length gt 16 bkey core md5 bkey key length x chrsz var ipad Array 16 opad Array 16 for var 1 i 16 i ipad i bkeylil 0x36363636 opad i bkeylil 0x5C5C5C5C var hash core_md5 ipad concat str2binl data 512 data length chrsz return core_md5 opad concat hash 512 128 x Add integers vrapping at
115. ichA Fixch strA charCodeAt lgth ichB Fixch strB charCodeAt lgth ichA ichB ichA Unfix ichA outs String fromCharCode ichA outs here might confirm length of outs 1gth return outs function Fixch c convert hex digit to hex value 10 WORKING PHP CODE 215 SE e e 90 c 32 force upper case 48 0x30 if 6 gt 9 return actual hex value function Unfix c convert hex value to hex digit if c gt 9 c 7432 force LOWER case md5 rule c 48 return c function NastyString pwd if pwd indexof gt 1 quadruplicate PHP Javascript return true if pwd indexOf gt 1 return true if pwd indexOf gt 1 return true if pwd indexOf gt 1 return true return false gt lt script gt lt head gt lt body gt SMYHEADER HTMLO here GET user ID or fail OTHERLOGONID GET editlogon CheckCode OTHERLOGONID Bad log on f or fail hmm We might check that the user is entitled to log on f privileges For nov accept all I SOTHERSURNAME FetchSurname handDB SOTHERLOGONID OTHERFORENAME FetchForename handDB SOTHERLOGONID 10 WORKING PHP CODE 216 qry SELECT pLoginName FROM PERSON WHERE person SOTHERLOGONI
116. id a7 td td lt tr gt td colspan 2 lt b gt Do you think you have ever encountered this record before lt b gt td tr lt tr gt lt td align right gt lt input type radio name fBefore value 1 id a8 td lt tr gt lt td align right gt lt input type radio name fBefore value 2 id a9 td lt tr gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 147 document write lt td colspan 2 gt document write Any final comment lt input type text name fComment size 80 gt document vrite lt td gt document write lt tr gt document write lt tr gt document vrite td colspan 2 align right gt document vrite lt input type submit style width 80px ide submitbutton value Submit amp nbsp document vrite lt td gt document write lt tr gt document vrite lt table gt document vrite lt div gt GRAPHIC ALTERATIONS function HideAllInputs document getElementById oka style visibility hidden document getElementById cancela style visibility hidden document getElementById textb style visibility hidden document getElementById okb style visibility hidden document getElementById sectiona style visibility hidden document getElementById labelb sty
117. imagecount size 5 onChange ValidImageCount this 1 gt lt td gt lt tr gt lt tr gt lt td width D I gt amp nbsp lt td gt lt td width 148675 Gender lt td gt lt td width 81675 lt select name gender size 1 gt lt option selected value 0 gt lt option gt lt option value 1 gt F lt option gt lt option value 2 gt M lt option gt lt select gt lt td gt lt tr gt lt tr gt lt td width 5 gt amp nbsp lt td gt lt td width 14 gt ASA lt td gt lt td width 81 gt lt select name ASA size 1 gt lt option selected value 1 gt lt option gt lt option value 1 gt 1 lt option gt lt option value 2 gt 2 lt option gt value 3 gt 3 lt option gt value 4 gt 4 lt option gt value 5 gt 5 lt option gt value 0 gt not stated lt option gt lt optio lt optio lt optio lt optio 5 5 3 3 3 select amp nbsp amp nbsp E optio optio optio optio select select name ASAE size 1 gt selected value 1 gt lt option gt value 1 gt E lt option gt value 2 gt not E lt option gt value 0 gt not stated lt option gt E P 5 YP 3 lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt lt INPU YPE submit NAME submit VALUE Enter new subject gt td td align right INPU YPE reset VALUE Clear Form onClick return ConfirmClear lt td gt
118. latest version is available at http www walterzorn com or http www devira com or http www walterzorn de Copyright c 2002 2004 Walter Zorn All rights reserved Created 3 11 2002 by Walter Zorn Web http www walterzorn com Last modified 24 10 2005 Performance optimizations for Internet Explorer by Thomas Frank and John Holdsworth fillPolygon method implemented by Matthieu Haller High Performance JavaScript Graphics Library Provides methods to draw lines rectangles ellipses polygons with specifiable line thickness to fill rectangles and ellipses to draw text NOTE Operations functions and branching have rather been optimized to efficiency and speed than to shortness of source code LICENSE LGPL This library is free software you can redistribute it and or modify it under the terms of the GNU Lesser General Public License LGPL as published by the Free Software Foundation either version 2 1 of the License or at your option any later version This library 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 Lesser General Public License for more details You should have received a copy of the GNU Lesser General Public License along with this library if not write to the Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA or see h
119. lt tr gt lt table gt lt FORM gt lt p gt lt a hrefe mainpage php Return to main page lt a gt body html 11 ACTUAL ENTRY OF DATA 298 HTML2 eZ_anaestheticadded php We process the POST data from the preceding page and add entries to both the SUBJECT and ANRECORD tables the former first header Cache control no cache GLOBAL DEBUGGING require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Adding new person 0 print HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt html lang en lt head gt lt title gt Administration Adding new subject anaesthetic lt title gt LINK href css eZstyle css type text css rel stylesheet script type text javascript sl function CheckInput return true stub lt script gt lt head gt lt body gt SMYHEADER HTML0 SDEBUGGING 0 later remove fix me SCODE POST scode SDESCRIPTION POST description SOPERATION POST operation 1 SAGE POST ageyears IMAGES POST imagecount GENDER P
120. my Sp level f level is debugging level l overview 2 detail 3 pi Sp Slevel _ if SDEBUG gt level f if level is 0 always print if SLOGPRINT print LOGFILE return y print p f console print D I Here s the logging routine with associated subroutines The log is written to the ez log directory sub OpenLog my islog LOCALFILE islog S LOCALFILE 8 if islog return if not logging my TODAY amp GetLocalTime my logfile ez log LOCALFILE x2c TODAY LOG open LOGFILE gt logfile or die CRASH Could not open LOG logfile sub GetLocalTime my sec min hour mday mon year Swday yday isdst sec min hour mday mon year 1Nn De 4 FORMAT TRANSLATION EZ XLATE 88 Swday yday isdst CORE localtime time Syear 1900 f ix y2k Ssec amp DoubleDigit sec Smin amp DoubleDigit min Shour amp DoubleDigit Shour Smday amp DoubleDigit mday Smon amp DoubleDigit mon Smon january is zero return year mon mday hour min sec sub DoubleDigit Si i 8 if length i gt 1 return i return 0 i concatenate my sub CloseLog my islog Sislog if islog close LOGFILE _ se A death routine for fatal errors sub D
121. one pair lt title gt lt link type text css rel stylesh lt script src js analysis8 js type lt script type text javascript 4 01 Transitional EN gt t css rel stylesheet t href css eZstyle css gt text javascript gt lt script gt EB INS ECURE 1 0 WORKING PHP CODE 258 du BARSCALE 10 global multiplier for bar height CASE thiscase NEXTITEM lt br gt lt a href Snextlink gt NEXT CASE amp gt amp gt a p a href eZ viev phy SImage0 png finalimages thiscase m png stub SImagel png finalimages thiscase s png stub DrawMsg 801 10 350 80 60 lt h3 gt Case casei lt h3 gt CASE white colour type of artefact bit coded 1 s 2 dia 4 mean 8 hr 16 spo2 32 etco2 COLOURS new Array 4FF0000 FF6666 4FFAAAA green blue black ARTES new Array BP s BP d BP m ARS SpO2 ETCO2 Writelegend 10 10 COLOURS ARTES 60 DrawMsg 802 10 430 100 200 NEXTITEM white better than with Writelec HTML1 write manual array f We must identify ALL artefacts for all assessments of this manual record LIMITING selection to all assessments that are NOT duplicate records We create a 2 D array of data This is retrieved as MANA below which has 7 columns image number
122. osFinalRank IS NULL due to mySQL quirk IS NULL fails cannot use osStart or other TIMESTAMP ir list Sanrec SCASENUMBER GetSQL ShandDB q find current session if strlen Sanrec lt 1 here generate session 1 1 If incomplete entry in NEXTSESSIONS get this Sq SELECT nsList nsIndex nextsessions FROM NEXTSESSIONS WHERE Person list NSLIST NSINDEX SNSKEY GetSQL ShandDB Sq get unfinished sessic 1 2 find number of prior entries for this assessor Sq SELECT COUNT x FROM ONESESSION WHERE Person SUSERKEY 11 ACTUAL ENTRY OF DATA 263 bug note with empty ONESESSION table in mySQL v 4 1 22 the above gave an but this was because COUNT x fails whereas COUNT doesn t list CASENUMBER GetSQL handDB q get prior session count if strlen NSLIST 1 no entry found if SCASENUMBER 5 SMAXSESSIONS 0 if Modulo gt MUST be zero print lt br gt Database error in setting new Case readfile baddb htm exit if SINSTUDY IF NOT IN STUDY PROCEED AS USUAL
123. ost 10 9 VIEW AMES odas aa A ERR a k siy 11 Actual entry of data 11 1 Assessment of records 4446544444 44 boos 11 2 Storing the data 242 cee kx E 11 3 Entering anaesthetic subject details CONTENTS 12 Ancillary code 12 1 General purpose functions 12 1 1 A header lmettolt 2 a RA o9 9R RR 12 1 2 Check ode cuu d RR EROR dl X PAE AAA IN 12 1 4 WhatYeatlslt 2 4 kx das RR ok R R d 122 nilm A 12 TU ses soe ack TY tek i i em sk ee 1222 TextPoplhstSelect d 1 IuUUSUS A 125 Tables arrays and sorting lt gt cocos rom d do y dy 1221 MyDoubleSormt uu 3o 2a Geko ee Bee BZ eer 12 3 2 Co catenateArray LS IIS doa 95 AAA E 1234 PrintDetailTable lt ne sme eww RE sed 12 4 User information bres e A 1241 Pullu erinin e co e i o ll Y ARS ES 12 4 2 GetLinkedUserDetails 2 ue cos er x R9 xod 124 FetcebSumame orcos dise E ES 1244 FetchForenamie e xa Re 125 CSV processing ous oko RR REDE ED OE eo Xe ESS 12 6 SQL related functions 1281 Ee EE c SNE a a E o D x D 1200010 10 casa ta a a ok dc EROR k e G 12 6 3 SQLManySQL E Rok o ILI aq A deg leac ie Sx Sai ege O08 hee 8 GOH Re IXTI Theproblem ss sos A dee BR ek RB RA SOR Oe KR GS 12 72 An initial solution ck x R R l 12 75 A refined solution uw AAA 12 74 Working COUR
124. p gt lt a hrefe mainpage php Return to main page lt a gt body html HTML5 The most interesting feature of the above page is the hidden POST variable called confirmation forced to zero so that eZ admin personadded php knows that incoming data is raw The possibility exists that similar people might al ready exist in the database The latter script checks for this and requires confirma tion then forcing resubmission of data to itself but with the confirmation variable set to 1 If confirmation is 1 then no further checking takes place 10 WORKING PHP CODE 206 eZ_admin personadded php We process the POST data from the preceding page In addition we provide the option to add a user name and password Screen layout Tir AA lt Message about added person gt Add user name password for reviewers superusers Back to main page T THER Tir alternatively if confirmation is required get HEHEHE H HSA WARNI
125. person entry as a bookkeeping entry Here s the PERSONROLE table used below CREATE TABLE PERSONROLE personrole integer constraint badPersonRole primary key personrole rText varchar 32 INSERT INTO PERSONROLE personrole rText VALUES 0 anonymous 2 anaesthetist 192 superuser We add the role of superuser for the database administrator to use and we have a special value of nobody just in case Next we have the ETHNICITY table CREATE TABLE ETHNICITY ethnicity integer constraint badEthnicity primary key ethnicity EthnicName varchar 32 INSERT INTO E VALUES THNICITY ethnicity EthnicName 1 M ori y 2 NZ European 3 Asian 4 5 Pacific Islander 5 Other Tt might be argued that a separate table is needed relating an individual and multiple ethnic origins but we won t go into this level of detail 8 DATABASE DEFINITION 160 8 2 PERSDATA CREATE TABLE PERSDATA persdata integer constraint badPersdata primary key persdata pdCreated timestamp Person integer constraint badpdPerson foreign key Person references PERSON pdForename varchar 32 pdSurname varchar 32 pdGender integer PersonRole integer constraint badpdPersonRole foreign key PersonRole references PERSONROLE CurrentSpecialty integer constraint BadpdCu
126. print DOUTFILE Soptin D I now repeat for 30 seconds to humour IDAS STHISTIME 1 60x24x2 SD 0 ModGregorian THISTIM foreach r RULES Lu my Sopt amp ExtractDAT r QD if length opt gt 0 print DOUTFILE Sopt n y D I close DOUTFILE if SWARNINGS gt 0 amp Print An xxxNOTExxx There was were SWARNINGS warning s Please consult the log 0 print An Finished n CloseLog LOGPRINT exit SEXITCODE Interpolative functions sub ModJulian f get julian day but T modification 4 FORMAT TRANSLATION EZ XLATE 99 6 if Nd 4 Nd 2 Nd12 T Nd 2 1 Nd 21 d 2 return amp Julian 1 2 3 4 5 6 0 y return 0 fail sub ModGregorian f return Gregorian timestamp but T modified 287 my yy mm dd hh mi ss Gregorian _ return yy mm dd T hh mi ss sub Commaline given array return string of comma delimited values my QA opt A _ opt foreach RA opt y chop Sopt remove terminal comma dies if null length hmm return Sopt sub Backdatum given index into line index into array and array retrieve a value my j bkcnt MID j bkcnt MID _ MID bkent my x split return x j check thi
127. print r Sitemarray return 1 fail if DEBUGGING print br line data print_r Sitemarray left right i while i cols list col val FormatOneltem headarray il Sitemarray i Sleft Scol Sright SVadl ju Si y remove final commas left rtrim left right rtrim right qry INSERT INTO TABLENAME left VALUES right if SDEBUGGING print br QUERY qry if mysql query Sqry handDB print lt br gt xx SQL ERROR mysql_error return 1 4 fail STOTALLINESREAD bump count of successful inserts return 0 4 success A subsidiary routine FormatOneltem formats a single data item function FormatOneItem col itm 12 ANCILLARY CODE retval 4 return array of 2 elements retvall01 col default itm preg_replace X itm restore commas Sitm preg_replace NXn Mn itm fix carriage returns itm preg replace Sitm duplicate single quotes mtch if preg match Nsx x Nsx itm mtch ncasing quotes Sitm mtch 1 4 get 1 else itm rtrim itm itm ltrim itm DH if strlen itm lt 1 Sitm NULL Sretval 1 itm fdefault
128. records The pages are written in HTML user interaction and data gathering are implemented using JavaScript Ecmascript The main HTML demonstration page is called demo15 htm It s located in the demo subdirectory of ez shw php This page refers to the CSS stylesheet in the css subdirectory of ez shw On the web we place it in its own demo subdirectory and the HTML is self contained and doesn t store inputs or require PHP to run lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN http www w3 org TR html4 loose dtd html lang en head title Display anaesthetic record lt title gt lt link type text css rel stylesheet href css eZstyle css gt script src js eZ215 js type text javascript gt lt script gt lt script type text javascript lt i gt ACTION thanks htm BIGWIDTH 820 BIGHEIGHT 455 LEFTINDENT 10 TOPDOWN 10 OTALIMAGES 30 PATIENTID demo2 s the above also sets MYSTARTTIME SIDEWIDTH 114 these variables won t be altered often at all BIGWIDTH IMEOUT 3 minutes until pauses if Intervention FF gt gt buttons not clicked eZStart TOTALIMAGES PATIENTID SIDEWIDTH LEFTINDENT 5 TOPDOWN 5 BIGI 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 126 CASE NOTE A 60 year old with morbid obesity in septic shock due to
129. reference Sfdata linecount if SDEBUGGING print lt br else print preg match Ie if Stblname if tblnam Siq query gt Debugging query NS CREAT Squery matches Smatches 1 e METATABL INSERT INTO M E s TABL E st wt NW im ver 0 64 E R ETATABLE metatable TableName VALUES METAC if 1 p y y y mysql quer print An mysql err if METACOUNT OUNT 4 Ts mysql query iq handDB rint Xn Error with metadata tblname tblname Squery handDB ror during SQL execution 9 y Er or 8 DATABASE DEFINITION 176 return 0 f fail query y print lt br gt Number of lines submitted linecount return 1 success function FetchNextLine 8 query fdata STATIC LINE on first pass made zerol while LINE lt count fdata txt fdatal LINE l get next line SLINE if preg match txt if not comment query query txt if preg match N Nsx txt terminal return 1 y y y SLINE 0 4 in case re invoke FetchNextlLine return 0 4 no more lines EE D BI The relevant SQL initialisation file is called lt i gt eZ _upgrade2 sql lt i gt and must be prese
130. return value next pull out column name NOTE column name must NOT contain double quotes if preg match Nsx Nux Nsx Xsx col mtch check the above line in view of the double quotes 4 if no match must be integer simply return defaults return retval y Hd A nature mtch 1 4 1 can be null retvall01 Smtch 2 column name is 2 if retval 1 NULL return Sretval im Sretval 1 nature Sitm an example is DATE 2006 01 03 simpler than complex switch case stmt return retval 4 return both values 311 12 ANCILLARY CODE 312 12 6 SQL related functions 12 6 1 GetSQL Obtain a single rovv from the database as an array function GetSQL ShandDB qry message if DEBUGGING print lt br gt DEBUGGING Query was amp lt Sqry gt amp gt handQ mysql query qry handDB if is resource handQ print lt br gt SQL error amp lt qry amp gt br message mysql error exit this is serious FAIL r problem SELECT MAX mysession sTrainee FROM MYSESSION WHERE sAssessor 3 GROUP BY sTrainee IF there are no entries in MYSESSION this vill not fail but also vill not return a valid handle in handQ Thus if is resource handQ is a resourcel mysql num rows ShandQ
131. script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER SUSERSTATUS eZHeaderGreet success I 10 WORKING PHP CODE 240 SMINUSERSTATUS MAXUSERSTATUS Session overvievs 0 print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View rating details lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER lt p gt lt div align center gt table width 90 border 2 lt tr gt lt td gt lt i gt Assessor code lt i gt lt td gt td i Case Number lt i gt lt td gt td gt lt i gt Start timestamp lt i gt lt td gt td gt lt i gt End Timestamp lt i gt lt td gt td gt lt i gt Reported server timestamp lt i gt lt td gt td gt lt i gt Final Rank lt i gt lt td gt td i Automatic i td td gt lt i gt Seen Before lt i gt lt td gt td gt lt i gt Choice lt i gt lt td gt td gt lt i gt Comment lt i gt lt td gt td gt lt i gt Is manual lt i gt lt td gt td gt lt i gt Subject S code lt i gt lt td gt lt lt lt lt lt lt lt lt lt lt lt tr gt HTMLO Sqry SELECT ONESESSION Person osCaseNumber osStart osEnd osReport
132. separate window will open After showing 4 5 anaes and getting feedback 0 50 Have demo and documentation available without login 0 50 Record timestamp every time FF button is pressed 0 51 Tested disaster recovery by storing remaking and uploading 0 51 Suc cess Note the difference between elsif Perl and elseif PHP this really screws you around if you say elsif in PHP as you get an obscure error Changes for v 0 52 1 2 Major issue fixed in 0 52 skipped images at about image 44 49 in all files due to precession of display past capture capture delays not com pensated for by SSLACKTIME Rather than replay all files ugh we alter ez mogrify au3 and SSLIST TXT so that we specify an image to duplicate After the duplication the number of the destination image is 1 the number of the source AND we base our 10th reference image on the destination We then manually edit the duplicate x images Display of trimmed final images in separate finalimages directory 0 52 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 334 3 Feedback at case 50 give user detailed access so that they can review each and every case and their responses 0 52 Use this to explore visualisation of their interventions and the difference between responses to s and m cases Changes for 0 53 This was the version used throughout the execution of the study 1 Major idea is to permit suppression of interp
133. so as to satisfy simultaneously your obligations under this License and any other pertinent obligations then as a consequence you may not distribute the Program at all For example if a patent license would not permit royalty free redistribution of the Program by all those who receive copies directly or indirectly through you then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program If any portion of this section is held invalid or unenforceable under any particular circum stance the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License 9 If the distribution and or use of the Program is restricted
134. superuser superuser Superuser Started 228 Return to main page Figure 11 Editing a user log on 10 6 Editing log on details The following page presents a table of users who are permitted to have log on priv ileges Clickable links are created which submit a GET to the page eZ do editlogon The user ID submitted to that page is associated with the name editlogon eZ edit logon php header Cache control no cache STHISPAGE Tei edit logon php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGr t success SMINUSERSTATUS MAXUSERSTATUS Edit somebody s log in 0 print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC N3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Edit log in lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER lt p gt lt a href mainpage php Return to main page lt a gt or lt h3 gt Select a user sorted by surname lt h3 gt lt p gt lt div align center table width 90 border 2 lt tr gt lt td gt lt i gt Forename lt i gt lt td gt lt td gt lt i gt Surname lt i gt lt td gt 10 WORK
135. the offer to distribute cor responding source code This alternative is allowed only for noncommercial dis tribution and only if you received the program in object code or executable form with such an offer in accord with Subsection b above The source code for a work means the preferred form of the work for making modifications to it For an ex ecutable work complete source code means all the source code for all modules it contains plus any associated interface definition files plus the scripts used to con trol compilation and installation of the executable However as a special exception the source code distributed need not include anything that is normally distributed in either source or binary form with the major components compiler kernel and so 13 LICENSING 324 on of the operating system on vvhich the executable runs unless that component it self accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated place then offering equivalent access to copy the source code from the same place counts as distribution of the source code even though third parties are not compelled to copy the source along vvith the object code 5 You may not copy modify sublicense or distribute the Program except as expressly pro vided under this License Any attempt otherwise to copy modify sublicense or distribute the Program is void and will automatically terminate your righ
136. these pages 9 PHP ACCESS CODING 194 if handDB mysql close handDB print An Failed to connect to database here have rescue HTML code readfil rescue htm exit 2 retrieve cookie If null present NEW login screen SID COOKIE eZ SID print p Debug cookie SID is SID if strlen SID lt 1 mysql close handDB ForceLogin Welcome to eZ exit y 412a debug only Sdqry SELECT pSID FROM PERSON WHERE person 1 list i GetSQL handDB dqry debug get su sid print p Superuser SID is currently i 3 Check for failure qry SELECT person pExpiration pLoginName pValue FROM PERSON WHERE pSID S SID ShandQ mysql query qry handDB if is resource handQ f debug print lt br gt DEBUG SQL error at login mysql error if 1 mysql num rovs handQ force cookie to evaporate mysql close handDB setcookie eZ SID time 100 ForceLogin No match for cookie exit Y 4 if cookie stale present login row mysql fetch assoc handQ Sexptime row pExpiration f row is associative array nov time if exptime lt nov here force cookie to evaporate mysql close handDB setcookie eZ SID time 100 print lt br gt Debug exp time amp lt S exptime amp
137. to fix IE7 bug Note also bug at end exit unknown fx RestartClock line 284 of ez7 js 22 Also look at layers in IE7 What is default layer of an item has own z index fix me Need to send through end timestamp done While loading encourage user to read the details below done Add in a cookie detector and warn if absent done login php Route eZ index htm to index php etc done Check resolution of screen and warn if way out esp if low done Feedback after assessing each case done Big feedback on performance after assessing ten cases done ASA values for every patient done Reminder not just Thanks that results may differ done 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 333 13 14 15 16 Fix rot64 unzip in new IdAS version too much time to do Wait plan B used 50 anaesthetics 25 patients put up Fixed up graphic display after 10 cases pie chart Lots of fine tuning of online user interface Changes for v 0 50 0 51 p 2 Fix start time on reload keep in string v 0 50 Check through each record vs duration look for bad stuff Check that initial values submitted to IDAS are being grabbed Check inputs vs screen read ings at start and end of each record Went through and re created S0042m S0060m S0061s S0068m S0643m S0663m S0692m mainly related to EtCO2 and cut length in database of S0294s to 43 images ipo 50 0 50 Help menus
138. v0 53 1 3 randomise ten ANRECORD entries and write to NEXTSESSIONS q SELECT anrecord FROM ANRECORD ORDER BY anrecord SALLRECS Flatten SQLManySQL ShandDB q get all anaesthetic rec Salen sizeof SALLRECS if Salen CASENUMBER lt 10 readfile congrats htm exit im RANDA array i while i lt 10 get 10 new items SRANDA i SALLRECS SCASENUMBER i Sj FF y now randomise RANDA to sessionarray THIS ASSUMES CASES IN ALLRECS ARE PAIRED ensure this is so xxx Ssessionarray SpecialRandom RANDA 0 and write to NEXTSESSIONS SNSLIST ConcatenateArray sessionarray else IF IN STUDY THEN USE DIFFERENT APPROACH read array and set up NEXTS ESSIONS from here first test if SCASENUMBER SNSLIST FetchStudyList SINSTUDY if strlen NSLIST 10 print br Error in initialising study list Please gis exit y else readfile congrats2 htm have finished 24 cases exit 11 SCAS 2 ACTUAL ENTRY OF DATA he y SNSKEY FetchKey 264 handDB Nextsessions q INS SNSK DoSOL ha start a ndDB ERT INTO N EY EXTS NSLIST ESSIONS nextsessions 1 SUSERKEY store 1 for ns ndex as it is NEXT iteml set next session group nsList nsIndex Person
139. will cause subsequent attempts to fail nastily But anyone failing can now see when the value was set count 0 Sok 0 while Sok amp amp count lt 1000 i Scount Sok TryDoSQL handDB UPDATE UIDS SET uValueLock Snow WHERE uValue cast uValueLock AS INTEGER lock generator Here s the catch Within the same loop if we fail check that the previous person who grabbed control hasn t died disgracefully If this isn t the case no time out then we delay and try again but if the person has timed out we still grant them the increment by doing it ourself but reset uValueLock to again make it accessible if 1 ok timeout GetSQL handDB SELECT uValueLock FROM UIDS get lock time Sdelta Julian now Julian timeout if delta gt MAXTIMEOUT DoSQL ShandDB UPDATE UIDS uValue uValuetl WHERE uValueLock timeout restore function else here we might insert a random delay 26We assume that now is an accurate timestamp with a millisecond value and preferably a microsecond value SET uValueLock cast uValue 1l as varchar 32 12 ANCILLARY CODE 317 L b Here Julian calculates a Julian date from a standard timestamp which is a floating point value Alternatively we might use modified unix timestamps without the Julian fussing One good
140. x filter progid DXImageTransform Microsoft AlphalmageLoader src diffnow png apply the background image with Alpha in IE5 5 Win The src should match that gt lt img style filter progid DXImageTransform Microsoft Alpha opacity 0 make the real image fully transparent in IE5 5 Win so the Alpha image can shov srce diffnov png width 927 height 521 border 1 alt gt lt span gt Another is to use pngcrush This allows one to specify an 8 bit PNG with transparency trns option pngcrush trns 4 255 255 255 0 diffnov png diffnow8 png This specifies transparency However we will use neither and simply tweak things using ImageMagick as described previously 6 IMAGE TRANSFORMATION 118 6 2 Autolt code ez mogrify au3 An Autolt program that trims all specified images preserving every tenth image but subtracting the next nine from the previous image to effectively further com press PNG files These are the transparent Web files that are replayed in layers AutoIt Version 3 0 Program to work through a list of names obtain images from directories files specified in the list and modify the list accordingly We use the same replay list as does ez replay au3 We don t however make use of CurrentFile txt we start at the beginning Const SONTOP 0x40000 PREPARATION Load numbers etc Identify a file lobal CURRENTFILE Global SCAPTURECOUNT
141. x i 2 9 51403784 c md5 gg c d a b x i 7 14 735328473 b md5_gg b c d a x i 12 20 1926607734 a md5 hh a b c d x i 5 4 378558 d md5 hh d a b c x i 8 72022574463 md5 hh c d a b x itll 6 1839030562 b md5_hh b c d a x i 14 23 35309556 a md5 hh a b c d x i 1 4 1530992060 d md5 hh d a b c x i 4 1 1272893353 md5 hh c d a b x i 7 6 155497632 b md5 hh b c d a x i 10 23 1094730640 a md5 hh a b c d x i 13 4 681279174 d md5 hh d a b c x it l 2358537222 c md5 hh c d a b x i 3 16 722521979 b md5 hh b c d a x i 6 23 76029189 a md5 hh a b c d x it 9 4 640364487 d md5 hh d a b c x i 12 421815835 c md5 hh c d a b x 1 15 6 530742520 b md5 hh b c d a x it 2 23 995338651 a md5 ii a b c d x i 0 6 198630844 d md5 ii d a b c x i 7 10 1126891415 md5 ii c d a b x i 14 15 1416354905 b md5_ii b c d a X i 5 21 57434055 a md5 ii a b c d x i 12 6 1700485571 d md5_ii d a b c x i 3 0 1894986606 md5 ii c d a b x 1 10 15 1051523 b md5_ii b c d a X i 1 21 2054922799 a md5 ii a b c d x it 8 6 873313359 d md5 ii d a b c x i 15 0 30611744 md5_ii c d a b x i 6 15 1560198380 b md5_ii b c d a x
142. 0 Sf min 24x60 minutes as a day fraction amp Print An Julian f 3 Syy mm dd hr mi ss amp Gregorian f amp Print An Gregorian yy mm dd hr mi ss 3 return yy mm dd hr mi 00 sub Julian my fy fm fd fh fmi fs ff fy fm fd fh fmi 525 ff 8 my f Sf 367x fy int 7 fytint fmr9 12 4 int 3x int fy4 fm 9 7 100 1 4 2 EZ CAPTURE MANUAL DATA CAPTURE 36 t int 275 fm 9 fd 1721028 5 Sfh fmi 5254 0 ff 60 60 24 return f sub Gregorian my 33 3d _ my SEPSILON 0 000001 jd SEPSILON 2 SR G A B C Syear month Sday Y y Z floor jd 1721118 5 R jd 1721118 5 Z SG 52 0 25 SA floor G 36524 25 SB A floor A 4 year floor B G 365 25 C B Z floor 365 25 x year month int 5 x SC 456 153 day C int 153 x month 457 5 SR if month 5 12 Syear year 1 month month 12 D I my gd 0 5 Sid int jd if God gt 1 f Julian starts at midday Sgd 1 y my gh gmi gs Sgh gd clumsy gh 24 gmi gh gh int gh gmi gh Sgmi 60 gs gmi gmi int gmi gs Sgmi gs 60 return year amp DoubleDigit month amp DoubleDigit int day 2
143. 01 dbp csv and X0001 hr csv but with the final se ries terminate with a zero cal and x measurement time e Then only do we submit the name and timestamp to Perl What Perl does is tries to open X0001 csv If this fails then it looks for the components concatenates them and does its magic Perl uses an exit code to report failure bits 0 1 or 2 of the exit code are set depending on which sequence failed sbp dbp or hr f Autolt reads the Perl exit code and offers the user the opportunity to repeat the offending series overwriting these g Created an Autolt interface with three buttons Press a button to ac quire each series and a final one to validate the combination If a component is invalid this is renamed to for example X0001 dbp timestamp inv for invalid If the user presses a button where an unchecked component exists he she is asked whether they wish to overwrite and if so that component is invalidated 3 Have the ability to bypass actual capture faking the Excel submission etc for debugging purposes 4 Version 0 36 Get IDAS database interrogation working 30 As initially conceived 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 329 9 10 We also need the ability to review the playlist log played items and remove them Use MWSnap rather than Paintshop but see next version Introduced another flag in the au3 interface have we saved to playlist Also store the fo
144. 1 bb tt bb gt gt 1 aa2x b lt lt 1 1 drw true while y gt 0 if st 0 st bbx x lt lt 1 3 tt bb lt lt l x else if tt lt 0 st bbx x lt lt 1 3 aa4x y 1 tt bb lt lt 1 x 2 1 3 else tt aa2 y 1 3 st aa4x y if drw this mkOvQds cx Cy x X wod y ythod 1 1 dru drw function mkRect x y v h var s this stroke this mkDiv x y w S this mkDiv x w y S h this mkDiv yth wts S this mkDiv y s s h s X X function mkRectDott x y w h this dravLine this dravLine this dravLine this dravLine Xtw y xXtw y h yth xtw y h y x yth X y X W y r r x X function jsgFont this PLAIN font weight normal this BOLD font weight bold this ITALIC font style italic this ITALIC BOLD this ITALIC this BOLD this BOLD ITALIC this ITALIC BOLD var Font new jsgFont function jsgStroke this DOTTED 1 var Stroke new jsgStroke 284 11 ACTUAL ENTRY OF DATA function JjsGraphics 14 wnd this setColor this setStroke if jg fast this htmRpc else this mkDi this setFont E his ftFam f his ftSz sz his ftSty s ct oct this drawPolyl Hh or var i 0 his drawLine ct ct his fillRect et his mkDiv x
145. 1 else if yl y2 y2 array yl indl yl array ylind21 x2 array x indl xl array xlind21 else continue 11 ACTUAL ENTRY OF DATA modified 11 2 2004 Walter Zorn if y gt yl amp amp y lt y2 polyInts ints Math round y yl x x2 x1 y2 y1 x1 else if y maxy amp amp y gt yl amp amp y lt y2 polyInts ints Math round y y1 x x2 x1 y2 y1 x1 polyInts sort integer compare for i 0 i ints 1 2 this mkDiv polyInts i y polyInts i 1 polyInts i 1 1 this drawString function txt x y this htm div style position absolute white space nowrap left pk top Gw font family m this ftFam pt font size this ftSz rootori this olor t 4 thrs ftety wo txt lt div gt drawStringRect added by Rick Blommers Allows to specify the size of the text rectangle and to align the text both horizontally e g right and vertically within that rectangle x this drawStringRect function txt x y width halign this htm div style position absolute overflow hidden lefto d x pay ope d yc pc width width px text align halign font femily this ftFam font size this ftSz eslenit s this cooler 47 bus testy 7 tet txt N div5 x this dravlmage function imgSrc x Y v h a
146. 15 12 7 2 An initial solution How about the following schema In all of the following we assume we have a key generator table called UIDS that contains a single row filled with key generating columns 1 First lock the key generator We assume that we have two keys in the UTDS generator table uValue and uValueLock and that for now both are integers Scount 0 Sok 0 while Sok amp amp count lt 1000 i Seount Sok TryDoSQL ShandDB UPDATE UIDS SET uValueLock uValuet l WHERE uValueLock uValue lock generator field 2 Next either fail if repeated attempts all failed or fetch the new generated value TE ok j GetSQL handDB SELECT uValueLock FROM UIDS get new key else return 0 fail 3 Finally allow others to get the next value DoSQL handDB UPDATE UIDS SET uValueLock SJ release lock 12 ANCILLARY CODE 316 12 7 3 A refined solution The preceding approach seems fairly robust but there is a major problem if a process locks a key generator and then dies the generator is locked forever We therefore need a robust timeout If all processes are accessing the same source of a timestamp here is one solution 1 Lock the generator as above assuming the initial value in uValueLockTxt is the same as uValue but write a timestamp provided as now to uVal ueLock This
147. 2 success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Restoring database 0 print HTMLO DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN html lang en head title View comments lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER HTMLO GLOBAL SDEBUGGING SDEBUGGING 1 SBIGNAME POST csvname if strlen BIGNAME gt 0 mysql query START TRANSACTION ok ReadBigCsv handDB BIGNAM if ok 5 0 print lt p gt There was were ok error s mysql_query ROLLBACK else mysql_query COMMIT else print Bad CSV name Nothing donel y E SDEBUGGING 0 print HTML3 lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 A large CSV reader This continues from the preceding PHP script We permit a single CSV file to contain multiple data tables in order To be able to do this we establish the con ventions that e The file must contain within its first line the text SsDatabaseBackupName eZ 10 WORKING PHP CODE 233 e Any line which starts with SsTableName forces termination of the previous table and the start of the newly speci fied one e After the tablenam
148. 24 25 B A floor A 4 year floor B 5G 365 25 SC SB Z floor 365 25 year month int 5 x C 456 153 day C int 153 x month 457 5 SR if month 5 12 year year 1 month month 12 D I my gd 0 5 3d int jd 2 EZ CAPTURE MANUAL DATA CAPTURE 76 if gd gt 1 Julian starts at midday Sgd 1 y my gh gmi gs Sgh gd clumsy gh 24 gmi Sgh Sgh int gh gmi gh Sgmi 60 gs gmi gmi int gmi gs Sgmi gs x 60 return year amp DoubleDigit month sDoubleDigit int day sDoubleDigit gh amp DoubleDigit gmi amp DoubleDigit int gs sub DoubleDigit if length i gt 1 return i D I return 0 i 4 concatenate here are the Store and Unstore routines The latter is redundant sub Store my St y St Sy _ SALLDATA St Sy sPrint An gt SSTORECOUNT Store Sy at time 56 2 SSTORECOUNT sub Unstore my St parameter is eg etco2 St is time 2 EZ CAPTURE MANUAL DATA CAPTURE t 8 SALLDATA St redundant y Writing data sub WriteKbData my RANPATH SRAWFILENAME DATTYPE SRAWPATH SRAWFILENAME SDATTYPE _ my outname SRAWPATHSRAWFILENAME S DATTYP open OUTFILE gt Soutname or Die XCRASHx C
149. 2732 This uses 16 bit operations internally x to vork around bugs in some US interpreters x function safe_add x y var lsw x 6 OxFFFF y OxFFFF var msw x gt gt 16 y gt gt 16 aw gt gt 16 return msw lt lt 16 lsv amp OXFFFF 9 PHP ACCESS CODING 191 x Bitvise rotate a 32 bit number to the left x function bit rol num cnt return num lt lt cnt num gt gt gt 32 cnt Convert a string to an array of little endian words If chrsz is ASCII characters gt 255 have their hi byte silently ignored x function str2binl str var bin Array var mask 1 lt lt chrsz 1 for var i i str length x chrsz i chrsz bin i gt gt 5 str charCodeAt i chrsz mask lt lt 1532 return bin x x Convert an array of little endian vords to a string x function binl2str bin var str var mask 1 lt lt chrsz 1 for var i 0 i bin length x 32 i chrsz str String fromCharCode bin i gt gt 5 gt gt gt i 5 32 mask return str Convert an array of little endian words to a hex string x function binl2hex binarray var hex tab hexcase 0123456789ABCDEF 0123456789abcdef var str for var i i binarray length x 4 i str hex_tab charAt binarray i gt gt 2 gt gt i 4 8 4 6 xF hex tab charAt binarray i 2 gt gt 1 4
150. 3 xy ControlGetPos MAINWINDOWNAME CLASS TdxNavBar INSTANCE 1 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 111 clumsy hack MouseClick left 20 xy 0 0 07 x SWINH2 xy 1 ne 7 here might click e g 6x to enlarge if short anaesthetic SMAGNICOUNT 6 If CAPTURECOUNT gt 120 Then SMAGNICOUNT 5 EndIf If CAPTURECOUNT gt 180 Then SMAGNICOUNT 4 EndIf If CAPTURECOUNT 5 240 Then SMAGNICOUNT 3 fix me make an equation EndIf While MAGNICOUNT gt 0 SMAGNICOUNT 1 If STESTNOSERVER 0 Then MouseClick left 240 775 hack back Else MouseClick left 230 688 2 gh EndIf Sleep 100 Wend Pr Pr LOOP REPEATEDLY CAPTURE AND SAVE but first wait a bit extra Sleep SINITIALPAUSE 21 for MYCOUNT 1 to SCAPTURECOUNT Sleep SCAPTUREINTERVAL SWHOLEFILE SAVENAME amp amp LeadZero MYCOUNT If FileExists SWHOLEFILE amp PNG Then FileDelete SWHOLEFILE 6 PNG EndIf WinActivate MAINWINDOWNAME need CheckAntibiotic if we use Autolt to capture t Local hbmp Shbmp _ScreenCapture_Capture _ScreenCapture_Savelmage SWHOL ne screen 7 SWINX EFILE SWINY PNG Shbmp ensure clear antib
151. 3a ELEDIM eleclen ELEC new Array ELEDIM HTML3a SJsElec 3 0 while j Seleclen r Flatten SELECA 3 SELECA SQLManySQL ShandDB Sqry m0 An MO new Array r 0 m0 preg_r plac my WEE m0 preg replace 260 get markup for electronic records I r 4 I 521 15 1111 ISr 21 11 ISr 3 m0 Scape any quote mr mi nov can insert quotesl the above doesn t address any pipes in the original array SJsElec m0 5 Xn ELEC j MO Sj y print JsElec write actual images data print lt lt lt HTML4 next write top final background image handwritten record Writel 0 SImage0 XINDENT TOPGAP T DrawMsg 1 XINDENT 77 TOPGAP 5 100 50 and overlay data WriteData XINDENT XLEFT TOPGAP parselnt ISCALEx 0 YBOTTOM the background for the electronic record Writel 1 SImagel XINDENT TOPGAP VSE DrawMsg 2 XINDENT 77 OPGAP VSEPARATION parselnt ISCALI I WriteData 1 XINDENT XLEFT TO what about left panel w XIND end of main Javascript plas lt script gt lt head gt HTML4 T IMAGEW parseInt ISCALE IMAG EH 0 PARATION parselnt ISCALEx IMAGE Ex IMAGEH 5 PGAP VSI E
152. 4 for date calculations y Y f my SDEBUG 3 f O no debugging l overview 2 detail 3 nitpicking SLOGPRINT 1 print to log SLINECOUNT 0 SWARNINGS 0 see usage SEPSILON 0 0000005 tiny number SINTERPOLATEBPTOO 1 1 forces BP interpolation as well SFORBIDMISSINGBPVALUES 0 1 disallow partial BPs SEZPATH ez SOUTPATH SEZPATH dat SLOCALPATH SEZPATH csv SEXITCODE 0 code on exiting Perl TOkPa 0 if mmHg set to 1 the following are global LOCALFILE SARGV 0 source filename e g S0013 m NO suffix SRULEFILE SARGV 1 SRULEFILE 1 txt i invalid rule file SRULEFILE datrules txt r SPARAMS SARGV 2 eg debug 3 logprint 0 kPa 1 kPa 0 means don t convert to kPa 1 means DO r r PARAMS debug d command line control SDEBUG 1 PARAMS logprint d SLOGPRINT 1 PARAMS kPa d TOkPa 1 4 FORMAT TRANSLATION EZ XLATE 93 D I sOpenLog LOGPRINT EZPATH SLOCALFILE start writing to error debug log amp Print Running ez csv2dat pl Arguments ARGV 01 SARGV 1 SARGV 2 my FILENAME SLOCALFILE csv e g S0013 m csv here from LOCALPATH load file containing translation rules
153. 5 duration Int 0 5 duration x 60x24 get minutes Return duration EndFunc Slurp file data in Format is 1 first line date DD MM YYYY second line time HH MM PE third line valid 31 valid flags Func Slurp fnam Dim SALEN SEZ_MAXLINES Dim Sarr SALEN 1 Sarr 0 0 0 signals failure Sf FileOpen fnam 0 read only if Sf 1 Then Return arr rs fail EndIf SWARNINGS 0 the following is extraordinarily cumbersome and needs to be revised C per Sv FileReadLin f Case number s StringSplit v If Ss 1 casenumber Then Sarr EZ_CASENUMBER s 2 Else SWARNINGS VARNINGS 1 EndIf Sv FileReadLin ic EE atb date s StringSplit v If s 1 date Then Sarr SEZ_CASEDATE 55121 get date Else SWARNINGS SWARNINGS 1 EndIf v FileReadLine f j next time s StringSplit v If s 1 time Then Sarr EZ_CASETIME s 2 and time Else SWARNINGS VARNINGS 1 EndIf Sv FileReadLine f validity flags s StringSplit v If Ss 1 valid Then 2 EZ CAPTURE MANUAL DATA CAPTURE 66 Sarr SEZ VALIDFLAGS 55121 Else SWARNINGS SWARNINGS 1 EndIf Sv FileReadLine f listed flags might here check for success 55 StringSplit v
154. 8 8 PHP link page write list of assessors We link this page view_assessors php to the showl php page 247 clr left passing relevant parameters To avoid repeatedly querying the database we pass four parameters GET 1 The index of the selected subject 2 The index of the chosen assessor 3 A list of subjects IDs in order separated by spaces 4 A similar list of assessors header Cache control no cache STHISPAGE view assessors php require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS 10 WORKING PHP CODE 248 View assessments by assessor 0 print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View assessments by ASSESSOR lt title gt LINK href css eZstyle css type text css rel stylesheet head body SMYHEADER lt p gt lt a href mainpage php Return to main page lt a gt lt h3 gt Select an assessor code lt h3 gt HTMLI HERE DO QUERIES TO CREATE ASSESSOR AND CASE LISTS SORTI Lj T Sqry SELECT
155. A Math floor A 4 year Math floor Bt G 365 25 C Bt Z Math floor 365 25 year month parselnt 5 C 456 153 day C parselnt 153 month 457 5 R if month 5 12 year year 1 month month 12 y var gd 0 5 jd parseInt jd if gd gt 1 Julian starts at midday gd 1 y var gh gd clumsy gh x 24 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 151 gh parselnt gh gmi gh gmi x 60 var gs gmi gmi parselnt gmi gs gmi gs 60 alert Debug Gregorian year month parselnt day gh gmi setYear year setMonth month 1 ughugh SetDate parseInt day setHours gh setMinutes gmi SetSeconds gs Gt eb co ZE EE function ReloadALLWEBDATA str submit formatted string split on double pipes var c 0 var i str indexOf 11 while i gt 0 cannot be at start ALLWEBDATA c str substring i str str substring i 2 i str index0f y return c return number of items loaded function DebugALIWEBDATA var c 0 var cmax ALLWEBDATA length while c if ALLWEBDATA c undefined cmax 0 else alert Element c has value ALLWEBDATA c D c y end of Javascript eZ15 js 7 7 7 7 7 In the above
156. ADER HTML1 if SUSERSTATUS eZ ASSESSOR MAX print lt p gt lt a href eZ assess php Assess another anaesthetic lt a gt else print lt lt lt HTML2b lt p gt Please choose one of the following options lt p gt lt table width 80 border 0 inner table gt lt tr gt lt td width 60 gt lt ol gt lt li gt lt a href eZ add person php Add a person lt a gt lt p gt lt li gt lt a hrefe eZ edit person php Edit a person lt a gt lt p gt lt li gt lt a href eZ edit logon php Edit log on lt a gt lt p gt lt li gt lt a href eZ_view php gt View delete data lt a gt lt p gt lt li gt lt a href eZ_backup php gt Back up and restore data lt a gt ol td td valigne top width 40 lt p gt lt a href eZ_assess php gt LIVE TESTING lt a gt lt p gt lt a href eZ add anaesthetic php Add amp nbsp a amp nbsp subject amp nbsp amp amp amp nbsp e td tr table end inner tbl gt HTML2b H print lt lt lt HTML3 10 WORKING PHP CODE 199 lt p gt lt table width 100 gt tr td a href logout php Log out lt a gt lt td gt td align right lt a href GPL htm gt Documentation lt a gt amp nbsp lt td gt lt tr gt lt table gt td tr table end middle tbl gt td tr table end OUTER TBL gt body html
157. AFERsleep Section 5 2 using Autolt and screen capture sequential images every minute TOnce we ve overcome the paranoid security features 2 EZ CAPTURE MANUAL DATA CAPTURE 9 2 ez capture Manual data capture It is tedious to repeatedly measure values on an anaesthetic record chart but these measurements are necessary when capturing data from manually recorded charts so that they can be compared with automated records In this section we will in troduce our approach to data capture use pseudocode to sketch the code we will use to process data and then construct a Perl program that does this processing 2 1 Introductory notes We initially thought that the process might work along the following lines 1 Connect the Digital Calipers to the USB interface module and insert the USB interface module into the USB port of the PC running Windows 2 Press the on button on the Calipers 3 Run the driving software DETAILS ensuring that the COM port etc are correctly set up 4 Capture data acquired using the calipers 5 Save the record to Excel don t try other methods as this may crash the PC 6 Save the Excel spreadsheet as a CSV file with a unique sequential number 7 Invoke a Perl script to a Convert all digital caliper recorded values to mmHg rates b Request input for SpO2 and EtCO2 c Write a unified time based record of all data as a CSV file 8 Repeat record capture as required 9 E
158. ARNING initial DURATION and final duration d don t match 0 SWARNINGS SEXITCODE 32 4 bad x duration match amp Print n nExit code 32 0 y 2 3 4 Main data processing Here s the main data processing and storing routine sub ProcessDatum my t Sy SRECORDTYPE St Sy SRECORDTYPE _ my 5 2 y3 if amp ISIN Sy ZERO y2 amp ReadLine if amp ISIN y2 ZERO amp Print n Storing NA value 2 2 EZ CAPTURE MANUAL DATA CAPTURE 28 amp Store t NA return t 5 elsif amp ISIN y2 MAXVAL amp Print n Moving to next series 2 amp NextSeries St Sy y2 SSERIESCOUNT 2 double return 0 elsif y2 gt SMAXVALhi amp Die An Bad calibration value y2 elsif y2 lt MINVALlO amp Print n Special low value 2 amp Store St y2 special low value return t 5 else amp Die An Bad special datum value y2 y elsif amp ISIN Sy ALPHA amp Print An Special offset y 2 my Stoff int 5 Sy SALPHAm FOR NOW TRUNCATE SHOULD PROBABLY ROUND FIX MI Sy2 amp ReadLine amp Store t toff 5 y2 store offset value 5 as is past PRIOR time return t do NOT advance elsif y lt MINVALlO amp Die n Bad y data value Sy elsif Sy gt SMAXVALhi amp Print
159. ATION Exit 2 Earl EndIf EndIf SfileA SfileB Sfi If fi SSKIPPER Then if AT the skipper file SDIDSKIP 1 120 If Mod fi 10 1 Then oops If ON the key frame file SfileB FILENAME amp MakeSerial fi 3 Ssnipargs FILESTEM amp fileB 6 fileB 6 820 455 25 dosok RunWait ComSpec c justsnip bat 6 snipargs QGSW HIDE EndIf EndIf fileB SFILENAME amp MakeSerial fi 3 fileD SFILENAME amp 6 MakeSerial fi SDIDSKIP 3 Wend fi 1 If fi COUNT Then L MsgBox 0 Note for amp FILENAME Number of conversions was amp fi 5 Else EndIf EndFunc mv routine to lengthen a number by prepending zeroes Func MakeSerial s lgth While Stringlen s lt Slgth s String 0 amp String s Wend Return Ss EndFunc FE 5 GetFileList Func GetFileList fname lineno get file list with number of frames to capture Dim SFDAT 4 v0 52 added 1 item skipper SFDAT 0 0 no data SFDAT 3 0 no Skipper Sln 1 Slineno first line is a header line myline FileReadLine fname ln If error lt gt 0 Then if failed Return FDAT FAIL Exit EndIf SFDAT StringSplit myline MsgBox 0 WARNING
160. ATION CurrentLocation LocationText VALUES 1 Mainly public 2 Mainly private 3 Similar public private 8 3 SUBJECT Although it s tempting to represent a patient as an anonymous PERSON within the database we succumb to the temptation to create a separate SUBJECT table because of the very different anonymised information we require Added in v0 41 CREATE TABLE SUBJECT subject integer constraint badSubject primary key subject sCode varchar 16 sDescription varchar 250 sOperation varchar 128 sAge integer SASA integer SASAe integer sSex integer The field sCode is the unique ID e g 0012 sDescription is a description of the problems etc sOperation is a note on the surgical procedure we also store a numeric ASA 1 in sASAe if the patient is an ASA E rating 0 if not NULL if unknown and sSex is 1 for female 2 for male 84 ANRECORD ANRECORD refers to an anesthetic record captured either manually or automat ically It refers to the SUBJECT table This table was created in v0 41 CREATE TABLE ANRECORD anrecord integer constraint badAnrecord primary key anrecord anual integer 8 DATABASE DEFINITION 162 Subject integer Images integer constraint badAnSubject foreign key Subject references SUBJECT Manual is 1 for manually recorded scenario O for machine recorded 8 5 ONESESSION A particular user session t
161. Contents 1 Introduction EzCapture Interactive measurement and display of anaesthetic records Version 1 0 J M van Schalkwyk D Lowes May 22 2011 1 1 A note on the directory structure e E 12 DES saos agosa osa a A A e Ee ez capture Manual data capture 21 Introductory notes b dala ds es 2 2 Algorithm pseudocode 2 3 Veri code raw data to CSV nda b k 231 2 52 233 2 3 4 22 23 6 23 7 Main TOUllle cod sis Wek xe Ee xs IU cauca RA Hae Tests of calibration Main data processing coccion mx tarro PICS BUCO dana axe WY we ew ee VEIS CATA uoo RRR A a x A 24 A comprhensiye GUI aa us uw eier a Ne AN e 2 4 1 2 4 2 2 4 3 2 4 4 2 4 5 Invoke Notepad ss ecs osos o m omm ts Rege Queue entries for replay by SAFERsleep Advanced Datum acquisition Keyboard input uu uoo x y ede ex ide e BES Decrypt SAFERsleep IAR fileto XML 2 5 Obtain basic record information 251 DOS invocation of ez GUI 46 Perl keyboard pul lt lt Roe ke mia sis bE Se piirsi CONTENTS 2 3 Retrieve files from SAFERsleep using Perl 78 3 1 The connection string sk behead 82 4 Format translation ez xlate 83 4 1 Translate from XMLtoCSV 83 4 1 1 Perl code translate to CSV 83 4 1 2 A DOS batch file xm l26s8V
162. D list OTHERLOGIN GetSQL ShandDB qry get user login print lt lt lt HTML2 lt p gt lt a hrefe mainpage php Return to main page lt a gt or lt FORM name eZ_do_editlogon2 ACTION eZ do editlogon2 php METHOD POST onSubmit return CheckInput this gt input type hidden name otheruserid value SOTHERLOGONID gt table width 80 cellpaddinge 1 cellspacing 1 lt tr gt lt td gt lt b gt 1 FIRST please enter YOUR password lt b gt lt td gt td lt input type password name mypswd size 16 lt br gt This is a security measure lt td gt lt tr gt lt tr gt lt td colspan 2 amp nbsp td tr lt tr gt lt td gt lt b gt 2 Enter user log on password for b lt td gt lt td gt lt b gt SOTHERFORENAME SOTHERSURNAME lt b gt lt td gt lt tr gt tr td a User log on name lt td gt lt td gt lt input type text name userlogon size 16 value SOTHERLOGIN gt lt br gt If exists can be left the same lt td gt lt tr gt lt tr gt lt td rowspan 2 b New password lt td gt lt td gt lt input type password name newpasswordl size 16 gt lt br gt Enter new password lt td gt lt tr gt lt tr gt lt td gt lt input type password name newpassword2 size 16 lt br gt Re type lt i gt new lt i gt password lt td gt lt tr gt lt tr gt lt td gt lt INPUT TYPE submit NAME submit VA
163. D thisSBP thisDBP xx 3 D I j 0 f will skip past Julian date while j lt cols Lo skip print Rm Print An Processing column j MID index is MIDIDX 3 my v D 31 if v NdtN Nd if numeric if SLASTGOOD j MIDIDX if old datum for this time amp Print Skip entry already exists LINE MIDIDX 3 else HERE WILL BACKFILL v0 53 provided not BP my NObp j SiSBP j SiDBP j SiMBP amp Print An Column j non BP column gt SNObp 3 my bkcnt SLASTGOOD j last good item my k MIDIDX bkcnt START BACKFILL if bkcnt gt 0 4 if previous value amp amp k gt 1 and gt 1 skipped minute amp amp SNObp SINTERPOLATEBPTOO 4 FORMAT TRANSLATION EZ XLATE 97 my bkval amp Backdatum j bkcnt QMID 4 last value if length bkval gt 0 amp amp bkval Nd tN Ndx numeric my delta v bkval k if abs delta 0 01 delta 0 01 prevent identical values nb for BPs IDAS my dc 1 amp Print n n BACKFILL at THISTIME col j n k
164. DAS 4 FORMAT TRANSLATION EZ XLATE 91 We address the need to be selective in our export by having in the CSV source directory a file datrules txt that provides rules for column selection The rules are formatted as follows 6 Conversion rules for CSV to DAT S D 0 SpO2 SpO2 SD 10 n HR HR S D 0 ETCO2 ETCO2 D 0 NBP NBP s NBP d NBP m In the above file always placed in the csv directory and called datrules txt all lines starting with are comments Other lines act as templates where D 0 is a place holder for the time and values in curly braces indicate the names of columns from which values will be obtained for every line i e for each particular time After substitution of values into the template a line is written to the destination file however if the value in the source is NA no line is written 4 2 1 Interpolation After some thought we have decided to provide minute by minute values This is because it would otherwise be trivially easy for assessors to distinguish between manual and automated records and knowledge of this distinction might affect their decision making more than the numbers We therefore interpolate values Our initial approach will be simple linear interpolation The schema is Establish a stack for each variable 2 Get values for a particular timestamp until the timestamp changes for each of the variables being examined Sto
165. DATA CAPTURE 15 Might also compare result to DURATION ReadFiO2andEtC02 PostProcess or fail Bad post processing WriteAllData or fail Data write failed Initialisation Here s the initialisation process ALLDATA contains descriptions of data at any time indexed by time as an integer routine SetInitialValues clear ALLDATA clear ZEROES Stack of zeroes clear YCALS stack of Y calibration values clear tCAL stack of time calibration values reference values CALA 59 0 61 0 GALB 56 3 58 3 CALC 83 8 85 9 ZERO l6 0 05 ZERO hi 90 05 NA 1 signals MAI U Z e NCLEAR lt 2 signals illegible datum ERO ZERO lo ZERO hi nd routine SetInitialValues Utilities Here s how we read a line routine ReadLine datum implicit linecount read line linecount increment linecount read line number if line number linecount gt fail Bad line number read datum from line return datum end routine ReadLine We require a Store routine 2 EZ CAPTURE MANUAL DATA CAPTURE 16 routine Store t y x ALLDATA t msg concatenate variables idx ALLDATA t concatenate x msg y f append value end routine Store We concatenate in a value to sort out the potential if infrequent problem where two data values are stored against the same time We migh
166. DURATION c lt int DURATION 4 5 t lt 0 while t lt c sp lt acquire allow NA or integer 0 100 Store t Sp t lt 645 end while E z P while t lt c et lt acquire as above Store t et t lt t 5 end while end routine ReadFiO2andEtCO2 Write data All data should now have been stored in the single dimensional array ALLDATA indexed by time in minutes The first time is zero signalling the start of data recording There may be missing data for a particular time and there is the possibility that two closely recorded values are registered under the same time We will next simply write all time data in order as a CSV file The format of the 2 EZ CAPTURE MANUAL DATA CAPTURE 19 output file is shown in Table 2 In order to output numeric values and what about precision we need to make the appropriate conversions using the calibration values Time NBP s NBP d HR SpOz ETCO NBP m rawSBP rawDBP rawHR 2008 12 14T10 23 00 120 70 72 99 NA 88 a b c 2008 12 14T10 28 00 123 66 72 NA 33 86 a b c Table 2 Output table format also CSV Note that in Table 2 we have renamed the systolic blood pressure NBP s and so forth This is for subsequent compatibility see code below routine WriteAllData caly GetYCalValue YCALS for each value and time in ALLDATA WarnAndExcludeDuplicates value rsbp rdbp rhr spo2 etc
167. ERSON instudy IS NOT NU Flatten SOLMa zB Subject ECT distinct sCode FROM SUBJECT ERSON person AND ONES SUBJECT subject AND b ORDER BY sCode 253 ANRECORD ONESESSION PERSON WHERE ESSION Anrecord ANRECORD anrecord ANI S Sqry EL Sassessors Sasslist nov create links supplying all 4 parameters print Scasecount i 0 while Slink print i y print nySQL handDB rtrim ConcatenateArray cases ECT person FROM PERSON WHERE P Flatten SQLManySQL handDB get cases remove terminal space qry ERSON instudy IS NOT NULL ORDER BY persor Sqry get assessors rtrim ConcatenateArray assessors ol sizeof cases 1 lt casecount ol print HTML3 table div lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 starting with 0 0 lt a href showcase php case i amp assessor O amp CASES S caselist amp ASSESSORS e li link li we use zero indexing 10 8 11 PHP analysis page one case Here s showcase php that is referred to in the preceding section Similar to show1 php it allows us to view each case assessor by assessor Much of the following code might be shared with the preceding PHP script header GLOBAL D require o Cache control
168. EY FETCH FAILURE Null Sky im print lt p gt Debug Key clash ky 4 debug only if locktime gt Snow if wrapped Snow 1000000000 if Snow S locktime gt FETCHTIMEOUT DoSQL handDB UPDATE UIDS SET auxSky u ky l uSky u ky 1 HERE aux ky locktime lock generator ff print lt p gt Debug unlocking generator ky locktime f debug only 4 next sleep a bit usleep rand 10000 up to 10ms Tu 2 if ok 4 if fail after MAXFETCHTRIES really fail die lt p gt Aagh key generation failed ky y f set the new value unlocking might simply use in the following DoSQL handDB UPDATE UIDS SET auxSky u ky l uSky u ky 1 12 ANCILLARY CODE 320 WHERE aux ky Snow release lock return 3 We might wish to use the TryDoSQL variant and print a reassuring warning instead of the more general failure of DOSQL in the last statement Note that in the above we return as the new key the original key value from the database not the incremented value as in our previous example The next fetch will retrieve this incremented value and so on Here s a variant of DoSQL which returns 1 on success O on failure without an error message function TryDoSQL handDB qry message return mysql_query qry handDB 13 LICENSING
169. EZ CAPTURE MANUAL DATA CAPTURE amp amp amp sub DoubleDigit if length i 5 return i y return O i 2 3 7 Error log DoubleDigit gh DoubleDigit gmi DoubleDigit int gs 1 concatenate 37 We need the error log for forensic purposes and debugging All debugging is written here unless logging is turned off in which case it s written to the console sub OpenLog my islog EZDI Sislog SEZDI if islog r my TODAY amp GetL my Slogfile EZD open LOGFILE gt logfile or print An Writing sub CloseLog my islog islog if islog _ close LOGFIL H R SRAWFILENAME TIMESTAMP R SRAWFILENAME STIMESTAMP eturn if not logging ocalTime IR log SRAWFILENAME capt S TODAY LOG die CRASH Could not open LOG logfile to log file logfile Here are the subsidiary routines sub GetLocalTime my sec min hour mday mon wday yday Syear Sisdst SAN 2 EZ CAPTURE MANUAL DATA CAPTURE 38 sec min hour mday mon year Swday yday isdst CORE localtime time Syear 1900 fix y2k Ssec amp DoubleDigit sec Smin amp DoubleDigit min Shour amp DoubleDigit Shour Smday amp DoubleDigit mday Smon amp DoubleDigit mon Smon january is zero
170. FORMAT TRANSLATION EZ XLATE sub TruncArray f brutal my 8D 6D _ my 6X my i 0 my f tr amp Print Mn Trunc 3 foreach f CD Str amp Trunc f amp Print lt f gt gt lt Str gt 3 X i tr Si bump index y return X sub Trunc my f f 8 if f dt d 6 if 6 digits or more Sf SEPSILON prevent massive truncation error if f dt d 6 in case return 1 y y if f Nd N Ndx my Spre 1 my post 2 while length post 6 post 0 return pre post D I if f Nd return 1 000000 D I return 52 unchanged A debugging print routine sub Print my p level f level is debugging level O none l overview p level 2 detail 3 pic 4 FORMAT TRANSLATION EZ XLATE 104 if SDEBUG gt level if level is 0 always print if SLOGPRINT print LOGFILE p return y print p f console print Here are our standard logging routines sub OpenLog my islog EZPATH LOCALFILE Sislog EZPATH SLOCALFILE _ 2 if islog return 4 if not logging my TODAY amp GetLocalTime my logfile EZPATH log LOCALFILE c24 TODAY LOG open LOGFILE
171. Fetch INARR SDEBUGGING print amp gt y SOUTA i SINARR idx Slasti Sidx Si Sidx SINARR Sidx 1 PHP y 51 0 now fetch last item while i lt 10 amp amp SINARR S i 5144 y lt 0 EFTINDENT SIDEWIDTH 5 Slasti unary minus fails TOPDOWN 5 BIGWIDTH 2 BIGHEIGHT 10 function to take 10 items and randomly assort them on the assumption that the submitted items are in pairs and that no two members of the same pair may be SDEBUGGING a pair r SDEBUGGING SINARR Sidx signal use the following prevents the last two being a pair if NotPair i lasti SOUTA 9 SINARR Si if SDEBUGGING print lt br gt last y else Sidx SOUTA 9 SOUTA Sidx SOUTA Sidx SINARR Si if SDEBUGGING print lt br gt last swop y D I int rand 0 6 999999 S x 1 of first 7 idx i 11 ACTUAL ENTRY OF DATA 267 return OUTA fetch item from 0 9 in INARR No pairing function RandFetch INARR Slasti DEBUGGING aagh 100 while Saagh gt 0 Saagh i int rand 0 9 999999 integer from 0 9 inclusive if SDEBUGGING print try Saagh i y if INARR i gt f not already used amp amp NotPair i lasti return i y try again extremely unlikely but i while 1 10 if SINARR i gt
172. G Durations don t match N DURATION this is tcorr 0 ESCOUNT 5 SEXITCODE SE Print n nExit code SSERIESCOUNT 0 durations don t match for given epoch hmm 2 35 FiO EtCO After determining the number of values to acquire which is simply the DURA TION measurement divided by 5 we acquire first SpO2 and then EtCO2 values if present allowing the user to enter NA values where appropriate 2 EZ CAPTURE MANUAL DATA CAPTURE 30 sub ReadSpO2andETCO2 my SEZDIR SRAWFILENAME SDURATION EZDIR SRAWFILENAME DURATION _ my numobs 1 int SDURATION 4 5 amp Print n n OBS COUNT numobs DURATION 1 1 spo2 SIDX 3 signal SpC2 open FILE EZDIR rawdata SRAWFILENAME spo2 csv or sDie Unable to open spo2 file rawdata SRAWFILENAME my hdr hdr lt FILE gt my 8SPO2 FILE 4 first line will be skipped close FILE my sz 1 S SPO2 if sz numobs not 1 as 54 balances header line SEXITCODE 8 signal problem with spo2 data count or use SSERIESCOUNT amp Print n nExit code 8 observationse numobs sz 0 y sXferData 6SPO2 2 etco2 SIDX 4 signal ETCC2 open FILE EZDIR rawdata SRAWFILENAME etco2 csv or
173. GIN3 close FI lt FILE3 gt lt FILE3 gt E3 print OGFILE n nDebugging C INDATA y AL DATA INDATA O IN2 iS m my ZEROE m m y tCAL y RYCALS y SCALA referenc values 59 07 o 333 SCALB Y y SCALAhi 61 0 50 37 lt SRAWFIL ENAME gt duration TRUEDURATN arguments SPARAMS 0 sequentially read in _three_ files SRAWFILENAME sbp csv SRAWFILENAME dbp csv SRAWFILENAME hr csv rawdata SRAWFILENAME sbp csv rawdata SRAWFILENAME dbp csv rawdata SRAWFILENAME hr csv discard first line 61N3 or amp Die Unable to open sbp f lt INDATA gt n n or amp Die Unable to open dbp 1 discard first line lt IN2 gt n n or amp Die Unable to open hr fi lt IN3 gt n n concatenate f SISIN 2 EZ CAPTURE MANUAL DATA CAPTURE 22 my SCALBhi 58 3 my CALClo 83 8 my SCALChi 85 9 my SCALDlo 43 9 added v0 53 my CALDhi 45 9 my SZEROlo 0 02 20 microns my ZEROhi 0 02 my CALA CALAlo CALAhi my GCALB CALBlo CALBhi my CALC CALClo CALChi my CALD CALDlo CALDhi my GZERO ZEROlo ZEROhi my RECORDTYPE my NA 1 my SUNCLEAR
174. GLOBALS php require once CONNECTIONPATH require ancillary php f used for GetSQL alone ShandDB eZ database connect if is null handDB print lt p gt lt b gt Connected to eZ database lt b gt else print lt p gt Database connection FAILEDx 2 gt 8 DATABASE DEFINITION lt p gt We now have an ope with a handle in i the database creation a function called lt b gt for the existence of doesn t exist lt php function is eZ popula query SELECT ui ok mysql_query we run return ok function batch sql st GLOBAL DEBUGGING q SELECT MAX me list METACOUNT here might confi ETACOUNT SMI Sfdata file fnam here process line In the call to F 175 n connection to the database handDB lt i gt Weill test to see whether script has already been run using is_eZ_populated lt b gt which checks the UIDS table and if the table the whole creation script ted ds FRO query handDB handDB UIDS WH F ERE uids ei atements handDB fname F tatable FROM ME Get SOL handDB rm that METACOUN ATABL Sq get max metacount is numericl D e slurp in array of lines s as per our usual parser Squery Di linecount 0 vhil FetchNextLin tchNextLin query is by
175. GuiCtrlCreateButton Get from SS Sx Tx pitch bigw h Dim sXML GuiCtrlCreateButton Convert to XML 2 hskip 7 Spitch Sbigw h Dim sCSV GuiCtrlCreateButton XML to CSV 3 Shskip 7x pitch Sbigw h Dim sDAT GuiCtrlCreateButton CSV to DAT 4 Shskip 7x pitch Sbigw h Dim 5555 GuiCtrlCreateButton Add to SS list 5e hskip 7 Spitch bigw h Dim REPL GuiCtrlCreateButton Replay via SS 6x hskip 5 pitch Sbigw h Dim bQuit GuiCtrlCreateButton Quit 6 Shskip 8 5 Spitch Sw h GUICtrlSetBkColor bQuit xFF0000 red button Dim bNew GuiCtrlCreateButton Nev case x 8 5 pitch Sw h GUICtrlSetBkColor bNev OXFFFFOO 77 yellow button mogrification buttons using ImageMagick Dim MOGm GuiCtrlCreateButton Mogrify 6x hskip 1x pitch bigw h 2 EZ CAPTURE MANUAL DATA CAPTURE 42 tick boxes Dim xSBP GUICtrlCreateCheckbox lx hskip 1 Spitch Dim xDBP GUICtrlCreateCheckbox lx hskip 2 pitch Dim xHR GUICtrlCreateCheckbox 1x hskip 3x pitch Dim xSpO2 GUICtrlCreateCheckbox lx x hskip 4x pitch Dim xETCO2 GUICtrlCreateCheckbox lx hskip 5 pitch Dim vSBP GUICtrlCreateCheckbox 2 7x hskip 1 5 16 Dim vDBP GUICtrlCreateCheckbox 2 7x hskip 2 pitch Dim SvHR GUICtrlCreateCheckbox 2 7x hskip 3x pitch Dim vSpO2 GUICtrlCreateCheckbox 2 7x hskip 4x pitch Di
176. HERE O rlimporta MANA SOL Sqry r flags rlimportance rAflags rTime rIcomment rAcomme nesession nce ignore artefacts anySQL ShandDB qry mansession AND rlimportance IS NOT NULL ORDER BY rImage FOR NOW markup for handwritten records Smanlen sizeof SMANA print lt lt lt HTML3 MANDIM manlen PHP fills in number MANUAL new Array MANDIM HTML3 SJsManu Sj 0 while j manlen Sr Flatten MANA j m0 An M new Array r 0 52111 521211 521311 1 521411 1 1 r15 m0 preg replace m0 scape any quotel m0 preg replace m0 nov can insert quotes SJsManu m0 10 WORKING PHP CODE 251 SJsManu An MANUAL j M ST Ek print JsManu write electronic array Sqry SELECT MIN onesession FROM ONESESSION ANRECORD SUBJECT WHERE ONESESSION Anrecord ANRECORD anrecord AND ANRECORD Subject SUBJECT si SUBUECT sCode thiscase AND ONESESSION Person thisass AND ANRECORD manual 0 list elesession GetSQL handDB qry get first electronic session mic Sqry SELECT rImage rIflags rlimportanc
177. HP CODE 256 WHERE Onesession elesession AND rlimportance IS NOT NULL ORDER BY rImage f rlimportance ignore artefacts FOR NOW SELECA SQLManySQL ShandDB qry get markup for electronic records eleclen sizeof ELECA print lt lt lt HTML3a ELEDIM eleclen ELEC new Array ELEDIM HTML3a SJsElec 3 0 while j Seleclen r Flatten S ELECA j m0 An M new Array Sr 0 5211 1 I r 211 1 r 311 521411 1 r 5 m0 preg replace NN m0 Scape any quote m0 preg replace N m0 now can insert quotes the above doesn t address any pipes in the original array SJsElec m0 SJsElec n ELEC j M0 j print usElec write actual images data print lt lt lt HTML4 next write top final background image handwritten record Writel 0 SImage0 XINDENT TOPGAP IMAGEW parseInt ISCALE IMAGEH 0 DrawMsg 1 XINDENT 77 TOPGAP 5 100 50 lt h3 gt Handwritten lt h3 gt transparent and overlay data WriteData XINDENT XLEFT TOPGAP parselnt ISCALEx 0 IMAGEW XLEFT 2 the background for the electronic record Writel 1 SImagel XINDENT TOPGAP VSEPARATION parselnt ISCALE IMAGEH IMAGE DrawMsg 2 XINDENT 77 OPGAP VSEPARATION parselnt ISCALE IMAGEH 5 100 50 WriteData 1 XINDENT XLEFT TOPGAP VSEPARATION parselnt ISCALE what about left panel w XI
178. IN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list SMYHEA ER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Add an anaesthetic 0 print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Administration Enter an anaesthetic lt title gt LINK href css eZstyle css type text css rel stylesheet script type text javascript 1 The following is clumsy and must be adjusted if nev fields are added This is not SOO12 ACTUAL ENTRY OF DATA function CheckInput myform errorcount 0 if ValidSCode myform scode 0 errorcount y if ValidDescription myform description errorcount y if ValidOperation myform operation errorcount 7 y if ValidAge myform ageyears 0 errorcount S y if ValidImageCount myform imagecount errorcount 7 y if myform gender selectedindex 1 errorcount s y if myform ASA selectedIndex lt 1 errorcount y if myform ASAE selectedIndex lt 1 errorcount E y if errorcount 5 0 if errorcount 1 294 alert Please complete relevant fieldsl You left out one else alert Oops Pleas
179. INDENT XLEFT TOPGAP VSEPARATION parselnt ISCALE what about left panel w XINDENT px end of main Javascript gt lt script gt lt head gt HTML4 10 8 10 PHP link page write list of cases Similar to writing list of assessors above Section 10 8 8 but by case we have view_cases php header Cache control no cache STHISPAGE viev cases php require_once ValidFx php our login validation script SMINUSERSTATUS eZ_ADMINISTRATOR_MIN SMAXUSERSTATUS EVERYONE Ssuccess validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS View assessments by case 0 E iz print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC N3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View assessments by CASE lt title gt LINK href css eZstyle css type text css rel stylesheet lt head gt lt body gt SMYHEADER lt p gt lt a href mainpage php Return to main page lt a gt lt h3 gt Select a case lt h3 gt HTMLI might share the following as common code with assessor page 10 WORKING PHP CODE Sqry 5 EL ONES ANRECORD cases Scaselist ESSION Person P
180. ING PHP CODE 229 lt td gt lt i gt Role lt i gt lt td gt lt td gt lt i gt Started lt i gt lt td gt lt td gt lt i gt Click here lt i gt lt td gt lt tr gt HTMLO Sactiveusers array gry SELECT distinct Person FROM PERSDATA WHERE PersonRole gt 0 Sactiveusers SQLManySQL handDB qry get active users Sactiveusers Flatten activeusers Susers GetLinkedUserDetails handDB activeusers lt a href eZ_do_editlogon php editlogon USERID gt Go lt a gt MyDoubleSort users 1 0 fsort by surname then forename PrintDetailTable users 5 f print table with 5 columns print lt lt lt HTML3 lt table gt lt div gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 10 WORKING PHP CODE 230 Backup data User Superuser Back up Back up all data CSV export When you save the file save the on nad file and do not view edit save it using Excel as Excel will likely subtly alter the format ootnote Especially timestamps causing pain Restore The following section must only be used to restore an uploaded CSV file over a brand new recreation of a database You will probably never have to use it The database name should be that of a CSV file already uploaded to the cw subdirectory Do not specify the suffix or the directory only the file name Database name Restore database The file name as u
181. LL rara dre SRM 13 Licensing 14 Hardware software useful files amp Change Log LI ChangeLog e esc eR aw eS ee Ae a A 14 2 Changes fof v 0 4 0 59 2 4 44 se eed Rx 143 Changes for v 054 059 ee ee ee o o RR 114 Changes Tar SUBO uou uuo Se OS eer Se AA a es 15 Still to Do Questions Ideas 301 301 301 302 302 303 303 303 304 304 305 305 305 306 306 307 307 307 308 308 309 312 312 312 313 314 314 315 316 318 321 326 328 336 336 336 336 1 INTRODUCTION 5 1 Introduction This is a suite of programs that accomplishes the following Reliable measurement of hand written anaesthetic records combined with recording of these measurements in the form of database CSV files that can be read by most database and analysis software Partial automation of the above measurement process with relevant checks Translation of CSV files into a data format DAT readable by the SAFER sleep IDAS program Sequential display of IDAS DAT files in a standard format familiar to anaesthetists who use the program for everyday patient data recording and display Sequential minute by minute capture of display screens from IDAS and storing of captured screens as PNG data files Sequential presentation of PNG images in real time or if desired faster by serving them up in a web page This application allows the anaesthetist to annotate the anaesthetic as it progresses Storage of annotations t
182. LOCATION E I 10 WORKING PHP CODE WHERE person OTHERLOGONID DoSQL ShandDB qry update user data Sqry UPDATE PERSON SET FirstQualified QUALYEAR WHERE person OTHERLOGONID DoSQL handDB qry set new qual yr list SROLETXT GetSQL ShandDB SELECT rText FROM PERSONROLE WHERE personrole SNEWROLE get role list SSPECTXT GetSQL ShandDB SELECT LocationText FROM CURRENTLOCATION WHERE currentlocation S NEWLOCATION get role list SLOCTXT GetSQL ShandDB SELECT SpecialText FROM CURRENTSPECIALTY WHERE currentspecialty SNEWSPECIALTY get role print lt lt lt HTML3 lt p gt Data have been updated for SOTHERFORENAME SOTHERSURNAME lt p gt Name is now SNEWFORENAME SNEWSURNAME role specialty and location are ROLETXT SPECTXT LOCTXT lt p gt lt a href eZ_do_edit php editperson OTHERLOGONID gt Back to previous page lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 10 WORKING PHP CODE Return to main page or Edit somebody s log in User Superuser Select a user sorted by surname Surname Role Lowes Forename Darran Mr 2000
183. LUE Go gt lt td gt lt td gt lt INPUT TYPE reset VALUE Clear Form onClick return ConfirmClear gt lt td gt lt tr gt lt table gt lt form gt body html HTML2 10 WORKING PHP CODE 217 Edit person s details User Superuser Log on password have been updated for user Johan van Schalkwyk Log on name is johanvs Return to main page Edit another logon Figure 7 Editing id password eZ do editlogon2 php The page which takes the new log on data and writes them to the database We accommodate encryption of both the supervisor password double md5 and of the new user password md5 xor ed with the md5 of the supervisor password header Cache control no cache f STHISPAGE ei do editlogon2 php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list SMYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Edit person s details 0 LT print HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt html lang en lt head gt lt title gt Edit person s details lt title gt LINK href css eZstyle css type text css rel stylesheet lt head gt lt body gt SMYHEADER
184. ME SDATETIME Snad SEZ_CASEDATE 6 6 Snad SEZ_CASETIME SVALIDITY nad EZ VALIDFLAGS SISLISTED nad S EZ ISLISTED SDURATION nad EZ DURATION more MainInterface userdll FILENAME SDATETIME SVALIDITY SISLISTED DURATION Wend DllClose S userdll P tidy up Exit 2 EZ CAPTURE MANUAL DATA CAPTURE 40 EZ Data Manipulation Case No 0012 21 12 2008 21 05 MANUAL RECORD Acquire using calipers keyboard Valid m pp V P H Parse tocSv F CSVtoDAT Add fo SS list spoz F LOG ETco2 M Replay via SS SAFERSLEEP RECORD Obtain from database Get from SS Convert to xa XML to CSV CSV to DAT a uu a i E k Add to SS list a i LOG LJ Figure 2 Ez Graphical user interface A sample screenshot of the main page is shown in Fig 2 and the Autolt code that creates it is as follows MainInterface make a comprehensive GUI Func MainInterface S userdll SFILENAME SDATETIME SGOODITEMS ISLISTED DURATION hskip 115 Spitch 60 Sh 40 Sw 70 Sbigw 100 Slabw 200 Sx 30 EZPATH ez Ur the following are flags that allow enabling of various buttons SFIVEITEMS bits set data ARE in contrast with SmISCSV SmISDAT SmISSS is manual name in SAFERsleep submission list
185. NDENT px end of main Javascri gt lt script gt pt 10 WORKING PHP CODE lt head gt HTML4 10 9 View artefacts 257 Here we display pairs of electronic and handwritten cases with all annotations of artefacts for that case Holding the mouse over the HTML display will pro vide further information about a particular annotation We identify artefacts by rlimportance being NULL header Cache control no cache GLOBAL SDEBUGGING require once ValidFx php our login validation script SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS f here obtain data images Review of data entry 0 E NOT likewis THAT THIS IS W case GET case casei Scasetl Scaselist GET CASES SCASES explode caselist nextcase case l if nextcase gt sizeof CASES nextcase 0 if wrap y Sthiscase SCASES case Snextlink write header reference to javascrip print HTML1 lt DOCTYPE HTML PUBLIC html lang en head ti LINK href css eZstyle css type tex W3C DTD HTML Im showartefacts php case nextcase amp CASES caselist tle gt View artefacts for
186. NG Similar names exist in the database LIST OF SIMILAR NAMES insert list of forename surname etc Are you sure you wish to add this person Do NOT add person YES Add person hr HEFER header Cache control no cache require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Adding new person 0 print HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt html lang en lt head gt lt title gt Administration Adding new person lt title gt LINK href css eZstyle css type text css rel stylesheet script type text javascript Se function CheckInput return true stub script 10 WORKING PHP CODE 207 lt head gt lt body gt SMYHEADER HTML0 SFORENAME POST forename SURNAME POST surname S
187. NOT add 1 establish current line my THISLINE my LINECOUNT 0 my LASTTIME 0 while SLINECOUNT lt SILEN for each line SLINECOUNT skip first line SINDATA SLINECOUNT my D split D amp TruncArray D convert to 6 decimals amp Print n nPARSING LINE SLINECOUNT MID index is MIDIDX data D 2 prank st ye candy for DOS interface my cols 1 S D 4 FORMAT TRANSLATION EZ XLATE 95 BP duplication test was here Wrong Moved down my STHISTIME amp ModJulian D 0 get date if STHISTIME lt 1 amp Die Bad Date THISTIME fatal y Print An Julian D 0 gt THISTIME 3 if SLASTTIME 0 SLASTTIME STHISTIME at start STHISLINE 0 THISTIME fill in date D I my dt 24 60 60 STHISTIME SLASTTIME delta time seconds hmm amp Print An Delta time dt IF ONE MINUTE ELAPSED store THISLINE TO MID SMIDIDX ve vill consider any time vithin 59 5s as to nov prior rows in MID have already been backfilled if dt gt 59 5 Write THISLINE to MID bump index SMID SMIDIDX amp Commaline GTHISLINE Print An WRITING LINE GTHISLINE 3 amp Print Nn WRITE MID LINE index MIDIDX at THISTIME delta dt value print 4 eye
188. NT px EPARATION parselnt ISCAL lt h3 gt Handwritten lt h3 gt Ex IMAG H IMAGI e 100 50 EH YBOTTO 3 transparent IMAGEW XLEFT 10 WORKING PHP CODE 261 11 ACTUAL ENTRY OF DATA 262 11 Actual entry of data 11 1 Assessment of records Here we take our file demo15 htm and PHP ise as the script eZ_assess php header Cache control no cache GLOBAL DEBUGGING require once ValidFx php our login validation script SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE Ssuccess validate_login SHOW_USER list SMYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS SMAXUSERSTATUS Review of data entry 0 first get person order in study if in study otherwise NULL Sqry SELECT inStudy FROM PERSON WHERE person SUSERKEY list SINSTUDY GetSQL ShandDB qry is person in study SMAXSESSIONS 10 default if strlen INSTUDY gt SMAXSESSIONS 24 if in study else SINSTUDY 0 D I here obtain 1 TOTALIMAGES 2 PATIENTID 3 CASENUMBER sequential for this assessor 4 NOTI SDEBUGGING 1 Gl Look for unfinished entry in ONESESSION for this user q SELECT Anrecord osCaseNumber FROM ONESESSION WHERE Person SUSERKEY AND
189. Nd 4 Nd 2 Nd 2 2 EZ CAPTURE MANUAL DATA CAPTURE 73 Print An WARNING Bad timestamp 565 0 print Xn Warning Bad timestamp lt Sts gt jd 0 else Sdd mm yy hr mi 1 2 3 4 S5 jd amp Julian yy mm dd hr mi 0 0 first check duration while DURATION 1 45 print An Oops Duration of lt SDURATION gt doesn t seem valid print n n Pleas nter the DURATION in minutes SDURATION lt STDIN gt y SDURATION 5 x int SDURATION 4 5 round up my tot 1 SDURATION 5 my c 56 print n n ENTER DATA Use the letter n for NA Use to skip back N x for no more N n for NA my badinp forced c 0 count t 0 time forced 0 while c tot St 5 3 6 if Sforced f timestamp too if jd gt 0 Syy mm dd hr mi ss gd Sdd mm Syy hr mi y print in Enter dattype value at t f here will validate spo2 etco2 Sinp lt STDIN gt chomp inp remove cr lf my Sv amp ValidParam Sinp dattype if v 1 SKIP BACK if c gt 0 1 Sess else print An Can t go back At amp Gregorian jd t 24x60 gd startl y again 2 EZ CAPTURE MANUAL DATA CAPTURE 74 elsif Sv 2 NA sStore c 1 4 1 signals datum NA
190. OST gender SASA POST ASA SASAE POST ASAE r Sanitise SCODE SCODE strtoupper SCODE if preg_match SNd 4 SSCODI E 11 ACTUAL ENTRY OF DATA 299 print lt br gt Bad data item amp 1t CODEsst readfile badcode htm exit D I Sanitise SDE Sanitise SOP CheckCode G SCRIPTION RATION ENDER Bad gender value f must be valid CJ CheckCode SAGE Bad age CheckCode IMAGES Bad image count CheckCode ASA Bad ASA CheckCode ASAE Bad ASA E value if SAGE 1 SAGE NULL if ASA 0 ASA NULL if SASAE 0 SASAE NULL r Sq SELECT list Solds if strlen print readfil exit else if SDE pr later subject FROM SUBJECT WHERE sCode SCODE GetSQL handDB q ensure subject doesn t exist olds gt 0 lt br gt Subject already exists amp lt Solds amp gt e badcode htm BUGGING int lt br gt Debug subject SCODE not found OK I might conceivably allow OVERWRITE yes fix me Sky FetchKey handDB Subject new key for Subject if DEBUGGING pr Jc q INSERT VALUES int lt br gt Debug SUBJECT key is
191. OW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Edit person s details 0 print HTMLO 23Noting that if the session were recorded and the user password subsequently was disclosed this would compromise the current administrator password so it s a good idea for the administrator to change their password often However if this session too had been captured the new password would also be compromised For better security it would be wise to incorporate a set of OTPs known only to the administrator and the database and use these for the XOR 10 WORKING PHP CODE 213 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Edit person s details lt title gt LINK href css eZstyle css type text css rel stylesheet lt script src js md5 js type text javascript script script type text javascript Ec function ConfirmClear if confirm Are you sure you want to clear the form Click OK to clear it return true y return false function CheckInput myform errorcount 0 errmsg mypwd myform mypswd value ulogon myform userlogon value pwdl myform newpasswordl value pwd2 myform newpassword2 value if NastyString mypwd errmsg errmsg You password does NOT contain cha
192. Preamble The licenses for most software are designed to take away your freedom to share and change it By contrast the GNU General Public License is intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This General Public License applies to most of the Free Software Foundation s software and to any other program whose authors commit to using it Some other Free Software Foundation software is covered by the GNU Library General Public License instead You can apply it to your programs too When we speak of free software we are referring to freedom not price Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software and charge for this service if you wish that you receive source code or can get it 1f you want it 13 LICENSING 322 that you can change the software or use pieces of it in new free programs and that you know you can do these things To protect your rights we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the software or if you modify it For example if you distribute copies of such a program whether gratis or for a fee you must give the recipients all the rights that you have You must make sure that they too receive or can get the source code
193. RE or die Cannot connect to database because mysql error if DEBUGGING print Xn You managed to connect to the database r if mysql select db anaes2 eZ handDB die You didn t manage to connect to eZ else if SDEBUGGING print You are connected to eZ return ShandDB Note that the relevant values for name_sysadmin and PASSWORDHERE must be inserted manually and the script then stored in the directory above the public_html directory on anaesthetist com eZ GLOBALS php The following are a few globals mainly constants required by our program The database time out precedes the cookie time out so we can identify the time out and generate an appropriate message 1 time out before forcing log off define eZ TIMEOUT 600x60 10 hours amended in v 0 52 again define COOKIE EXTRA WAIT 10000 before cookie expiry 6We are here taking the approach of running PHP under Apache rather than the optimal ap proach of running PHP as a CGI script 8 DATABASE DEFINITION 171 2 useful constants define SHOW USER 1 define 1 TRIES 1000 see usage define MAXKEY 100000000 likewise define FETC EOUT 2000 4 milliseconds 1 DO m bi H Z 3 Used to test status of person logging on define eZ ADMINISTRATOR MIN 128 define eZ ASSESSOR MIN 19 define
194. SELECT uSky FROM UIDS WHERE uids 1 get key value Skeyval the problem is here DoSQL handDB UPDATE UIDS SET u ky keyval WHERE uids 1 set new key value Fend atomic Skeyval return keyval The above doesn t cater for two competing processes and the requirement that such key increments must be atomic We therefore describe a generic mechanism for ensuring retrieval of sequential keys in an SQL database 12 7 1 The problem The problem is as follows 1 There is no standard mechanism for generating auto incrementing keys and most solutions require either proprietary modifications to the SQL standard or use of non core measures such as invocation of appropriate functions written in a language acceptable for extending SQL 2 If we try something along the lines of the above where two SQL statements are used with an intervening increment there are many potential points of breakdown As the two SQL statements with the intervening increment are not atomic another process can interrupt retrieving the same value and then can use this same key also writing the key value once more The po tential errors are numerous as even more than one process might interfere 3 Proprietary solutions exist which should allow the user to conjoin multiple queries into a single atomic statement but we wish for a more generic solution 12 ANCILLARY CODE 3
195. SION Person PERSON person inStudy IS NOT NULL SION person anrecord record gt 1 qry MANDIM manlen PHP fills in number MANUAL new Array MANDIM HTML3 SJsManu 3 while j lt manlen Sr Flatten MANA 3 m0 An M new Array r 0 r 1 l rl2 1 m0 preg replace NN m0 scap m0 preg replace mO SJsManu m0 SJsManu Xn MANUAL j M j Y print JsManu write electronic array Sqry SELECT rlmage rAflags 1 1 rTime PERSON person FROM RATING ONESESSION PERSON SUBJECT ANRECORD WHERE SUBJECT subject ANRECORD Subject AND ANRECORD anrecord ONESESSION anrecord AND RATING Onesession ONESESSION onesession AND ONESESSION Person PERSON person AND PERSON inStudy IS NOT NULL AND SUBJECT sCode thiscase AND ANRECORD manual O AND rlimportance IS NULL AND ONESESSION onesession NOT IN SELECT max onesession FROM ONESESSION PERSON WHERE ONESESSION Person PERSON person AND inStudy IS NOT NULL GROUP BY ONESESSION person anrecord HAVING count anrecord gt 1 ORDER BY rImage ISc 3 1 any quote now can insert quotes 239 get artefacts for handwritten records rAcomment I r 4 I I r 5 10 WORKING PHP CODE eleclen sizeof ELECA print lt lt lt HTML
196. SOTHERLOGONID gt table width 80 lt tr gt lt td width 30 gt a Alter surname lt td gt td width 70 input type text name newsurname Size 16 value OTHERSURNAME gt lt td gt lt tr gt lt tr gt lt td width 30 gt b Alter forename lt td gt lt td width 70 gt lt input type text name newforename Size 16 value OTHERFORENAME gt lt td gt lt tr gt lt tr gt lt td width 30 gt c Change role lt td gt lt td width 70675 SROLEPOPLIST lt td gt lt tr gt lt tr gt lt td width 30 gt d Change location lt td gt lt td width 70675 SLOCATIONPOPLIST lt td gt lt tr gt lt tr gt lt td width 30 gt e Change specialty lt td gt lt td width 70675 SPECIALTYPOPLIST lt td gt lt tr gt lt tr gt lt td width 30 e Year of qualification lt td gt td width 70 lt input type text size 5 name qualyear value SQUALYEAR gt lt td gt lt tr gt lt tr gt lt td colspan 2 lt INPUT TYPE submit NAME submit VALUE Go gt lt td gt tr lt table gt lt form gt lt div gt HTML3 print lt lt lt HTML8 lt p gt lt a href eZ_edit_person php gt Back to list of people lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html 10 WORKING PHP CODE 225 HTML8
197. STARTYEAR POST startyear SGENDER POST gender SPERSONROLE POST personrole SCONFIRM POST confirmation INSTUDY POST inStudy SCURRENTSPECIALTY POST currentspecialty SCURRENTLOCATION POST currentlocation if SINSTUDY Toni SINSTUDY NULL else SINSTUDY 1 y print lt br gt Debug In study SINSTUDY lt br gt Sanitise FORENAME Sanitise SURNAME CheckCode GENDER Bad gender value in the following NULL is returned on failure CheckCode PERSONROLE Bad role code CheckCodeNull CURRENTSPECIALTY CheckCodeNull SCURRENTLOCATION Ssimilarnames array null array if CONFIRM 1 don t check for similar names do nothing elseif SCONFIRM 0 check for similar names Ssur SURNAME sur strtoupper sur 4 upper case Ssimilarnames SQLManySQL handDB SELECT distinct Person FROM PERSDATA WHERE UPPER pdSurname sur OR UPPER pdForename sur 4 check for switch get identical surnames f might use more substantial algorithm soundex or better else readfile lostdata htm exit y nov insert OR confirm 10 WORKING PHP CODE 208 if count similarnames 1 f if ok simply store SNEWID InsertPerson ha
198. Se elsif v 3 forced Sforced 1 elsif Sv 0 print n Oops Invalid parameter Sinp n Please tr else amp Store c inp store value c else IS FORCED sStore c 1 if force rest to NA c Tt y y sub ValidParam my inp dattype Sinp dattype 8 if inp return 1 if inp n i return 2 if inp x i return 3 if inp 17 wx dt d w is it numeric allov vhitespace return 0 fail if dattype eq spo2 if inp 50 Sinp gt 100 return 0 y elsif dattype eq etco2 if imp 1 Sinp gt 100 bugger need to address mmHg vs kPa FIX M E 2 EZ CAPTURE MANUAL DATA CAPTURE 75 return 0 or varn and confirm if gt nnn else amp Die Bad parameter type dattype y return 1 The repetitive Julian and Gregorian routines follow sub Julian my fy fm 524 fh fmi fs Sff Sfy Sfm fd fh fmi 525 Sff Q my Sf f 367x fy int 7x fyrint fmr9 12 4 int 3x int fyr fm 9 7 100 1 4 b int 275 Sfm 9 f d 1721028 5 Sfh Sfmi 5254 0 ff 60 60 24 return f sub Gregorian my jd 3d _ my SEPSILON 0 000001 jd SEPSILON Z R G SA B C year month day Y Y Z floor jd 1721118 5 E e ER NK SG 52 0 25 A floor G 365
199. State caseID GUI FOCUS fix mouse focus problem hack EndIf EndIf WEnd EndFunc Subsidiary functions The following functions are used above Func ValidateAllInputs casenumber casedate casetime Send If StringLen casenumber lt gt 5 Then sgBox ONTOP Woops Case number must be 5 characters long No blanks Return 0 EndIf If StringLen casedate lt gt 10 Then sgBox ONTOP Woops Date must be in the form dd mm yyyy amp casedat Return 0 EndIf If StringLen casetime lt gt 5 Then sgBox ONTOP Woops Start time must be in the form HH MM caseti Return 0 EndIf If StringLen end lt gt 5 Then sgBox ONTOP Woops End time must be in the form HH MM amp Send amp Return 0 EndIf jstart ValidTimestamp casedate casetime julian date If jstart 0 Then MsgBox ONTOP Bad date Please check date time amp casedate amp amp Scasetime Return 0 EndIf Sjend ValidTimestamp casedate Send If jend 0 Then MsgBox ONTOP Bad end time Please check time amp amp casetime Return 0 EndIf here calculate duration MsgBox ONTOP Debug Difference between amp jend amp and jstart duration jend jstart If duration 0 Then next day Sduration duration 0 5 EndIf 2 EZ CAPTURE MANUAL DATA CAPTURE 6
200. T document write onSubmit return DoSubmit document write lt input type hidden name WebDataString id WebDataString value document write lt input type hidden name FinalRank id FinalRank value gt document write lt input type hidden name WebKeyData id WebKeyData value document write lt input type hidden name FinalTime id FinalTime value document write lt input type hidden name FinalManual id FinalManual value document write lt input type hidden name FinalSeenBefore id FinalSeenBefore value gt document write lt input type hidden name FinalChoice id FinalChoice value document write lt input type hidden name PatientId value PATIENTID document write lt input type hidden name StartTime value MYSTARTTIME hmm fix me there s a problem if reload need to reload this timestamp function EndForm document write lt FORM gt lt body gt function WriteSidepanel x y w h all values are in pixels px eg 10 1 114 480 document write lt div id leftPanel align center document write Style position absolute top y document write px left x document write px width w document write px height h document write px visibility visible background color f4EEEEEE z index 1 document write lt a
201. TATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Review of data entry 0 print HTMLO DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN html lt head gt lt title gt Review of demonstration file lt title gt lang en gt LINK href css eZstyle css type text css rel stylesheet sc lt fun ript type text javascript ction CheckInput 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION return gt lt script gt lt head gt lt body gt SMYHEADER HTMLO true SWHOLESTRIN SPATIENTID SSTARTTIME POS SFINALRANK SMANUALORAUTOMATIC SSEENBEFORE SCHOICE SFINALTIME SWEBKEYDATA Q ll SPATIENTID SSTARTTIME SFINALRANK Sanitise Sanitise Sanitise SSEENBEFORE Sanitise CHOICE Sanitise FINALTIME Sanitise SWEBKEYDATA can t yet sanitise Sanitise CheckCode SFINALRANK Q CheckCode SE stub Sanitise SMANUALORAUTOMATIC heckCode MANUALORAUTOMATIC ENBEFORE r POST WebDataString POST Patientld rf StartTime POST FinalRank POST FinalManual POST FinalSeenBefore POST FinalChoice POST FinalTime POST WebKeyData
202. TH ez 2 EZ CAPTURE MANUAL DATA CAPTURE Dim validflags 31 Set invalid 62 Dim Sislisted 0 l manual file listed m 2 ss file listed s Dim mygui GuiCreate Enter Case Number 720 600 40 10 VS CAPTION 515 EX TOPMOST FONT Sfont Comic Sans MS GUISetFont 9 400 1 Sfont Size 9 font File name labels GuiCtrlCreateLabel Pleas nter case number e g S0001 Sx y pitch ux4 h Date and time iCtrlCreatelabel x y 2 3x pitch Other labels iCtrlCreateLabe Sx Sy 4 3x pitch Swx4 Sh iCtrlCreateLabel Briefly describ vv Gu Enter anaesthetic date S wx 5 h E E Gu 7 qn DD MM YYYY start time hat surgery was performed Sx Sy 6 3x pitch Swx4 Sh text Dim casel myDATI myTIM GuiCtrlCreatelnput GuiCtrlCreatelnput GuiCtrlCreatelnput Dim SX Ta pm Xx Dim Dim myEND GuiCtrlCreateInput Nature of surgery Dim mySURGERY GuiCtrlCreateInput Patient description Dim myDESCRIPTION GuiCtrlCreateInput Done BUTTON Dim SbuttonID GuiCtrlCreateButton Done GUICtrlSetBkColor SbuttonID x00CC00 IMAGE not now Dim picID GU Pr 550 GuiCtrlCreateButton Quit bQuit OxFF0000 5 E 50 Dim bQuit GUICtrlSetBkColor LOOP GUI MESSAGE xt skip 2
203. The Y calibration value in mm represents 200 units so to get a conversion factor divide 200 by the average value sub GetYCal my SSRECORDTYPE amended v0 53 SRECORDTYPE _ my d Stot n Stot 0 0 n 0 foreach d YCALS 2 EZ CAPTURE MANUAL DATA CAPTURE 35 if length d gt 0 should always succeed tot d n y if n lt 1 most strange amp Die Odd No Y calibration values can this occur im amp Print n Y calibration total tot counte n 1 if SRECORDTYPE ne D return 200 0 tot n return 160 0 tot n for type D restricted range y We also need time manipulation routines Julian returns a Julian day float given year month day etc Gregorian does the reverse Note that IDAS doesn t seem to address issues of daylight saving i e the hour that is lost and the groundhog hour sub KiwiAddMinutes input format is DD MM YYYY HH MM aagh output as international date my ts min Sts min 0_ my yy mm dd hr mi ss if Sts 1 d 2 d 2 N Nd A4 Nd12 Nd1 2 sDie Bad Date ts Kivi format DD MM YYYY HH MM y Sdd mm yy hr mi 1 2 3 4 5 my gooddate Syy mm dd hr mi 00 Print An Input date lt Sgooddate gt adding min min 3 f amp Julian yy mm dd hr mi 0
204. Then FileNriteLine logname Searching for amp what EndIf Read in lines of text until the EOF is reached Slcount 1 While 1 line FileReadLine file If error 1 Then ExitLoop end of file 1n StringSplit line If Sln 1 vhat Then 2 EZ CAPTURE MANUAL DATA CAPTURE 56 If DEBUG 3 Then FileNriteLine logname Found at line amp lcount EndIf FileClose file Return lcount EndIf If SDEBUG 3 Then FileWriteLine 1ogname Comparing amp line EndIf lcount lcount 1 Wend If SDEBUG 3 Then FileWriteLine logname Not found EndIf FileClose file Return 0 not found EndFunc 2 4 3 Advanced Datum acquisition Similar to our basic schema we here obtain just one data set for one of SBP DBP or HR We initialise data fetch and wait for Excel When invoked after a sufficient wait we save the file in the format X0001 sbp csv where X0001 represents the case number and the suffix is one of sbp dbp or hr We start each set with a zero and Y calibration Note that with the final HR acquisition alone we must perform a terminal zero calibrate and x determination Func GetSequence seqname FILENAME DATETIME FAKEDCMS EZPATH ez SPATHNAME EZPATH amp ravdataN SFILENAME FILENAME amp seqname 6 csv 77
205. WinWaitActive Edit Patient Send Demo 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 110 Sleep 50 Send TAB Sleep 50 Send SCURRENTFILE Sleep 50 Send TAB Sleep 50 Send 26 12 1900 Sleep 50 Send TAB Sleep 50 Send F Sleep 50 Send TAB Sleep 50 Send ENTER Sleep 500 SMAINWINDOWNAME SAFERsleep amp FAKENHI 5 e g SAFERsleep SSS0012 7 MsgBox SONTOP Debug Wait for main window amp SMAINWINDOWNAME If WinExists SMAINWINDOWNAME Then sgBox ONTOP Error Window not found lt amp SMAINWINDOWNAME amp gt T Exit Else MsgBox ONTOP Success Sleep 3000 fe just in ga EndIf WinActivate MAINWINDOWNAME ControlClick SMAINWINDOWNAME Demo S0012 s Anaesthetic chart xDEMO MODE Window found amp SMAINWINDOWNAM se Gl t CLASS TcxCustomComboBoxInnerEdit INSTANCE ic MouseClick left 132 352 Send HOP Send g debug name Send ENTER Start anaesthetic Sleep 1000 next get parameters for on test station ugh main vindov Sxy WinGetPos MAINWINDOWNAME gt x y w h SWINX Sxy 0 5 SWINY xy 1 0 14 Sxy 3 SWINW xy 2 0 83 SWINH xy 3 x 0 85 SWINH2 xy
206. a rtn Else 6 FILENAME amp to playlist Case msg sGET perlok RunWait GComSpec 6 c perl amp _ SEZPATH amp ez xlateNgetcrypt pl _ amp SFILENAME amp connect string txt debug 3 logprint 1 SEZPATH If perlok 0 Then MsgBox ONTOP Note Retrieval was successful TestFile sXML EZPATH 6 iar FILENAME iar Else MsgBox ONTOP Problem See log Return code was amp perlok EndIf Case msg sXML GuiSetState SW_MINIMIZE If Iar2Xml SEZPATH SFILENAME 1 Then failure MsgBox SONTOP Oops There seems to have been a problem See the LOG 2 EZ CAPTURE MANUAL DATA CAPTURE 48 MsgBox ONTOP Note Apparent success TestFile sCSV SEZPATH amp xml FILENAME xml EndIf GuiSetState 8SW RESTORE Case msg SsCSV MsgBox ONTOP Test XML to CSV perlok RunWait ComSpec 6 c perl amp SEZPATH 6 ez xlateNez xml2csv pl _ amp SFILENAME amp debug 2 logprint 1 EZPATH If perlok 0 Then MsgBox ONTOP Note Conversion was successful TestFile sDAT EZPATH amp csv SFILENAME s csv s is for safers Else MsgBox ONTOP Problem See log Return code was amp perlok EndIf Case msg sDAT perlok RunWait GComSpec c perl amp SEZPATH amp ez xlatelez csv2dat pl
207. abase L 2o 4 6446644544565 169 CONTENTS 8 12 PHP Creating the SOL database ed 8 12 1 Database creation script ooo co rs 8 13 Upgrading the database 9 PHP access coding SI LAO san RO A ok Kobe a 9 1 1 IhnitialLogon php oboe ode xen ede OES 2 1 Ro 409 e E RR BU 91 3 Javascript hie dO RR EEG 2 Vald PT 9 3 Logging out logout php Lu ux ode Sox dnd 10 Working PHP code 10 1 The main page mainpage php 10 2 Assess an anaesthetic LU s moos coole e 10 21 Demonstration page RR 10 12 Actual assessments 222044 xoxo 9 8 ox e x ei 10 3 Entering aperso 2 4 6 a a A 10 4 Editing 1og on details 10 5 Editing someone s details cs cd cee RE RR Rd 10 6 Editing log on details 2 22m R9 E TEA 105 Viewing UNA so eco eds aeg ls ds 10 8 1 eZyiewphp accord EES 10 8 2 View number of assessments 10 8 3 An overview of session assessments 10 8 4 View all ratings 10 8 5 Graphical view of a case 10 8 6 Graphical view of assessments test page 10 8 7 Javascript for analysis eee ee Re we i 10 8 8 PHP link page write list of assessors 10 89 PHP analysis page one assessor 2 es be ees 10 8 10 PHP link page write list of cases 10 8 11 PHP analysis pase one case e
208. accordingly modified the SQL for creation of the UIDS table in previous versions all of the aux columns in UIDS were varchar 32 but now they are simple integers See Section 8 9 Now we can set about fetching a key We assume the existence of the constants MAXKEY for example set at 1 billion MAXFETCHTRIES perhaps 1000 and the FETCHTIMEOUT set at say 2000 milliseconds function FetchKey handDB ky Snow MAXKEY ModTimeNow 4 MAXKEY prevents collision ff print lt p gt Debug time modification is I novl Scount 0 Sok 0 while Sok amp amp Scount lt MAXFETCHTRIES Scount Sq UPDATE UIDS SET auxSky Snow 211f the database used doesn t support integer values up to 9 digits then the code might need to be modified ever so slightly 12 ANCILLARY CODE 319 WHERE aux ky uSky Sok TryDoSQL handDB q lock generator Tir print p Debug attempt vas amp lt q amp gt giving ok f problem is succeed if no rows updated thus if Sok if apparent success q SELECT u ky FROM UIDS WHERE auxSky Snow list j GetSQL handDB 54 get new key Ti print lt p gt Tried 1t q8gt giving 1 if strlen j 1 Sok 0 y if ok f if failed list Slocktime GetSQL handDB SELECT auxSky FROM UIDS get lock time if strlen locktime lt 1 die lt p gt K
209. adfile oopsl htm print msg readfile oops2 htm 9 PHP ACCESS CODING 196 9 3 Logging out logout php STHISPAGE f irrelevant require ValidFx php our login validation script Ssuccess validate login SHOW USER f gt SUSERKEY handDB SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Logging out 0 nov SUSERKEY handDB set so clean up DB log out setcookie eZ SID time 100 f clear cookie qry UPDATE PERSON SET pSID NULL pExpiration 0 WHERE person SUSERKEY handleQ mysql_query qry handDB if handleQ 4 hmm debugging only print lt br gt Logout error user key was amp 1t SUSERKEY gt mysql error y mysql close handDB print HTML1 lt DOCTYPE HTML PUBLIC lt html lang en gt lt head gt lt title gt Log out from eZ lt title gt css type text css LINK href css eZstyl head SMYHEADER p Logged out W3C DTD HTML 4 01 Transitional EN gt rel stylesheet Thanks for using eZ lt p gt lt a href login php Click here lt a gt to log in again HTML1 10 WORKING PHP CODE 197 ez Z Assess Anaesthetics Online
210. al problems To run the program needs to write a small temporary cookie to your machine This does not compromise your security cookies on your machine In order to lt i gt display lt i gt the program adequately we recommend a screen resolution of 1024 amp nbsp x amp nbsp 768 but we haven lower resolutions you ll have to fuss with scroll bars and at far higher resolut too small for comfort 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 129 lt ul gt lt p gt If you ve navigated here from the Web and wish to go to the main page click otherwise simply close this tab as it was opened by the main page If you re 1 it may not be wise to close the whole window just close the lt i gt tab lt i gt lt p gt lt div align center table width 150 border 5 cellpadding 4 cellspacinge 4 bgcolor FOF8FF gt lt tr gt lt td align center a href mainpage php Go to the main page lt a gt lt td gt lt tr gt lt table gt lt div gt lt p gt lt div align right gt Jo van Schalkwyk January 2009 lt div gt lt div gt lt html gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 130 7 2 Javascript Here s the javascript that services the above It makes use of numerous global variables Smarter might be to create an object and attach these to the object which we could then pass around the globals work fine however The central and most important count
211. am Files Safer Sleep IDAS Client IDAS exe If FileExists Sidaspath 0 Then sgBox ONTOP Error IDAS exe not found amp idaspath Exit EndIf Run Sidaspath If WinWaitActive SAFERsleep 30 Then allow 30s for boot sgBox ONTOP Error Failed to load SAFERsleep Exit EndIf If STESTNOSERVER 1 Then Sleep 15000 clumsy wait for IDAS If WinExists Information Then WinActivate Information Send ENTER this is for the bloody INFORMATION box if cannot connect to server Else MsgBox ONTOP Dx Info box NOT detected Click OK Send ENTER allow manual wait or not EndIf EndIf WinWait SAFERsleep Login Screen If WinExists SAFERsleep Login Screen Then MsgBox ONTOP Dx Login Screen detected Send ENTER Hit enter at Login screen Sleep 2000 wait for screen to appear WinActivate SAFERsleep Login Screen WHY DOES THE FOLLOWING FAIL at work ControlClick SAFERsleep Login Screen E CLASS TcxButton2 INSTANCE 2 noo Guest login MouseClick left xguest yguest 1 ugh Else MsgBox ONTOP Dx Login Screen NOT detected Click OK Send ENTER Hit enter at Login screen EndIf Sleep 3000 If WinExists Information Then M
212. ar mc new myCookie 0 time is zero alert Debug Total cookie is lt c var i c indexOf cname itf GE 40 alert Debug Not found cookie cname return mc time is zero var mine c substring 1 i cname length i mine indexOf if i gt 0 otherwise take the whole string mine mine substring i y 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION alert Debug Found mine i mine indexOf 6 1st is start image No if i lt 0 dud alert Bad cookie mine return mc y mc time parseInt mine substring 0 i mine mine substring i 1 i mine indexOf 86 2nd timestamp if i lt 0 dud alert Bad cookie TIME mine return mc y mc startup mine substring 0 i mine mine substring i 1 i mine indexOf 8 3rd keydata if i lt 0 dud alert Bad cookie KEY DATA mine return mc y mc keydata mine substring 0 i mc value mine substring i 1 return mc given hex data string strip off elements and store in global array WEBKEYDATA function FillKeyArray kdata kl kdata length i alert DEBUG reloading kdata while i kl v kdata substring 1 1 2 get 2 hex characters hi lo v parseInt Ox v WEBKEYDATA i 2 v alert debug value of 1 2 is v i 2
213. art time FillKeyArray cooks keydata populate WEBKEYDATA x x HERE SET UP SO THAT SCREEN WILL BE OK xxxxx RELOADED 1 cooks time change the displayed image to restarting where you left off MYIMAGES 0 src images RESTART png y ONEMINUTE 60000 ONESECOND 1000 MINUTETIMER vitally important GLOBAL AAGH likevise MYCLOCK new Array 12 TICKER 0 TICKTIME ONEMINUTE 12 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 131 QUICKTIME ONESECOND 12 CLOCKTICK LoadClock MODIM parseInt TOTALIMAGES 11 12 fix up v0 50 no overtick addLoadEvent PreloadImages set up preloading nu event loader 8es function addLoadEvent func var oldonload window onload if typeof window onload function window onload func else window onload function if oldonload oldonload func Vip Semi REA dynamic layer generation make n 1 superimposed transparent layers of z index 2 n the layer ids are XLayer2 to n thanks to http www foxglove co uk Javagen index htm demos function genlayers n x0 y0 w h for var k 1 k lt n k k 1 document write div id XLayer document write k document write style position absolute background color transparent left document write x0 document write px top documen
214. assessor and insert a GET link to permit display of subsequent cases for this assessor header Cache control no cache GLOBAL DEBUGGING require once ValidFx php our login validation script SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success MINUSERSTATUS MAXUSERSTATUS Review of data entry here obtain data assessor images S view assessors Sassessor GET assessor Scase GET case Scasei Scasetl Sasslist _GET ASSESSORS space delimited no terminal space SASSESSORS explode asslist Scaselist _GET CASES likewis SCASES explode caselist nextcase case l if nextcase gt sizeof CASI nextcase 0 wrap im thiscase CASES casel thisass SASSESSORS Sassessor Snextlink showl php case nextcase amp assessor assessor amp CASES caselist amp ASSESSOE E 5 write header reference to javascript print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt View pair for one assessor lt title gt LINK href css eZstyle css type text css rel stylesheet lt link type text css rel styles
215. ay a work containing the Program or a portion of it either verbatim or with modifications and or translated into another language Hereinafter translation is included without limitation in the term modification Each licensee is addressed as you Activities other than copying distribution and modification are not covered by this License they are outside its scope The act of running the Program is not restricted and the output from the Program is covered only if its contents constitute a work based on the Program independent of having been made by running the Program Whether that is true depends on what the Program does 2 You may copy and distribute verbatim copies of the Program s source code as you receive 1t in any medium provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty keep intact all the notices that refer to this License and to the absence of any warranty and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy and you may at your option offer warranty protection in exchange for a fee 3 You may modify your copy or copies of the Program or any portion of it thus forming a work based on the Program and copy and distribute such modifications or work under the terms of Section 1 above provided that you also meet all of these conditions
216. ay 4 new Array 224 19 96 this c array 5 new Array 80 159 144 this c array 6 new Array 207 88 95 this c array 7 new Array 64 135 96 this c array 8 new Array 239 60 195 this c_array 9 new Array 144 151 80 this c_array 10 new 255 136 80 this getColor function if this ct 5 this c array length 1 this ct 0 else this ct return d2h this c_array this ct 0 this add function x_name value this x name push x name this data push parseInt value 10 this max parseInt value 10 d2h this c array this ct 1 d2h this c array this 11 ACTUAL ENTRY OF DATA this fillArc function x y r st a en a jg var number of steps Math round 2 1 Math PI x r var number of steps en a st var angle increment 2 x Math PI number of steps var xc nev Array var yc new Array st r st axMath PI 180 en r en axMath PI 180 for angle st_r angle lt en_r angle angle_increment if en_r lt angle angle_increment angle en r var y2 Math sin angle r var x2 Math cos angle x r xc push x x2 yc push y y2 jg drawLine x x2 y y2 x x2 y y2 xc push x yc push y jg fillPolygon xc yc jg setColor black jg drawLine x y x ln x y ln y this render function canvas title var jg new jsGraphics canvas va
217. ay be best to use a counter and associative array assuming that a later time contained in the file is always later in time than any earlier one and associating a monotonically increasing count with each new time 4 FORMAT TRANSLATION EZ XLATE 84 4 Identify the first label create an array for it and work through the entire XML file snipping out each time label value triplet Look up the time in ALLTIMES obtain an index and store the value at that index in the array for this label Warn if duplicate values are encountered for a particular time 5 Repeat the preceding step for all labels 6 Write the header 7 For each time obtain values for all label arrays in turn writing NA if no value exists and write the time and values in CSV format Note that pressure values are compound and should be split up into three components So for example NBP lt data gt lt time gt 2008 03 31T10 24 13 lt time gt lt label gt NBP lt label gt lt value gt 119 000000 57 000000 77 000000 lt value gt lt data gt should be turned into three NBP sys NBP dia and NBP mean in the fi nal translation one value becomes three columns We must code for this and potentially for other similar pressure readings When we translate from CSV to DAT we will need to identify such values and re translate accordingly f Perl program to translate anaesthetic monitor data from XML to CSV format usr local bin perl w
218. backup fnm EZPATH amp rawdataN FILENAME amp spo2 csv FileCopy fnm fnm amp BAK 1 overwrite if exists EndIf EndIf If overv 1 Then GuiSetState G8 SW MINIMIZE If GetKbSequence spo2 FILENAME DATETIME DURATION 1 Then myCheck xSpO2 SFIVEITEMS BitOR SFIVEITEMS 8 EndIf GuiSetState 80SW RESTORE EndIf Case msg SbETCO2 Soverw 1 If IsRawFile etco2 FILENAME 1 Then Soverw MsgBox ONTOP 1 Warning _ Rav ETCO2 data already captured Overvrite If Soverw 1 Then cancel 2 create single backup Sfnm SEZPATH rawdataX FILENAME amp etco2 csv FileCopy fnm fnm amp BAK 1 overwrite if exists EndIf EndIf If overv 1 Then GuiSetState G8SW MINIMIZE If GetKbSequence etco2 FILENAME DATETIME SDURATION 1 Then myCheck xETCO2 SFIVEITEMS BitOR SFIVEITEMS 16 EndIf GuiSetState G80SW RESTORE EndIf Case msg SmCSV perlok RunWait GComSpec amp c perl amp _ SEZPATH 6 ez capturlez captur pl _ s SFILENAME amp SDATETIME amp amp SDURATION EZPATH If perlok 0 Then MsgBox ONTOP Note Conversion was successful TestmDAT mDAT SEZPATH SFILENAME m check if can enable Else sgBox ONTOP Debug Return code was amp perlok here might check that target csv file exists and 2 EZ CAPTURE MANUAL DATA CAPTURE 47 last 5 b
219. bility hidden function ShowThanks ann if ann 1 ReplacelnnerText thanks1 Thanks Recall that your intervention won t influence the record else ReplacelnnerText thanksl Thank youl y document getElementByld thanks1 style visibility visible DATA RECORDING note use of ALLWEBDATA function Intervene HideThanks NextOff ArtOff ClearMinTimer StopClock setTimeout ClearMinTimer 2000 just in case clear set by NEXT MessagePaused TIMESTAMP GetTimestamp document getElementById myBackground style visibility visible RevealTopInputs function ShowTheRest ixa document myform fluid checked ixb document myform analgesia checked ixc document myform vasocons checked ixd document myform inotrope checked ixe document myform bblock checked ixf document myform incvent checked ixg document myform decrvent checked ixh document myform upfio2 checked ixi document myform iother checked if ixa 0 amp amp ixb 0 amp amp ixc 0 amp amp ixd 0 88 ixe 0 66 ixf 0 66 ixg 0 66 ixh amp amp ixi 0 alert Please select an interventionl return false y 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 139 if ixi 0 firstcomment NoPipes document myform intervent
220. c print lt td gt y print lt tr gt y print lt table gt print lt lt lt HTML5 lt hr gt lt div align center gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 157 lt p gt lt b gt Thank you for your contribution lt b gt lt p gt lt a href mainpage php Go back to MAIN PAGE lt a gt lt body gt HTML HTML5 8 DATABASE DEFINITION 158 8 Database definition The database is written in SQL and implemented on the Web using mySQL We have elsewhere discussed our method for partially automating capture of data on manually written anesthetic records Here we take these data and run them through the SaferSleep process We capture the resulting screens as PNG graphics and then display the graphics on the web An anaesthetist scrolls through such a graphic record sequentially and indicates points of significance where she he would likely have intervened given their basic knowledge of the anaesthetic and prior data on the display Where someone has already intervened based on the record a subsequent intervention should only be in the context of the previous intervention having been performed when they stated they would have intervened EXPLAIN BETTER The SQL database is loosely based on the one we created for the STrICT study We write the file to ez shw php sql eZ sgl We kick off with a table of tables which lists all of the tables within the database in the order in which the
221. candy SMIDIDX Remember current systolic diastolic if STHISLINE SiSBP Nd if valid BP in line hmm SlastSBP STHISLINE SiSBP keep last values vritten y if STHISLINE SiDBP Md if valid BP in line hmm SlastDBP STHISLINE SiDBP 4 y 3 0 while j lt cols f clear thisline j STHISLINE j ugh y fill in extra interpolative LINES if needed while dt gt 119 5 SLASTTIME 1 60x24 4 add a minute STHISLINE 0 SLASTTIME SMID SMIDIDX amp Commaline GTHISLINE blank line apart from times amp Print n SMID SMIDIDX 2 print 4 SMIDIDX 4 FORMAT TRANSLATION EZ XLATE 96 dt 60 D I SLASTTIME THISTIME STHISLINE 0 THISTIME stor datel NOW write values from D to THISLINE If similar time may STILL need to extract values But first suppress problem with duplicate recording of BPs SthisSBP D iSBP SthisDBP D iDBP if thisDBP d ensure numeric amp amp SthisSBP lastSBP amp amp SthisDBP SlastDBP identical numbers ASSUME duplicate values from IDAS repeated interrogation of NIBP SD SiSBP SD SiDBP NA SD SiMBP NA force interpolation Print An Debug xx DUPLICATE BP DELETE
222. ch strAl lgthl SichB Fixch S strB lgth Sc Unfix ichA SichB Souts c Souts clumsy y return outs function Fixch c f convert hex digit to hex value i ord c convert chr to integer if i 5 90 Ox5a if lover case i 32 0x20 i 48 0x30 if i gt 9 i 7 return 1 actual hex value function Unfix i convert hex value to hex digit if Si gt 9 Si 3247 FORCE lower case as in md5 Si 48 return chr i 10 WORKING PHP CODE 220 2 Edit somebody s details User Superuser Return to main page Select a user sorted by surname Forename Surname Role Started Darran Lowes superuser 2000 Mr Superuser superuser Return to main page Figure 8 Editing a person s details 10 5 Editing someone s details Here we have the facility to edit a person s details This introductory page eZ edit person php allows us to select a particular person When the administrator clicks on a link control is transferred to the page eZ do edit php header Cache control no cache STHISPAGE Tei edit person php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Edit somebody s
223. ch sql statements handDB sql eZ sql print p SUCCESS eZ database created print lt p gt lt a href login php GO THERE lt a gt here should commit mysql_query COMMIT ShandDB 8 DATABASE DEFINITION 174 but mySQL auto commits by default ugh else print lt p gt ERROR Failed to create eZ database else print lt p gt eZ database already exists Duh y mysql close handDB removed keep database open D I EE The above should be largely self explanatory If the database_create php script succeeded then A link vvill be created at the bottom of the page pointing to the script login php We ll consider this next 8 15 Upgrading the database This should be infrequently done but we provide an upgrade script eZ upgrade php that requires an SQL file eZ upgrade2 sgl After the upgrade it s best to delete both the php script and the target file from the server lt head gt lt title gt Upgrade the eZ database lt title gt lt head gt lt body gt lt h2 gt Upgrade eZ lt h2 gt lt p gt Read a SQL script file parse and submit statements contained within to mySQL lt p gt First let s connect to the database We use th Z_database_connect script which must be installed in the correct directory lt php GLOBAL ShandDB SDEBUGGING 1 O off require once eZ
224. change the final element with an element randomly selected from elements 1 yA Once vve ve randomised ten anrecord entries for a particular assessor we turn the ten element array containing these entries into a space delimited string and store it in a table called NEXTSESSIONS as follows 2 CREATE TABLE NEXTSESSIONS nextsessions integer constraint BadNextSession primary key nextsessions nsList varchar 64 ns ndex integer Person integer constraint badnsAssessor foreign key Person references PERSON js At the start the value of nsIndex is 1 When an assessor requests an anaesthetic record to assess our process is as follows T2VVe have chosen to hide the anrecord entries within nsList not only because this is a con venient approach but also because once the entries have been generated within ANRECORD the order becomes apparent and can be queried in a conventional fashion and the corresponding denormalisation is hidden 8 DATABASE DEFINITION 165 1 Look for an incomplete entry for this Person assessor in ONESESSION If the entry is found then return information for the associated Anrecord An incomplete entry can be identified by one of osStart osEnd osReported osFinalRank osAutomatic osSeenBefore or osChoice being NULL but we will base our choice on osStart being NULL Otherwise 2 Find a NEXTSESSIONS table entry for this Person with an nsIndex value of less t
225. cord integer auxOnesession integer They would have to be manually updated within the database 8 DATABASE DEFINITION auxRating integer auxSubject integer auxNextSessions integer INSERT INTO UIDS ids Person Persdata Anrecord Onesession Rating Subject NextSessions G Co 6 GG Gut auxPerson Persdata Anrecord x aux X auxOnesession x x x au au au Rating Subject auxNextSessions VALUES 1 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 INSERT INTO PERSON person pLoginName pPassword VALUES 1 Superuser PasswordGoesHere INSERT INTO PERSDATA persdata Person pdForename PersonRole VALUES 1 1 Mr Superuser 192 8 pdSurname 167 The last few statements create a single super user who will be able to log on with the username Superuser and the relevant password Note that as things stand this naked password is inserted into the database and will allow the Su peruser to log on It is wise for him her to then immediately alter the password even smarter would be to insert an md5 encoded password into the above code 8 DATABASE DEFINITION 168 PERSONROLE lt gt CURRENTSPECIALTY PERSDATA CURRENTLOCATION PERSON FORENSIC gt ONESESSION RATING unu ANRECORD
226. d is feasible 1 In demo version allow annotation of artifacts also debug review data at end 2 NOTE must have review where we ask 1 perceived level of anaesthetist conducting anaesthetic and 2 whether this was a manual or automated record 3 Translate demo to PHP integrate into database 4 Ensure continuation to next file after completing first IDAS replay 5 Interpolate every minute and decide what to do about multiple readings within 1 minute only use the first 6 What about trimming off CO2s at start end 7 View recorded data write menu 8 Anaesthetist can amend own details still to do 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 331 10 11 12 13 14 15 16 17 RESTART using cookies Nb to do truncate interpolated values to 6 digits after decimal When entering Spo2 co2 have absolute times We need sensible values for EtCO2 i e if in kPa translate to mmHg 760 000 mmHg 101 325 kPa EXPLORE PROGRESSIVE UPDATE OF PNGS Best is a segment at a time continguous overlaid With 5 min changes we have a vast amount of redundant information in the PNG files Might compare these A simple strategy is to change nothing if they are the same omitted file leave the same and an advanced one might be to subtract the old from the new and only store the new changes as an overlay transparent background but this latter change will require sophisticated program
227. d into the connection script script called eZ_database_connect php Note that there is a potentially fatal flaw in CPANEL it s possible to delete an entire database with one click and no confirmation We ve already uploaded database_create php so all we need to do is upload the following 1 eZ_database_connect php which we place in the relevant directory above the HTML public directory 2 eZ GLOBALS php which goes into the ez directory These are described in the next section Install Ocelot permitting ODBC connectivity and in Windows go Start Control Panel Administrative Tools Data Sources Under User DSN click on the Add button se lect Ocelot from the list and click Finish In the data source name type in the letters eZ and you re done STn the Ocelot example within a DOS box from the ocelot directory type in demo32 and press Enter Paste the SQL in sequentially after typing in disconnect default and then connect to eZ Remember to COMMIT at the end 8 DATABASE DEFINITION 170 8 12 PHP Creating the SQL database Before we create our database we have several prerequisites The first is a script that actually connects to the database eZ database connect php Here s the script It requires the existence of the global variable SDEBUGGING which we ll consider in a moment function eZ database connect GLOBAL S DEBUGGING handDB mysql pconnect localhost name sysadmin PASSNORDHE
228. d line but 1f the last user marking is between two such lines only measure to the vertical pre printed line just before this line If the last user marking coincides with a pre printed vertical line measure to this line The value o is the distance between two minor vertical time lines Unfor tunately this too varies depending on the type of record For Types A C the values in mm are 2 15 2 35 4 43 24 63 2 and 3 11 3 31 Note that in the type B record the value of 4 53 usually refers to a ten minute interval but we always mandate a five minute measuring interval When we deter mine x axis time offsets we will use measured values to determine more precise values for alpha for a particular record To make things even more complex some anaesthetists choose to re scale the x axis so we check for this by asking the user to enter start and end times MAXVAL red MINVAL blue alpha and the x and y calibration mea surements are shown in Fig 1 together with the baseline in black from which all y measurements are made In addition this chart shows an initial delay treaa between the point at which x axis measurement started a pre printed vertical line and the first user mark Next look at the end of the anaesthetic Although it ini tially seems that the anaesthetic actually ends after a pre printed vertical line this 2 EZ CAPTURE MANUAL DATA CAPTURE 12 is only if you look at the charting of diastolic blood pressure
229. dIf Return 0 success EndFunc zi mr 7 routine to lengthen a number by prepending zeroes Func MakeSerial s lgth While Stringlen s lt Slgth s String 0 amp String s Wend 6 IMAGE TRANSFORMATION 123 Return s EndFunc Trimmed screen grabs We write a similar routine to trim screen captures from IDAS We assume they are stored in eZ png captured The script is source trim au3 rr Autolt Version 3 0 Program to trim all files in the form Snnnn png in the directory eZ png captured At 53 112 gt 793x361 pixels Files are written to ez ez shw php png sources The name is left unchanged Const SONTOP 0x40000 r EZPATH ez SSRCPATH EZPATH amp png captured SDESTPATH SEZPATH ez shw php png sources ShDIR FileFindFirstFile SRCPATH 6 Sx png Check if the search was successful If hDIR 1 Then sgBox ONTOP Error No files found in amp SSRCPATH Exit EndIf BIG LOOP SCOUNT 0 While 1 SMYFILE FileFindNextFile hDIR If error Then ExitLoop process directory Sr TrimFile SRCPATH amp SMYFILE DESTPATH 8 MYFILI If Sr lt gt H Then Scont MsgBox SONTOP 1 Error r amp Continue If cont 2 Then 2 cancel Exit EndIf EndIf COUNT 1 WEnd loop exits here FileClose hDIR Close the search handle sgBox ONTOP
230. dLin If error lt gt 0 Then Return FDAT 55 Exit EndIf sgBox ONTOP vs Debug if failed mv FAIL Line value for line amp Sln amp amp Slineno amp 255 is 6 IMAGE TRANSFORMATION 115 SFDAT StringSplit myline If SFDAT 0 2 Then Dim FDAT 3 SFDAT 0 O EndIf Return SFDAT EndFunc failed 5 2 Invoke ez replay from DOS The file replay bat can be used to invoke the Autolt script that plays DAT files back through IDAS and screen captures the display every minute echo off cls rem Invoke AutoIt script to playback DAT files z replayVez replay au3 It should be placed in the ez directory At present it takes no arguments 6 Image transformation We use ImageMagick to transform images captured from SAFERsleep decreasing bandwidth 6 1 Using ImageMagick We can dramatically decrease our bandwidth if we overlay our web page with new transparent PNG images every minute the new image simply containing a difference image with a transparent background We progressively increase the z index of subsequent images starting at 0 CHECK implications of z index over 997 We generate the difference PNG files using ImageMagick as follows 1 For each image from 2 to the end take the difference of the image and the previous one composite compose difference imgnow png imgold png diffnow png 2 Then take the negativ
231. e TIEFE F od pxytct tops so yeh Re vidth w px height h px clip rect 0 w px h px 0 background color this color 13g moz overflow hidden 4 r ocV div 11 ACTUAL ENTRY OF DATA function mkDivle x y w h this him 8 bhis colors g xp eye pg ome sis function mkDivPrt x y v h this htm div style position absolute border left w px solid this color left Xx DREE topst cy oh pit width 0px height h px telipireccio w px tht px 0177 background color this color 3g_moz overflow hidden FLWSCNAdiye s function mkLyr x y w h this htm layer left 2 x H It tope y 47 tvidthe kov height h bgcolor this color gt lt layer gt n var regex 5 17 1 17 14 1 51 17 18 17513 g function htmRpc return this htm replace regex div style overflow hidden position absolute background color S1 left 2 top 3 width 4 height 5 gt lt div gt n function htmPrtRpc return this htm replace regex div style overflow hidden position absolute background color 1 left 2 top 3 width 4 height 5 border left 4px solid 1 gt lt div gt n function mkLin x1 yl x2 y2 i
232. e vill be saved for 24 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 148 function KeepALIWEBDATA first update WEBKEYDATA var jd GetJulian new Date var delta jd LASTJULIAN LASTJULIAN jd for next time if THISIMAGE gt 0 WEBKEYDATA THISIMAGE 1 parseInt 24x60x60xdelta seconds alert Debug storing key time WEBKEYDATA THISIMAGE 1 y now store ad StringifyData kd EncodeKeyArray THISIMAGE 1 alert DEBUG whole key timing string is kd SetCookie eZ Remember PATIENTID THISIMAGE MYSTARTTIME Q kd ad cf GetCookie eZ Remember PATIENTID function SetCookie cname cval var nov new Date alert Debug Date is now Later now 24x x60 24 hours to current time document cookie cname cval expires now alert Debug Cookie cname has value cval expires at now function ClearCookieSoon cname rapid expiry var nov nev Date Later now 0 05 3 seconds document cookie cname expires now oops a little object oriented stuff function myCookie time value startup keydata this time time this value value this startup startup added v0 50 fix start timestamp this keydata keydata end oops function GetCookie cname assumes cookie contains NO semicolons var c document cookie v
233. e px top document write yoff document write px width document write boxw document write px height document write siz BARSCALE document write px z index document write 10 on top of background 10 is arbitrary id A t clr t id A 6 rye 2 left document write Un title im stmp 4 cmt split for TIDY document writeln div gt function DrawMsg id x0 y0 w h msg clr document write div id M x 10 WORKING PHP CODE document write id document write style position absolute background color document write x0 document write px top document vrite y0 document vrite px width document vrite w document write px height document write h document write px z index document write 90 on top of all document write msg split for TIDY document writeln div function Writelegend x n i DrawMsg 100 i while i n CLR i txt INV il DrawMsg 100 i x y 60 20 DrawMsg 100 i x 30 y 60 y 20 itt y CLR INV y 20 20 h3 Key h3 white 20 60 amp nbsp c 30 txt white y end of Javascript analysis js 7 7 7 7 7 7 7 7 7 7 7 7 10
234. e rAflags rTime rIcomment rAcomme FRO RATING WHERE Onesession elesession AND rlimportance IS NOT NULL ORDER BY rImage f rlimportance ignore artefacts FOR NOW SELECA SQLManySQL handDB qry get markup for electronic records eleclen sizeof SELECA print lt lt lt HTML3a ELEDIM eleclen ELEC new Array ELEDIM HTML3a SJsElec j 0 while j Seleclen r Flatten SELECA 3 m0 An M new Array Sr 0 52111 I r 211 521311 1 I r 4 l 1 r 5 m0 preg replace AX m0 scape any quote m0 preg replace m0 now can insert quotes the above doesn t address any pipes in the original array SJsElec m0 SJsElec in ELEC 3 M j y print uUsElec write actual images data print lt lt lt HTML4 10 WORKING PHP CODE 232 next write top final background image handwritten record Writel 0 SImage0 XINDENT TOPGAP IMAGEW parseInt ISCALE IMAGEH 0 DrawMsg 1 XINDENT 77 TOPGAP 5 100 50 lt h3 gt Handwritten lt h3 gt transparent and overlay data WriteData XINDENT XLEFT TOPGAP parselnt ISCALE 0 YBOTTOM IMAGEW XLEFT gt I the background for the electronic record Writel 1 SImagel XINDENT TOPGAP VSEPARATION parselnt ISCALE IMAGEH IMAGEY DrawMsg 2 XINDENT 77 TOPGAP VSEPARATION parselnt ISCALEx IMAGEH 5 100 50 WriteData 1 X
235. e complete relevant fields There vere errorcount errors return false y return true ValidAge age chirp check if age between 0 and 110 If chirp is nonzero then also give AL function ValidAge age chirp if age value 1 permit 1 for absent hmm age value gt 110 11 ACTUAL ENTRY OF DATA 295 might check more formally for a number if chirp alert Please enter valid age e g 21 return false y return true ValidImageCount count chirp check if count between 5 and 120 function ValidImageCount count chirp if count value 5 count value gt 120 might check more formally for a number if chirp alert Please enter valid image count from 5 to 120 If over 120 return false y return true function ValidSCode scode chirp if scode value length 5 hmm might augment with regex if chirp alert Please enter valid S number for example S0012 No whitespe return false y return true function ValidDescription desc chirp if desc value length lt 10 desc value length gt 250 can add more to the above if chirp alert Description must be 10 250 characters long return false y return true function ValidOperation desc chirp if desc value length lt 4 11 ACTUAL ENTRY OF DATA 296 desc value length gt 128
236. e g S0001 sbp csv OpenDCMS FAKEDCMS WinActivate DCMS Data entry here Excel WinWaitActive Microsoft Excel WinActivate Microsoft Excel if target file exists detect and delete it heh SWHOLEFILE PATHNAME amp SFILENAME If FileExists SWHOLEFILE Then FileDelete SWHOLEFILE 2 EZ CAPTURE MANUAL DATA CAPTURE 57 EndIf If FAKEDCMS lt gt 0 Then MsgBox SONTOP Fake Excel input You have amp FAKEDCMS amp seconds for Exce WinActivate Microsoft Excel EndIf Sleep 3000 good long wait for import Send f 11 Alt F File Sav Sleep 300 Send a 015 Sleep 200 Send SWHOLEFILE Sleep 200 Send TAB tab to file type Sleep 200 Send C S CSM Sleep 200 Send ENTER accept CSV Sleep 200 Send ENTER save Sleep 300 If WinExists Microsoft Excel The selected file type does not Then Send ENTER Windoze being helpful EndIf Sleep 300 If WinExists Microsoft Excel not compatible with CSV Then Send ENTER Windoze being helpful EndIf Sleep 500 Send fx CLOSE Excel Sleep 200 Windows will ask Do you want to save S
237. e line there must be a columndata line along the lines of SsColumnData 4 rating int Patient int Assessor int raText string The line must start with a double percent sign followed by the word Colum nData with the number of columns in parenthesis and an equals sign After this we have the names of the columns each followed by its data type in parenthesis and a comma Let s implement this functionality within csv_read php supplying the database handle and the name of the CSV file without a directory path and suffix In order to completely restore a database this file should be uploaded to the csv subdirectory of the eZ directory after the main database has been created this creation may involve reading of other CSV files and before new data have been inserted function ReadBigCsv handDB BIGNAME first check for people with an ID of 1000 or more If so fail Sqry SELECT COUNT person FROM PERSON WHERE person gt 999 list SPERSCOUNT GetSQL handDB qry get new people if SPERSCOUNT gt 0 print lt p gt There are already PERSCOUNT new people in the database so I won t restore anythingl return 1 qry DELETE FROM UIDS WHERE uids 1 DoSQL ShandDB qry delete UIDS allow new insertion into UIDS Serrcount 0 SCSVFILE csv BIGNAME csv if stat SCSVFILE i
238. e lt a gt but it s likely that Javascript is disabled on your machine 9 PHP ACCESS CODING 182 and you will need to enable it before continuing lt BODY gt Here s rescue htm mentioned previously lt head gt lt title gt Something bad happened lt title gt lt head gt lt body gt lt h2 gt Woops Database connection failed lt h2 gt Click here lt a href http www anaesthetist com gt Return to Anaesthetist s main page lt a gt lt body gt We also require a helper HTML file busy htm which we invoke if there is no login slot available after 20 tries This is at present a stub but later we might have a Javascript 30 second count down after which the user can try again to log in lt HEAD gt lt title gt Very busy at present lt title gt LINK href css eZstyle css type text css rel stylesheet lt HEAD gt BODY lt h2 gt Hmm We seem to be lt i gt very lt i gt busy h2 Xp or you left the login screen idle for over five minutes and we got tired waiting lt p gt Please wait about 30 seconds and then click lt a href http www anaesthetist com eZ login php gt here lt a gt to try again lt BODY gt Another tiny html file is badpassword htm lt head gt lt title gt Invalid password lt title gt lt head gt lt body gt lt h2 gt Invalid password lt h2 gt lt p gt Click lt a href logout php gt here lt a gt to conti
239. e of the diffnow png file mogrify negate diffnow png 6 IMAGE TRANSFORMATION 116 3 Decrease the number of colours to 256 or less mogrity colors 256 diffnow png 4 Render the PNG background transparent and Voil we have our overlay file convert transparent white diffnow png diffnow png8 Note that because of defects in Internet explorer versions under 7 we can t say mogrify transparent FFFFFE diffnow png as this retains an alpha channel which IE simply can t handle Here s the final script transping bat which accepts a The file stem 1 e g S0061 b The full first filename minus PNG suffix 962 e g S0061 m 001 c The full second filename minus PNG suffix 3 eg S0061 m 002 d The width of the new cropped file 764 e The height of the cropped file 5 f The x displacement for cropping 966 g The y displacement for cropping 7 h The destination filename 8 This is normally the same as 3 but if we have skipper error correction in place it may be 1 more Transp ing adds an x at the end before the png rem echo off rem cls composite compose difference ez png 1 2 png ez png 1 3 png ez ez s mogrify crop 4x 5 6 7 NezNez shwNphpNpngN 1N 8x png mogrify negate NezNez shwNphpNpngN 1N 8x png convert transparent white ez ez shw php png 1 8x png VezVez shvNphpNpne del NezNez shwNphpNpngN 1N 8x png rename NezNez shwNphpNpngN 1N 8x png8
240. ePic ez images Ilog gif 2 2x hskip 3 8x pitch 30 Dim imDAT GUICtrlCreatePic ez images Ilog gif 4 58x hskip 3 8 Spitch 30 Dim imADD GUICtrlCreatePic ez images Ilog gif 5 58x hskip 3 8x pitch 30 2 EZ CAPTURE MANUAL DATA CAPTURE 43 Dim isGET GUICtrlCreatePic ez images Ilog gif 0 88x hskip 7 8x pitch Dim isXML GUICtrlCreatePic ez images Ilog gif 2 58x hskip 7 8x pitch Dim isCSV GUICtrlCreatePic ez images Ilog gif 3 58x hskip 7 8x pitch Dim isDAT GUICtrlCreatePic ez images Ilog gif 4 58x hskip 7 8x pitch Dim isADD GUICtrlCreatePic ez images Ilog gif 5 58 Shskip 7 8x pitch Check for defects otherwise will behave VERY oddly If vwXML OR SvwCSV OR vvDAT OR SvwSS 0 OR imCSV 0 Then sgBox ONTOP Error Missing images in ez images Fix me Bye l Exit EndIf here set control states at start ugh first tick boxes are always greyed myDisable xSBP myDisable xDBP myDisable xHR myDisable xSpO2 myDisable xETCO2 then check if raw data exist if so tick boxes SFIVEITEMS CheckRav xSBP xDBP xHR xSp02 xETCO2 FILENAME myDisable vSBP myDisable vDBP myDisable vHR s myDisable vSpO2 myDisable vETCO2 Secondly Parse to CSV is only enabled when all 5 inputs are i
241. eZ ASSESSOR MAX 63 define EVERYONE 1000 define NOBODY 0 define SALTSIZE 100 define SALTTIMEOUT 300 4 seconds F F D 4 Convenient globals SCONNECTIONPATH eZ database connect php above is for anaesthetist com setup handDB SUSERKEY SDEBUGGING 0 5 nasty hacks SCLUMSY INDEX 0 SCLUMSY INDEX2 y D y D 8 12 1 Database creation script Here we create a combined HTML PHP script called database create php To create the database ensure the file eZ sql is in the correct location specified below and then simply access the file database create php with your web browser http www anaesthetist com eZ database create php This is a one off page which will do nothing once the database has been cre ated In fact it might be wise to completely remove this page from our server once we ve made the database Once created the database can of course be viewed us ing phpMyAdmin lt head gt lt title gt Create th Z database lt title gt lt head gt lt body gt lt h2 gt Create a database lt h2 gt VT s wise to immediately alter the password using phpMyAdmin if you ve not inserted an encrypted password in the SQL creation file 8 DATABASE DEFINITION 172 lt p gt Here we read a SQL script file parse it and submit the CREATE statements con
242. ect gt lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt Role lt td gt lt td gt HTML2 10 WORKING PHP CODE 205 PrintPoplist handDB personrole SELECT personrole PERSONROLE rText from PERSONROLE WHERE personrole gt 0 ORDER BY personrole print lt lt lt HTML3 lt td gt lt tr gt lt tr gt lt td gt lt td gt lt td gt Please state main area of practice lt td gt lt td gt HTML3 PrintPoplist handDB currentlocation SELECT currentlocation CURRENTLOCATION LocationText from CURRENTLOCATION WHERE currentlocation gt 0 ORDER BY currentlocation print lt lt lt HTML4 lt td gt lt tr gt tr td td td Does anaesthetist have a particular anaesthetic interest lt t HTML4 PrintPoplist handDB currentspecialty SELECT currentspecialty CURRENTSPECIALTY SpecialText from CURRENTSPECIALTY WHERE currentspecialty gt 0 ORDER BY currentspecialty print lt lt lt HTML5 amp nbsp amp nbsp In the eZ study lt input type checkbox name inStudy gt td tr tr td td td lt INPU YPE submit NAME submit VALUE Enter new person gt td td align right lt INPU YPE reset VALUE Clear Form onClick return ConfirmClear lt td gt lt tr gt lt table gt lt FORM gt lt
243. ed osSeenBefore osChoice osComment ANRECORD Manual SUBJECT sCode ROM ONESESSION ANRECORD SUBJECT PERSON WHERE NESESSION Anrecord ANRECORD anrecord AND RECORD Subject SUBJECT subject AND S z D ESSION Person PERSON person AND PERSON inStudy IS NOT NULL R BY ONESESSION Person ONESESSION onesession Hm z D DI Sdat SQLManySQL handDB qry session assessments PrintDetailTable dat 12 f print table of 12 columns print lt lt lt HTML3 lt table gt lt div gt lt p gt lt a href eZ view php View more lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML3 osFj 10 WORKING PHP CODE 241 10 8 4 View all ratings We create a flat table that joins session data Person unique session ID case num ber anaesthetic record data Manual not subject code and rating data Image number timestamp Iflags Aflags Importance IComment and AComment header Cache control no cache STHISPAGE view ratings php require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER SUSERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS View number of assessments 0
244. edIndex 1 errorcount H y if myform personrole selectedIndex lt 2 if ValidStartYear myform startyear 0 errorcount if myform currentlocation selectedIndex 1 errorcount y Y if errorcount gt 0 if errorcount 1 alert Please complete relevant fields You left out one else alert Oops Please complete relevant fields There were errorcount errors r return false 10 WORKING PHP CODE 203 return true ValidStartYear startyear chirp check if valid year If not return false If chirp is nonzero then also give ALERT function ValidStartYear startyear chirp thisyear STHISYEAR if startyear value length 4 startyear value lt 1950 startyear value gt thisyear vhat if insert alphas if chirp alert Please enter valid 4 digit year e g 2003 startyear select startyear focus return false y return true function ValidSurname surname chirp if surname value length 2 can add more to the above if chirp alert Please enter valid surname im surname select surname focus return false y return true function ValidForename forename chirp if forename value length 2 can add more to the above if chirp alert Please enter valid forename forename select forename focus
245. eft 1px background image url images chart2 png background color vhite anbox border vidth 1px border style solid border color 4000000 x analysis boxx 3 Useful SPAN and other tags x topskip margin top 0 6em marginal margin left lem 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 154 x 4 Pseudo stuff x a hover color red background color black X area for testing follows x the end of the style sheet x 7 3 1 Process the demonstration page We process the POST data from demo15 htm simply to show that the data have been transferred Relevant data values are WebDataString all the interventions and artefact annotations made by the assessor Values are separated by pipes and whole annotations by double pipes Patientld the case ID e g S0012 s StartTime the timestamp of first loading FinalRank Ranking assigned by assessor 1 5 FinalManual Manual automatic assessment 1 2 by assessor FinalSeenBefore Did the assessor remember seeing the patient before 1 2 FinalChoice Would the assessor want one of their loved ones to have a similar anaesthetic 1 2 header Cache control no cache require once ValidFx php our login validation script SMINUSERSTATUS NOBODY SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERS
246. empts messing around with access by other users we might log the IP address of each unsuccessful attempt and check subsequent attempts e g institute delay lock out for repeat offenders 9 1 2 processLogon The following routine must be invoked before anything is written as HTML It either exits on failure or returns the user key function processLogon username pswd handDB salt SK SALTSIZE global constant SI Ssalt SK print p Debug index of salt item is SI nov time 9 PHP ACCESS CODING 186 STIMEOUT SALTTIMEOUT 5min global gry SELECT sTime sValue FROM SALT WHERE salt I list STIME SVALUE GetSQL handDB ary check salt print p Debug time is STIME salt is SVALUE 32 rand hmm if SVALUE salt f oops print lt p gt Debug failed Values SVALUE salt readfile busy htm exit hmm might differentiate this from next or log UPDATE SALT SET sValue 5 2 WHERE salt 1 DoSQL handDB ary prevent salt reuse if now STIME gt TIMEOUT timed out ff print p Debug timeout STIME TIMEOUT amp lt Snow readfile busy htm exit now have valid SALT value Get user password Sqry
247. en 2 cancel Exit EndIf EndIf F m r amp f SDESTPATH Continue 6 IMAGE TRANSFORMATION 122 COUNT 1 Sr WriteTopFile SSRCPATH MYDIR s DESTPATH If r lt gt 0 Then Scont MsgBox SONTOP 1 Error r Continue If cont 2 Then 2 cancel Exit EndIf EndIf COUNT 1 WEnd loop exits here FileClose hDIR Close the search handle MsgBox ONTOP Finished ez trim Number of files copied was 6 COUNT EXIT rr mer 7 FUNCTIONS Func WriteTopFile SRCPATH MYDIR SUFFIX SDESTPATH SFP SSRCPATH 6 MYDIR s N SFNAM SMYDIR amp SSUFFIX 521 1 SfileB SFP 6 FNAM 6 001 png While FileExists fileB get top file IN SEQUENCE Sfi 1 SfileB SFP amp FNAM amp amp MakeSerial fi 3 6 png Wend If Sfi 1 Then fail if first file not found Return File not found amp fileB EndIf fi 1 Sfn FNAM 6 6 MakeSerial fi 3 png now trim write to destination SIMGCMD convert amp SFP amp fn amp crop 820x455 0 25 amp SDESTPATH fn MsgBox ONTOP Debug Command is amp SIMGCMD 6 Sdosok RunWait ComSpec c amp SIMGCMD SW_HID if dosok lt gt 0 Then E Return Conversion failed amp SIMGCMD Clumsy error En
248. end n Ze mol next close DCMS CloseDCMS FAKEDCMS EndFunc DCMS Func OpenDCMS FAKEDCMS If SFAKEDCMS 0 Then return do nothing EndIf 2 EZ CAPTURE MANUAL DATA CAPTURE 58 SDCMSEXEC C Program Files USB DCMS FOR MEASURING TOOLS Receive exe Run DCMSEXEC WinWaitActive DCMS Open port ControlClrck DCMS n CLASS ThunderRT6CommandButton INSTANCE 61 establish connection 3 tries works ControlClick DCMS CLASS ThunderRT6CommandButton INSTANCE 11 Sleep 300 Contrzololrck DGMS Niz CLASS ThunderRT6CommandButton INSTANCE 11 S1eep 300 ControlCcdrck DCMS CLASS ThunderRT6CommandButton INSTANCE 111 Sleep 300 EndFunc Func CloseDCMS FAKEDCMS If FAKEDCMS lt gt 0 Then return do nothing EndIf Shutdown and exit WinActivate DCMS 7 Close port ControlClick DCMS CLASS ThunderRT6CommandButton INSTANCE 11 Exit DCMS ControlClick DCMS _ CLASS ThunderRT6CommandButton INSTANC EndFunc 10349 2 4 4 Keyboard input Func GetKbSequence seqname FILENAME DATETIME DURATION EZPATH ez prog ComSpec c perl 6 SEZPATH ez capturNez keyboard pl
249. ensions flatten to a unidimensional array which is returned as a new array The problem with the following is the deprecated Call time pass by reference function Flatten myarray f don t use me simflat array array valk myarray flatten array amp S simflat see flatten array fx below return 5sQNtlsk function flatten array value key s array if lis array value array_push array value else array walk value flatten array amp Sarray S0 instead we use function Flatten myarray Aout array foreach myarray as a if is array a SJ Flatten a foreach U as i array push Aout i y else array_push Aout a im return Aout 12 3 4 PrintDetailTable function PrintDetailTable data cols cols is number of colums data array of data foreach data as d print br Deeper debug 12 ANCILLARY CODE 307 print r 58 print tr i 0 while i Scols print td if strlen d 1 1 print should work if NULL else print d i y print td i 1 print tr 12 4 User information 12 4 1 PullOutUserInfo Given a user string pull out user and associated details Returns a list of the three items in that order function PullOutUserInfo userstring matches if preg match
250. ent document document document document document document document document document document document document document document document document document document document document document document write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write lt table border 0 class marginal lt tr gt td colspan 2 align center gt lt h2 gt Your final overview lt h2 gt lt span class shocking We value your subjective opinion based on the anaesthetic r to base your response solely on how you feel the lt i gt actual lt i gt anaesthetic went lt lt td gt lt tr gt lt tr gt lt td colspan 2 lt b gt Please indicate your lt i gt perception lt i gt of the quality of the anaesthetic lt b lt td gt lt tr gt lt tr gt td colspan 2 align center table lt tr gt lt td rowspan 2 very poor nbsp lt td gt td align center gt 1 lt td gt td align center gt 2 lt td gt td align
251. er is THISIMAGE which is incremented as we move through the anaesthetic record Movement to the next image can be automatically by SkipToNextImage or when the user clicks on the fast forward button Javascript to service the display of anaesthetic records in eZ function eZStart TOTALIMAGES PATIENTID ezX ezY BIGWIDTH BIGHEIGHT TIMEOUT several globals MYIMAGES new Array TOTALIMAGES THISIMAGE 0 STARTUP 1 used to enable various buttons ALLWEBDATA new Array 200 max of 200 annotations 1 might chastise if exceeded DATUMCOUNT number of items stored in ALLWEBDATA BUFFERING 1 used by PreloadImages MUST start at 1 RELOADED 0 by default fresh page ANYONETHERE TIMEOUT if e g 4 minutes tick by ask if anyone there TIMESTAMP GetTimestamp another global MYSTARTTIME TIMESTAMP and another NEBKEYDATA new Array 120 record key timing LASTJULIAN GetJulian new Date MYIMAGES 0 new Image BIGWIDTH BIGHEIGHT MYIMAGES 0 src images START png CLEARIMAGE new Image BIGWIDTH BIGHEIGHT CLEARIMAGE src images CLEAR png genlayers 10 ezX ezY BIGWIDTH BIGHEIGHT first check if revisiting same page cooks is locally defined object cooks GetCookie eZ Remember PATIENTID if cooks time 5 1 if cookie reloaded DATUMCOUNT ReloadALLWEBDATA cooks value MYSTARTTIME cooks startup reload st
252. er of rainbow tables 21This approach cannot protect against Man in the middle attacks 9 PHP ACCESS CODING 185 3 We generate the salt value as a pseudorandom integer J and take I J mod ulo K where K is the number of items in the SALT table using I as an index into SALT 4 H that SALT table entry hasn t expired vve try again max of 20 times at vvhich time vve say busy encourage vvait of 30s and then allovv re submission 5 If SALT entry is expired 5 min is the cutoff then we overwrite table row I with the current timestamp and the value J J We then 6 Submit the value J in the login form that the user sees 7 The user responds with md5 J md5 pwd login and the user J value J which should be identical to J where represents concatenation of the two strings 8 On receiving the user response with Ju we examine the SALT table item at index I mod K If J is not equal to J or the time has expired we say invalid timeout and they can retry after a 30s wait If both are ok we 9 Calculate md5 J md5 pwd for the given user and if not equal to the sup plied value say invalid timeout otherwise 10 Store md5 J md5 pwd as the session ID against that user name both in the database and as a cookie at the user end and proceed In order to implement the above we need a SALT table with say 100 entries If we were concerned about repeated frequent logging att
253. ere s the main data processing and storing routine 17 arbitrary Nos routine ProcessDatum t y if y in ZERO gt y2 lt ReadLine if y2 in ZERO gt 0 0 signals datum NA Store t NA return CEA if y2 in MAXVAL gt 0 MAXVAL end of run recalibrate Recalibrate idx idx 1 global signal new variable return 0 back to start time if y2 gt MAXVAL gt meaningless fail Bad Y calibration value if y2 lt MINVAL gt special signal to store LOW values Store t y2 default gt fail Bad special datum value if y in ALPHA gt y2 lt ReadLine ALPHAm ALPHAh ALPHA1 2 toff lt round 5 y2 ALPHAm Store t toff y2 return t do NOT advance 2 EZ CAPTURE MANUAL DATA CAPTURE 18 if y lt MINVAL gt fail Bad data value if y gt MAXVAL gt MAXVALm lt MAXVALh MAXVAL1 2 Store t MAXVALm return t 5 default gt Store t y return 1145 FiO EtCO After determining the number of values to acquire which is simply the DURA TION measurement divided by alpha check me and identical to the maximum time value noting that if the last time value is not on a 5 minute mark the user must enter a 0 0 we acquire first FiO2 and then EtCO2 values if present allow ing the user to enter NA values where appropriate What about oopses routine ReadFiO2andEtCO2 here determine maximum index of ALLDATA validate vs
254. estheticViewer 51 This assumes that the AnaestheticViewer exe is in the DOS path see invoca tion 2 EZ CAPTURE MANUAL DATA CAPTURE 70 2 6 Perl keyboard input A simple Perl program to acquire either ETCO2 or SpO2 values from the console and write them to a file in the format S0001 spo2 in the ez rawdata directory We submit command line parameters the first being the serial number the second the type of datum spo2 or etco2 and the third the duration of the anaesthetic in minutes As of v 0 38 vve also submit a timestamp permitting display of an absolute rather than a relative time An optional fifth parameter consists of command line controls The program is called ez keyboard pl The exit code reflects success zero or failure nonzero usr local bin perl w use POSIX qw floor for date calculations 0 to turn off debugging 1 overviev 2 detail 3 nitpicking print to log rawdata code on exiting Perl store data values GLOBAL also used for debugging serial number eg S0001 NO suffix etco2 or spo2 duration in minutes START time with date global eg debug 3 logprint 0 command line control my SDEBUG my SLOGPRINT my SWARNINGS see usage my SEZDIR E my SRAWPATH EZDIR my SEXITCODE 0 my ALLDATA used to my STORECOUNT my SRAWFILENAME SARGV 0 my DATTYPE SARGV 1 my DURATION SARGV 2 m
255. et role qry SELECT FirstQualified FROM PERSON WHERE Person OTHERLOGONID list SQUALYEAR GetSQL handDB qry get qual yr Sqry SELECT personrole rText FROM PERSONROLE WHERE personrole gt 0 SROLEPOPLIST TextPoplistSelected handDB newrole qry SOTHERROLE qry qry SSPECIALTY nevspecialty Sqry 5 SLGIN SELECT currentlocation Loca WHERE currentlocation gt 0 SLOCATIONPOPLIST TextPoplistSelected SELECT currentspecialty WHERE currentspecialty 0 POPLIST TextPoplistSelected if strlen OTHERLOGIN lt 1 LGIN else LGIN D I EI Login name is SOTH print HTML3 lt p gt lt a href mainpage php Return to main page lt a gt ERSP lt h3 gt Alter details for SOTHERFOR ENAME p F SOTHI tionText FROM CURRENTLOCATION ShandDB nevlocation qry SOTHERLOCATION SpecialText FROM CURRENTSPECIALTY handDB ECIALTY ERLOGIN ERSURNAM div class narrow SLGIN By default all values are left at their current settings div E h3 10 WORKING PHP CODE 224 lt div align center gt lt FORM name eZ_update ACTION eZ_update php METHOD POST onSubmit return CheckAllInputs this gt lt input type hidden name editperson value
256. et1 4 str replace US f might check for success Sopt i detl i 1 y return opt 12 43 FetchSurname ERID p detl141 Given a person s ID obtain their surname function FetchSurname handDB id qry SELECT MAX persdata FROM PERSDATA WHERE Person id AND return surname 12 4 4 FetchForename pdSurname IS NOT NULL list Spd GetSQL handDB qry fetch key for surname qry SELECT pdSurname FROM PERSDATA WHERE persdata pd list surname GetSQL handDB qry fetch surname In a similar fasion to FetchSurname obtain a person s forename function FetchForename handDB id 12 ANCILLARY CODE 309 qry SELECT MAX persdata FROM PERSDATA WHERE Person id AND pdForename IS NOT NULL list Spd GetSQL ShandDB qry fetch key for forename gry SELECT pdForename FROM PERSDATA WHERE persdata pd list forename GetSQL ShandDB qry fetch forename return Sforename FetchRole The following can be made far simpler if we accept that in this database a person will only ever have one role function FetchRole ShandDB id Sqry SELECT MAX persdata FROM PERSDATA WHERE Person Sid AND PersonRole IS NOT NULL list Spd GetSQL ShandDB qry
257. f xl gt x2 var 2 x2 var 2 y2 x2 xl y2 yl 276 11 ACTUAL ENTRY OF DATA xl x2 yl _y2 var dx 2 1 dy Math abs y2 y1 x xl y yl y ncr yl gt y2 1 1 if dx gt dy var pr dy lt lt l pru pr dx 1 p pr dx OX 7 Xj while dx O0 TtX if p gt this mkDiv ox y x ox 1 y yIncr p pru OX 7 Xj else p pr this mkDiv ox y x2 oxzl 1 else var pr dx lt lt l pru pr dy 1 p pr dy oy y if y2 lt yl while dy gt 0 zr tp this mkDiv x y 1 oy y 1 y yIncr p pru oy Y else y yIncr p pr this mkDiv x2 y2 1 oy y2 1 else vhile dy 5 0 y yIncr E Ger gt 20 BP this mkDiv x oy 1 y oy 277 11 ACTUAL ENTRY OF DATA p pru oy Y else p pr this mkDiv x2 oy 1 y2 oy 1 function mkLin2D x1 yl x2 y2 LE xL X2 var 2 x2 var 2 y2 x2 xl y2 yl xl x2 yl _y2 var dx 2 1 dy Math abs y2 y1 x xl y yl y ncr yl gt y2 1 1 var s this stroke if dx gt dy if dx gt 0 amp amp s 3 gt 0 var 5 s dxxMath sqrt 1 dyx dy dxx dx dx s gt gt 1 x dy dx _s s 4 Math ceil _s Math round s 1 else var s s var ad Math ceil s 2 var pr dy l
258. f not exists print lt br gt File not found SCSVFILE return 1 signal 1 error im SBIGLINES file CSVFILE f get all lines SNEWCSV 0 Sheadarray ZZ 10 WORKING PHP CODE 234 csvname SL SBIGLINES 0 if preg match DatabaseBackupName eZ L print lt p gt Woops big bad CSV return 1 y foreach BIGLINES as L print lt br gt Debug parsing amp lt S L amp gt if preg match L if preg match TableName 4 SL fx csvname Sfx 1 pull out name print lt P gt Table csvname identified elseif preg match ColumnData d SL fx note the greedy match and final comma Scolcount fx 1 not needed a check Sheadarray explode Sfx 2 Sheadarray FixNevHead headarray print_r Sheadarray debug if count headarray lt 1 print lt p gt Bad null head array return errcount 1 y else do nothing it s just a comment y ls likely to be data if strlen L gt 3 arbitrary L rtrim L L rtrim L remove terminal commal errcount SaveCsvLine strtoupper csvname Sheadarray SL handDB t y by y return errcount function FixNevHead HA SOPT array i foreach SHA as L f ugh print lt br gt debu
259. fx SBP DBP coeff is 0 333 HR 0 0012 Razminia et al 2004 my coeff 0 333 if SmyHR lt 10 ugh Scoeff myHRx 0 0012 amp Print n Coefficient for mean coeff hr myHR 3 SNIBm SNIBd coeffx NIBs NIBO m Sv SNASTYOFFSET NIBm store value in correct column END OBTAIN MEAN BP if length d gt 1 1 allows for final comma HMM CHECK ME amp Print An Warning extraneous data in line d 0 SWARNINGS 2 EZ CAPTURE MANUAL DATA CAPTURE 34 D I my Sp my modtime amp KiwiAddMinutes TIMESTAMP time modtime s T SAFERsleep format has T IPO print OUTFILE Nn modtime foreach p Qv print OUTFILE p D I Here s a simple routine that pulls out a datum given the name It also returns the original string with the entire specification for that datum seamlessly excised Note that for the routine to work reliably the string should end with a comma sub PullDatum my St Sorig St is target string etc to search for t orig _ Sorig original string to search IN my dat modif Sdat modi f he keep Perl happy if orig x t x x Smodif 1 3 Sdat 2 else Smodif Sorig Sdat 1 D I return dat modif D I To obtain the Y calibration value we take all the values in YCALS and simply average them
260. g head item Stin if preg match Nw N Nw N SL fx print n lt p gt Error Bad CSV head item L return y Sitm Sfx 1 10 WORKING PHP CODE 235 type Sfx 2 if type int OPT i Sitm elseif type string SOPT i itm elseif type date SOPT Si DATE itm elseif type timestamp SOPT i TIMESTAMP itm ultimately will need more float time else print n lt p gt Error Bad CSV item type in L return Si 1 bump output index y return OPT y CSV back up backup This page is clumsy We print data for all SQL tables to a single CSV file hoping that we never have to use these data We constrain our export to rows where the key is gt 1000 Initially we used the mySQL SHOW TABLES functionality but from version 0 64 we keep a list of tables as we create them in the METATABLES table and here we simply keep the same order in writing the tables This approach allows us to re create the tables without inserting items which depend on others f PHP to generate a CSV file for download header Content type application octet stream header Content Disposition attachment filename N eZ FULLBACKUP cSvN header Cache control no cache STHISPAGE backup all php require once ValidFx php our lo
261. ges vbar png gt lt td gt lt td gt lt h2 gt title lt h2 gt lt span class info User USER SOLD lt span gt lt td gt lt tr gt lt table gt lt hr gt lt div gt 12 ANCILLARY CODE 302 Stxt 1 SUSERSTATUS return txt 12 1 2 CheckCode Check that item is numeric function CheckCode amp Scode msg if preg match sx d s code vals print lt br gt Bad data item amp lt S codeS amp gt lt p gt Smsg readfile badcode htm exit code vals 1 trim whitespace just in case y Similar to CheckCode is CheckCodeNull which however doesn t exit merely returning NULL if the match fails function CheckCodeNull amp S code if preg match s d s code vals code NULL 1 code vals 1 4 trim whitespace D I 12 1 3 Sanitise Clean up data input Note that in the following we remove backslashes before we e g duplicate quotes as somewhere along the line a helpful routine escapes some quotes with a backslash and then our standard SQL duplication fails function Sanitise amp Stxt first remove whitespace at start end matches preg match Ns x NsxS txt matches Stxt matches 1 f get 1 or use ltrim rtrim txt preg replace N txt get rid of pipes txt preg replace NNNNM txt f and backslashes four gives 1 11 txt
262. gin validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER provides handDB Sdate date F 3 Y print S DatabaseBackupName eZ DatePerformed Sdate print An 55 If you wish to restore the database you must print An upload this file to the csv subdirectory 10 WORKING PHP CODE 236 print An re create a fresh database and Restore f get list of tables 4 qry SHOW TABLES good in mySQL tbllist SQLManySQL handDB qry show tables Sqry SELECT TableName FROM METATABLE ORDER BY metatable Stbllist SQLManySQL handDB qry get tables tbllist Flatten tbllist foreach tbllist as t pri Skeymin 1000 default if t UIDS vital keymin 1 clumsy hack minimum key PrintTableCsvData handDB t keymin r nt n a END OF DATA m function PrintTableCsvData handDB tname keymin H k Ur Ur b r if Sqry SELECT MIN keyname FROM Stname WHERE print Xn DEBUGGING Table is tname minimum key Skeymin DR Anin SSTableName Stname 4 record table name eyname strtolower tname f lower case key our rule Include column meta data here
263. gt TIME is Snow ForceLogin Session has expired 9 PHP ACCESS CODING 195 exit D I 5 Retrieve previous page OLDPAGE row pValue most recent page SUSERKEY Srow person Sexpiry time eZ_TIMEOUT if strlen THISPAGE lt 2 if invalid STHISPAGE SOLDPAGE UPDATE PERSON SET pValue 5 5 pExpiration Sexpiry WHERE person SUSERKEY if mysql query ary handDB print lt br gt DEBUG SQL error in storing page mysql error user Srow pLoginName 16 Determine user status Sqry SELECT MAX PersonRole AS userStatus FROM PERSDATA WHERE Person SUSERKEY list Suserstatus GetSQL handDB Sqry get user status print br Dbg User status for USERKEY is userstatus 7 Set cookie return user details setcookie eZ 510 SSID S expiry COOKIE EXTRA WAIT Soutvalue USER Suser STATUS Suserstatus OLDPAGE SOLDPAGE return outvalue success ForceLogin This simple function reads an html file which in turn allows a re try of login him itself described in section 9 1 A message is printed function ForceLogin msg fancy dressing up might go here print lt p gt Debugging ForceLogin msg SMSG msg reminder re
264. gt logfile or die CRASH Could not open LOG logfile sub GetLocalTime my sec min hour mday mon year Swday yday isdst sec min hour mday mon year Swday yday isdst CORE localtime time Syear 1900 fix y2k Ssec amp DoubleDigit sec Smin amp DoubleDigit min Shour amp DoubleDigit Shour Smday amp DoubleDigit mday Smon amp DoubleDigit mon Smon january is zero return year mon mday hour min sec sub DoubleDigit i i 47 if length i 1 return i return 0 i 4 concatenate my 1Nn De 4 FORMAT TRANSLATION EZ XLATE 105 sub CloseLog my islog islog if islog close LOGFILE y _ A death routine for fatal errors sub Die my Se Se _ my 1 SLINECOUNT 1 Print n n DIED Data line 1 Mn Message Se SEXITCODE 0x80 exit SEXITCODE die An Fatal 4 2 3 A DOS batch file csv2dat Here s the batch file csv2dat bat used to invoke the CSV translation from the DOS command line It assumes a single parameter and redundantly submits the standard translation rule file echo off cls rem Translate XML to CSV perl ez xlatelez csv2dat pl 1 datrules txt ECHO Error level ECHO SERRORLEVELS It should be placed in the ez directory The two a
265. han ten If no such entry exists then create a new entry using the randomisation process described above and take this entry 3 Get the value of nsIndex for this entry call this n and the nsList for this entry 4 Take the nth entry from the nsList call this 2 and create a new incomplete entry in ONESESSION with an Anrecord value of 2 5 Increment n by one and store this value in the row already referenced in NEXTSESSIONS 6 Return information associated with Anrecord n not n 1 8 8 Frills The SALT table is used for logging on using md5 encoded passwords CREATE TABLE SALT salt integer constraint badSaltkey primary key salt sTime integer sValue integer The sTime is a UNIX integer time 32 bits used to see whether a particular salt value has expired and the sValue entry is a pseudorandom number We won t here initialise the hundred entries in the SALT table reserving that for the first time we try to check a password We also create a transaction log which details user their IP address a times tamp for the transaction a code for what was done and an optional description field Here we go CREATE TABLE FORENSIC forensic integer constraint badForensicKey primary key forensic Person integer 8 DATABASE DEFINITION 166 constraint badForensicPerson foreign key Person references PERSON flp varchar 15 fTime TIMESTAMP fCode integer fText varcha
266. hat is an assessment of an ANRECORD by an anaes thetist 1s recorded in ONESESSION CREATE TABLE ONESESSION onesession integer constraint BadOnesession primary key onesession osStart TIMESTAMP osEnd TIMESTAMP osReported TIMESTAMP osFinalRank integer osAutomatic integer osSeenBefore integer osChoice integer Person integer constraint BadOsAssessor foreign key Person references PERSON osCaseNumber integer osComment varchar 250 osKeyData varchar 250 Anrecord integer constraint badOsAnrecord foreign key Anrecord references ANRECORD The field osReported is the server timestamp when the data were received as distinct from osStart and osEnd which are user side Javascript timestamps The variables osFinalRank osAutomatic osChoice and osSeenBefore are all provided by the user reflecting their rating of the level of the person performing the anaes thetic whether they thought the record was manually or automatically captured and whether they d seen this anaesthetic or record before We record the current sequential case number of this case for the given assessor in osCaseNumber We added the final comment for a session osComment in version 0 42 and os KeyData used for storing hex encoded intervals between keypresses minimum resolution of 1 second in version 0 51 8 DATABASE DEFINITION 163 8 6 RATING Each rating of a record by an anaesthet
267. he NEXTSESSIONS table so that nsList can accommodate more characters We want 24 x 5 characters but let s make it 250 for future enlargements 14 HARDWARE SOFTWARE USEFUL FILES amp CHANGE LOG 335 e When we fetch a new key from NEXTSESSIONS in eZ_assess php we must check if the person is in the study If this is the case then the rules change Rather than a maximum of 10 we look for a maximum of 24 records If no record exists in NEXTSESSIONS we don t ran domly generate the sequence we obtain it from csv RandomStudyCases csv e After 24 keys have been fetched a Thank you for completing the study is issued 4 We also introduce a fourth type of anaesthetic record infrequently used but a challenge This is for cases 80133 and S0135 The Y measurements for this record are non linear overall but linear between 20 and 160 mmHg The solution here is to identify the record signalling its presence by a Y calibration measurement from 10 mmHg on the chart to 160 mmHg about 49 mm absolute If the measurement is greater than the 160 mark we interpolate up to 200 with the distance from 160 to 200 being 3 of the total calibration distance and regard any value above this as 200 if the value 1s under 3 of the total distance we take this as a special case similar to the usual low cutoff See TestYCal etc 5 On testing 5 2 2009 we discovered several problems The one is that it is possible for IDAS to record a mean pres
268. heet href css eZstyle css gt script src js analysis8 js type text javascript script script type text javascript 41 BARSCALE 4 global multiplier for bar height CASE S thiscase 10 WORKING PHP CODE 250 ASSESSOR NEXTITEM thisass lt br gt lt a href nextlink NEXT CASE amp gt amp gt a p a href view asses SImage0 SImagel stub stub png finalimages S thiscase m png png finalimages S thiscase s png DrawMsg 800 10 280 80 60 h3 Assessor h3 ASSESSOR white r DrawMsg 801 10 350 80 60 n3 Case casei lt h3 gt CASE white 10 INTERV EN Writelegend 10 COLOURS IONS 9 DrawMsg 802 10 430 100 200 NEXTI EM white better than with Writelec HTML1 write first manual array get relevant unique ON ESESSION entry SE ERE ON ROM ON R r ES ECORD a AND ON Gl ECT MIN onesession F ESESSION Anrecord AN SUBJECT sCode thiscase ANRECORD manual 1 list mansession GetSQL hand qry WH ESSION ANRECORD SUBJECT nrecord AND ANRECORD Subject ESESSION Person Sthisass AND SUBJECT si DB qry get first such session might fal SELECT rimage FROM RATING W
269. his value is the session ID SID Once the invoking page has said require once ValidFx php it can actually invoke validate login We submit the parameter value SHOW USER to this func tion although at present this value isn t checked or used The script sets the global USERKEY to the user primary key from the SQL database table PERSON and handDB becomes an open handle on the database It s a good idea to set the variable THISPAGE prior to calling routines from ValidFx php although a null value the default is also acceptable Here s the initial code header Cache control no cache require eZ GLOBALS php require ancillary php require SCONNECTIONPATH validate login Now for the function that actually performs the log in validation If an SID already exists for this user stored in a cookie and checked against the database then val idate login succeeds but otherwise we pop up an error Oops page On success we not only provide a handle to the database but we also provide information about the user including their status and the last page they visited function validate login Sshowuser GLOBAL handDB GLOBAL USERKEY GLOBAL THISPAGE f1 connect to database handDB eZ database connect 22But it s a particularly bad idea to encourage a user to visit a page which was accessed using a POST method so we routinely comment out the USERKEY allocation on
270. href http www anaesthetist com eZ mainpage php onclick return ConfirmLeave document write lt img border 0 title Back alte eZ logo src images tinyezlogo png a document write lt br gt lt br gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 143 document document document document document document document document document document document document write write write write write write write write write write write write y lt span class invisiblewarning ide loadingLabel gt Loading lt span gt T img name clock src images clk0 png alte vidthe 48 height 48 gt xb class invisiblewarning id elapsedLabel Elapsed amp nbsp time b lt br gt 7 lt span class invisiblewarning id elapsedTime gt lt span gt m xbrosnbsp lt p gt lt input type button style width 80px onClicke DoNext id nextbutton v lt p gt lt input type button style width 80px onClick ShowArtefact id artbutt lt p gt lt input type button style width 80px onClick Intervene id intbutton lt br gt lt br gt 7 Y lt span class invisible shocking id thanks1 gt Thank you lt span gt lt div gt function WriteDisplaypanel x y w h values are e g 124 1 820 455 document document document document document document document document document documen
271. ie my Se Se _ my 1 SLINECOUNT 1 Print n n DIED Data line 1 Mn Message Se SEXITCODE 128 exit SEXITCODE die An Fatal 4 1 2 A DOS batch file xml2csv Here s the batch file xm 2csv bat used to invoke the XML translation from the DOS command line 4 FORMAT TRANSLATION EZ XLATE 89 echo off cls rem Translate XML to CSV perl ez xlatelez xml2csv pl 1 ECHO Error level ECHO SERRORLEVELS It should be placed in the ez directory The sole argument is to the source XML file An example is in this test file test x2c bat echo off cls echo Translate XML to CSV test only perl ez xlatelez xml2csv pl test xml debug 2 logprint 0 ECHO Error level ECHO SERRORLEVELS oo 4 FORMAT TRANSLATION EZ XLATE 90 4 2 Translate from CSV to DAT Given CSV files we next need to translate the columns of CSV data into a for mat recognised by SAFERsleep We write a custom Perl program to make this translation from CSV to a SAFERsleep file Note that the first line of the CSV file to be converted must contain timestamps in the format 2006 03 31710 09 42 There s another potential catch if a mean pressure is absent it s tempting to calculate this here We do not do so The NBP m value must have been worked out and inserted into the source CSV file There are four major wrinkles here
272. ile SIDX lt MAXIDX my 54 amp ReadLine STIME ProcessDatum TIME 54 SRECORDTYP r D I my datumC amp ReadLine amp TesttFinal STIME datumC amp ReadSpO2andE CO2 SEZDIR SRAWFILENAME S DURATION Print An END of data acquisition n n 1 amp WriteAllData TIMESTAMP if SWARNINGS gt 0 Print An NOTE There was were SWARNINGS warning s N Please consult the log 0 SEXITCODE 32 y print An Finished Nn sCloseLog LOGPRINT exit EXITCODE A simple routine to check whether something x is within a range sub ISIN my x Qv Sx v _ if x gt v 0 amp amp x lt v 1 amp Print An Check x is between v 0 and v 1 3 return 1 y amp Print An Check x is NOT between v 0 and Sv 1 3 return 0 A debugging print routine sub Print my p level 4 level is debugging level f 0 none 1 overview 2 detail 3 picky Sp 51 1 8 if SDEBUG gt level f if level is 0 always print if SLOGPRINT 2 EZ CAPTURE MANUAL DATA CAPTURE 24 print LOGFILE p return y print p f console print D I 2 3 2 Utilities A death routine for fatal errors sub Die my Se Se _ my 1 SLINECOUNT 1 Print n n DIED Data line 1 N Index SIDX An Message e
273. in Shour amp DoubleDigit Shour Smday amp DoubleDigit mday Smon amp DoubleDigit mon Smon january is zero return year mon mday hour min sec sub DoubleDigit Si i 0 if length i gt 1 return i im return 0 i 4 concatenate my Here s a routine that loads the connection string and returns it The specified file is opened and the string retrieved it s the first non null line that doesn t start with a sign sub GetConnectionString my EZDIR CONFILENAME SEZDIR CONFILENAME _ my conf EZDIR SCONFILENAME open CONF conf or amp Die Can t open conf my seek 20 max lines my Sopt vhile seek 5 0 5 CONF naive 3 RETRIEVE FILES FROM SAFERSLEEP USING PERL 82 if length _ gt 2 amp amp Nw NS chomp sPrint An Connection string lt Sopt gt 3 close CONF return opt return string y seek close CONF amp Die Connection string not found in lt conf gt 3 1 The connection string Here s the file connect string txt containing the database connection string It is written directly to the ez directory This is a dummy version of the actual connection string and should be modified using the correct parameters Connection string for SAFERsleep database Driver SQL Server Database Server Se
274. in certain countries either by patents or by copyrighted interfaces the original copyright holder who places the Program 13 LICENSING 325 under this License may add an explicit geographical distribution limitation excluding those countries so that distribution is permitted only in or among countries not thus excluded In such case this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the General Public License from time to time Such new versions will be similar in spirit to the present version but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Program specifies a version number of this License which applies to it and any later version you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Program does not specify a version number of this License you may choose any version ever published by the Free Software Foundation If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different write to the author to ask for permission For software which 1s copyrighted by the Free Software Foundation write to the Free Software Foundation we sometimes make exceptions for this Our decision will be guided by the two g
275. ing Excel lt lt the file sav u as 231 lt i gt original lt i gt file and do lt b gt not lt b gt view edit save it Excel wil 1 likely subtly alter the format timestamps causing pe lt h3 gt Restore lt h3 gt lt div class narrow gt The following section must lt i gt only lt i gt be used to restore an uploaded CSV file over a lt i gt brand new lt i gt recreation of a database You will probably never have to use it The database name should be that of a CSV file already uploaded to the lt i gt csv lt i gt subdirectory Do not specify the suffix or the directory only the file name lt p gt lt FORM name restoredatabase ACTION restore_db php METHOD POST onSubmit return CheckRestore this gt lt br gt Database name lt input type text name csvname size 16 gt amp nbsp amp nbsp lt INPUT TYPE submit NAME submit VALUE Restore database lt form gt lt p gt The file name as uploaded must end in a lowercase csv and is case sensitive lt div gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML1 restore db php We read in a CSV and restore the database if possible header Cache control no cache require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE 10 WORKING PHP CODE 23
276. inpage php we encounter a problem the altered cookie is only seen at the next browser page load so login fails If everything worked according to plan we load the main page Section 10 1 Here s that processLogon function where we confirm the md5 encrypted user password using the schema described below It is very desirable to use Javascript md5 encoding of all passwords prior to submission We encrypt the password provided by the user in the first page and check the submitted value in the destination page To encrypt the password we set the password value to the md5 string provided by Paul Johnston s Javascript routine hex md5 See Section Next we implement a similar but more complex encryption of user pass words Now if we simply encrypt the password then anyone intercepting this md5 encrypted password can always use it to log on So we must provide some thing salt from the server side so that every new session is distinct Salt values must also expire and be used once only We proceed as follows 1 We already have a way of determining whether a user is logged on or not we store a session ID and clear it at log out Sessions expire 2 When someone requests a log on we provide a salt value in the log on page The server also increments the SALT table index once the salt value has been provided Note that this approach has not been formally cryptographically tested There s also the matt
277. ion value firstcomment NoSemicolons firstcomment if firstcomment length 3 alert Please describe your interventionl return false y ReplacelnnerText labelb Which variable s prompted your response RevealMiddleInputs RevealBottomInputs document getElementById okb style visibility visible ok button ugh document getElementById oka style visibility hidden hide self alert Intervention recorded function ShowArtefact DisplaceControlPanel move panel left up ReplaceInnerText labelb Which readings are artefactual HideThanks NextOff IntOff ClearMinTimer StopClock MessagePaused TIMESTAMP GetTimestamp RevealBottomInputs document getElementById acancel style visibility visible ugh document getElementById okc style visibility visible ugh document getElementById myBackground style visibility visible function CancelArtefact RestoreControlPanel IntOn CancelIntervention function CancelIntervention alert Cancelled as requestedl Messageon RestartClock ClearAllValues NextOn ArtOn HideAllInputs document getElementById myBackground style visibility hidden function StoreAnnotation if StoreAndThanks 1 1 annotation MoveToNextImage b else alert Please select AND rate intervention and choose one of SBP EtCO2 y
278. iotic warning under XP Win2K we can write a PNG SWINW SWINH THIS MAKES A PNG 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 112 next end of repeat capture loop rr mv If STESTNOSERVER 0 Then EndCapture 1026 431 Else EndCapture 959 424 EndIf Sresponse MsgBox ONTOP 1 Debug Next anaesthetic 10 pause briefly or default to yes If response 2 Then SISMORE 0 EndIf Wend END BIG OUTER LOOP FOR SINGLE ANAESTHETICS Exit terminate FUNCTIONS l LeadZero n This checks length and if under 3 prepends zeroes Func LeadZero n While StringLen n 3 n 0 n Wend Return n EndFunc Func CheckAntibiotic If WinExists Antibiotic Warning 1 Then WinActivate Antibiotic Warning Send ENTER EndIf EndFunc Func SetConstantTime Local tNew format is Date Time EncodeSystemTime iMonth iDay iYearl iHour O iMinute 0 Set new system time StNew Date Time EncodeSystemTime 4 30 2008 12 00 00 Date Time SetSystemTime D11StructGetPtr tNew EndFunc Func RunSaferSleep TESTNOSERVER xguest yguest 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 113 run safersleep here might get path to idas from registry but for now idaspath C Progr
279. ist is stored separately in the RATING table We provide the facility to store the image number rImage the timestamp when the rating occurred the nature of the intervention s proposed stored as binary flags in rIflags an optional comment on the intervention rlcomment with a numeric rating of the perceived importance of the intervention 1 is low to 5 is high We also have flags indicating the variable s prompting an intervention rAflags and an associated comment CREATE TABLE RATING rating integer constraint BadRating primary key rating rImage integer rTime TIMESTAMP r flags integer rIcomment varchar 250 rlimportance integer rAflags integer rAcomment varchar 250 Onesession integer constraint badRatingSession foreign key Onesession references ONESESSION 8 7 NEXTSESSIONS We will randomise sessions by assessor in blocks of ten The rational for this approach is to ensure that all anaesthetists who are assessing anaesthetic records online view similar sets of anaesthetics but that the order of presentation of pairs of records electronic vs manual is random so any learning effect for a partic ular pair can be accounted for by assessing the responses of a large number of anaesthetists In addition it is anticipated that anaesthetists will vary in their en thusiasm and some will be keen to assess a large number of records others will drop out Using the ap
280. it flags if so enable next step EndIf SGOODITEMS bitAND perlok 31 SetGoodItems GOODITEMS vSBP vDBP f bits that are set indicate errors SvHR 5 2 SvETCO2 sgBox SONTOP EndIf t Oops 2 Else Failed to add StoreParam EZPATH FILENAME SEZ VALIDFLAGS GOODITEMS Store valid Case msg mDAT MsgBox ONTOP Debug Arguments for ez csv2dat pl FILENAME amp m datri perlok RunWait GComSpec c perl amp _ SEZPATH amp ez xlatelez csv2dat pl amp SFILENAME amp m datrules txt kPa 1 SEZPATH kPa 1 flag forces conversion from mmHg to kPa If perlok 0 Then MsgBox ONTOP Note Conversion was successful TestFile mSS SEZPATH amp dat SFILENAME m dat Else MsgBox ONTOP Debug Return code was amp perlok EndIf Case msg mSS If AddToSSList SEZPATH FILENAME m DURATION gt 0 Then if success SISLISTED BitOR SISLISTED 1 bit set manual StoreParam SEZPATH SFILENAME EZ ISLISTED SISLISTED Store listed sgBox ONTOP Success Added to play list 6 FILENAME 6 m DAT If SISLISTED 3 Then if both flags set myEnable REPL EndIf or make this
281. js analysis8 js type text javascript gt lt script gt lt script type text javascript T BARSCALE 4 global multiplier for bar height CASE thiscase ASSESSOR thisass NEXTITEM lt br gt lt a href nextlink NEXT ASSESSOR amp gt amp gt lt a gt lt p gt lt a href view ce SImage0 png finalimages thiscase m png stub SImagel png finalimages S thiscase s png stub DrawMsg 801 10 280 80 60 h3 Case h3 CASE white DrawMsg 800 10 350 80 60 h3 Assessor assic h35 ASSESSOR white Writelegend 10 10 COLOURS INTERVENTIONS 9 DrawMsg 802 10 430 100 200 NEXTITEM white better than with Writelec HTML1 10 WORKING PHP CODE 255 write manual array first get relevant unique ONESESSION entry Sqry SELECT MIN onesession FROM ONESESSION ANRECORD SUBJECT WHERE ONESESSION Anrecord ANRECORD anrecord AND ANRECORD Subject SUBJECT si SUBJECT sCode thiscase AND ONESESSION Person thisass AND ANRECORD manual 1 list Smansession GetSQL handDB ary get first such session might fa gry SELECT rImage rIflags rlimportance rAflags rTime rIcomment rAcomme FROM RATING WHERE Onesession man
282. l cookies length i temp cookie a all cookieslil split cookie name a temp cookie 0 replace Ns Ns t g if cookie name check name b cookie found true if a temp cookie length 1 cookie value unescape a temp cookie 1 replace Ns Ns g return cookie_value break a_temp_cookie null Cookie name if b cookie found return null function Delete Cookie name path domain if Get Cookie name document cookie name 4 path path path domain domain domain expires Thu 01 Jan 1970 00 00 01 GMT 5 lt script gt lt head gt lt body gt table width 95 gt lt tr gt lt td bgcolore FOFOFO class marginal width 200 lt h2 gt Welcome to eZ lt h2 gt lt p gt If you have a user name and password you Can log in on the right Alternatively you may wish to lt ul gt lt li gt Try a lt a href demo demo15 htm gt demonstration lt a gt None of your inputs will be recorded lt li gt Look through our xa href GPL htm comprehensive documentation and source lt ode lt a gt li Read our lt a href help index htm TARGET _blank gt help pages lt a gt Click on the link to open a new browser window that contains the help menu lt ul gt 9 PHP ACCESS CODING 181 lt td gt lt td width 80075 lt
283. lay list via IDAS cho echo test x2c demo xml to csv echo test c2d demo csv to dat echo test csv2dat demo captured csv to dat echo test captur demo raw csv processing cho Note that DogWagger is a Perl program written for Perl version 5 6 It uses the Perl Tk interface For mysterious reasons Tk has been excised not only from more recent versions of ActivePerl eg 5 8 and 5 10 but even from current version 5 6 even though previously available versions included Tk This is frustrating and irritating You will either need to run a more recent version of Perl installing Tk and perhaps modifying the code slightly or use an older version Drop me a line 14 HARDWARE SOFTWARE USEFUL FILES amp CHANGE LOG 328 14 1 Change Log Changes for versions 0 35 0 36 1 Fixed Y calibration in ez captur pl Previously because we cycled the times we overwrote Y calibration values 1 Push values to a stack rather than writing to array Fixes the problem with overwriting at same time ie push YCALS to store each value and for GetYCal sum the values dividing by their length 2 Amendments to the capture of raw data a Modified the Autolt program so that it expects three sets of data rather than one b Start as usual with zero and cal but at end of first series systolic blood pressures terminate before repeat zero and cal i e enter Excel c Autolt saves this series as eg X0001 sbp csv d Likewise for X00
284. le visibility hidden document getElementById sectionc style visibility hidden document getElementById labeli style visibility hidden document getElementById rankingl style visibility hidden document getElementById ranking2 style visibility hidden document getElementById acancel style visibility hidden ugh document getElementById okc style visibility hidden ugh function RevealTopInput document document document getElement getElement getElement s ById ById ById oka style visibility visible cancela style visibilitye visible sectiona style visibility visible function RevealMiddleInputs document document getElement getElement ById ById 7rankingl style visibility visible ranking2 style visibility visible function RevealBottomInputs document document document document getElement getElement getElement getElement function ConfirmlLeave par KeepALLWEBDATA if y return true y return false ById textb style visibility visible ById labelb style visibility visible ById sectionc style visibility visible ById labeli style visibility visible e handling confirm Are you sure you want to leave this page THISIMAGE 5 1 alert Your current position and any comments you ve made on this pag
285. lign center gt 5 lt td gt i align center gt lt input align center gt lt input align center gt lt input align center gt lt input align center gt lt input SCH i an 2 gt 0 type radio type radio type radio type radio type radio id ranking2 name iRank name iRank name iRank name iRank name iRank onClick gt please comment below lt span gt name intervention onClick i i id texta gt lt textarea id oka value OK id cancela 17 value 1 value 2 value 3 value 4 value 5 id labelb gt lt span gt lt b gt value id r1 id r2 id r3 ide r4 id r5 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 145 document write SEL document write as ys document vrite lt div class invisible mymenu ide sectionc document vrite lt input type checkbox name sbp ide checkbl onClick document vrite span ide labelc 5Systolic BP lt span gt document vrite lt br gt lt input type checkbox name dbp ide checkb2 onClick gt document write span ide labeld Diastolic BP lt span gt document vrite lt br gt lt i
286. ll GetRadioValue document myform iRank alert Debug rank value is rankall if ixall rankall return 0 y y datastring img THISIMAGE t TIMESTAMP iflags ixall cl firstcomment rank rankall laflags flagall c2 secondcomment alert Debug data are datastring ClearAllValues ALLWEBDATA DATUMCOUNT datastring DATUMCOUNT document getElementById myBackground style visibility hidden 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION ShowThanks annotated NextOn ArtOn IntOn HideAllInputs return 1 function ClearAllValues document myform intervention value document myform variablecomment value document myform sbp checked 0 document myform dbp checked 0 document myform mbp checked 0 document myform hr checked 0 document myform spo2 checked 0 document myform etco2 checked 0 document myform fluid checked 0 document myform analgesia checked 0 document myform vasocons checked 0 document myform inotrope checked 0 document myform bblock checked 0 document myform incvent checked 0 document myform decrvent checked 0 document myform upfio2 checked 0 document myform iother checked 0 ClearRadiobuttons document myform iRank function NoPipes str return Clipout str function NoSemicolons str return Replace str
287. llowing DURATION and ALPHA INTERVAL 2 5 5 or 10min WRITE TO PLAYLIST See GetFileList etc Changes for version 0 37 1 Finalised replay through IDAS Complex Enabled invocation of replay in main GUI Insert non displayed entries to be read by IDAS every 30s as DEMO DAT always plays values every 30s regardless of time Enter the end time as accurately as possible Now we store the duration as a parameter and pass it around using the duration and start time to display SpO requests etc with actual times rather than offsets We can also check the duration at various points We can also use the duration to calculate alpha Our reference time interval is always 5 min If just 10 minutely values are charted then NAs must always be inserted in between by the capturer Note that if an anaesthetic starts at a time not divisible by e g 5 min or the relevant number of minutes corresponding to alpha then we should start recording at the first integral time before the actual start time and record the first datum as zero zero missing Conversely if the anaesthetic doesn t end on a mark non integral time with respect to alpha then we must record the final value but not put in a missing value at the end In measuring the x duration we should measure from the point at which we start recording even if this is before the actual start of the anaesthetic i e on an integral boundary and end at the last mark eve
288. ls valign bottom EEN i if ht amp amp 1 a Smy SEEN 1 gt Snumcols 11SEEN Si 1 if las gt SmySE t in line for current person s count get top size table class feedback tro lign bottom gt lt img src images CLEAR png images greycol png EN imgname images redcol png Sht print i int D I print lt lt lt HTML5 lt tr gt lt tr gt lt td colspan tcols img src images CLEAR png lt table gt HTML5 function PieGraph mySE Smy INCORRECT print ht x SSCALE EN I SmySE lt img src S imgname myCO N myCORRECT lt div align center gt width imgvidth RRECT 272 width 7 gt lt b gt StopNUM lt b gt lt td gt width 5 height leftBJ or move this down or at top height ht alt td width 400 heighte 7 alt f ugly inline javascript 11 ACTUAL ENTRY OF DATA 273 print lt h2 gt Correct identification lt h2 gt print div id pieCanvas style overflow auto position relative height 35 print script type text javascript print var p new pie print p add Incorrect S myINCORRECT print p add Correct myCORRECT
289. lse function IntOff document getElementById intbutton disabled true function IntOn document getElementById intbutton disabled false function ArtOff document getElementById artbutton disabled true function ArtOn document getElementById artbutton disabled false function BrieflyDisableNext NextOff AAGH setTimeout ReEnableNext ONESECOND function ReEnableNext ClearMinTimer in order to set it in a moment NextOn SetMinTimer ONEMINUTE ONESECOND 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION ShowNextImage simply display next image after incrementing count function ShowNext Image if QuickShowNextImage 0 return 0 y KeepALLWEBDATA return 1 can continue function QuickShowNext Image THISIMAGE if THISIMAGE 5 TOTALIMAGES if completed THISIMAGE ClearMinTimer StopClock ArtOff IntOff disable NextOff alert Replay completed Thank you var finaldata ReviewData var wd document getElementById WebDataString wd value finaldata store value for PHP script to read enable final overall assessment ClearLayeredImages MYIMAGES 0 src images CLEAR png ReplaceInnerText elapsedTime end document getElementById finalReport style visibility visible user will now click on Submit button return 0 stop y Messageo
290. ly unwise 12 ANCILLARY CODE 318 12 7 4 Working code Let s flesh out the above ideas First we will generate a number which reflects a timestamp without being a full timestamp We will use the microtime timer to obtain a microseconds stamp which we modify as follows function ModTimeNow list usec sec explode microtime sec 1000000 4 modulo 1 million seconds Sstamp int 1000x float usec float sec return stamp Let s assume that we want a granularity of 1 millisecond in our counting We wish to time out if a key locks for more than say a few seconds say 2 seconds We ll use a large safety factor so that even if a process fails in the middle of key retrieval several days must elapse before the process briefly appears not to have failed again The number we store is thus the current UNIX timestamp modulo 1 000 000 seconds We add the microseconds multiply this modified number by 1000 to get millisecond chunks and thus create an integer value between 0 and 1 billion A subsequent program which is locked out calculates the current timestamp modulo 1 million seconds as above If the value has wrapped the current is less than the stored value we first add 1 million to this number but otherwise we simply find the difference If the difference is over the cutoff say 2 seconds 1 e 2000 microseconds then timeout has occurred and we act accordingly We have
291. m vETCO2 2 GUICtrlCreateCheckbox 2 7x hskip 5 pitch and set the Valid flags SetGoodItems GOODITEMS SvSBP vDBP vHR vSpO2 vETCO2 graphics arrow from parse valid to CSV2DAT UICtrlCreatePic ez images arrow gif 3 3x hskip 3x pitch 80 40 arrow from get from SS to IAR2XML UICtrlCreatePic ez images arrow gif 1 2x hskip 7 Spitch 80 40 down arrow from add to replay UICtrlCreatePic ez images arrowdn gif 6x hskip 3x pitch 90 110 up arrow from add to replay Q q Ss Q GUICtrlCreatePic ez images arrowup gif 6x hskip 5 8x pitch 90 110 ma Dim vwXML GUICtrlCreatePic ez images seexml gif 2x hskip 7 8x pitch 60 CSV Dim vwCSV GUICtrlCreatePic ez images seecsv gif 1 62x hskip 3 8x pitch Dim vwCSV2 GUICtrlCreatePic ez images seecsv gif 3 Shskip 7 8 Spitch 60 dat Dim vwDAT GUICtrlCreatePic ez images seedat gif 4 Shskip 3 8x pitch 60 Dim vwDAT2 GUICtrlCreatePic ez images seedat gif 4 Shskip 7 8 Spitch 60 Sslist txt Dim vwSS GUICtrlCreatePic ez images sslist gif 5 4 Shskip 5 1 Spitch 60 right brace for SBP etc GUICtrlCreatePic ez images rbrace gif 1 2x hskip 1 3x pitch 40 4xS pitch right brace for valid GUICtrlCreatePic ez images rbrace gif 2 9x hskip 1 3x pitch 40 4xS pitch Special graphics view Log clickable Dim imCSV GUICtrlCreat
292. ming Cookies and reload enabled Fixed some problems with mean blood pressures and missing pressures and inappropriate subscripting in Perl Calculate more accurate mean incorporate HR Activate trimming and subtraction of images based on first image using ImageMagick as described below Changes for version 0 41 1 2 LA PHP scripting of the web interface Pretty up introductory screens START FF more explicit menu layout improved Pause after 2 min are you still there Talk about interpolation limited data etc early on but We will also demo x1 first walk them through What about the first hour last hour scenario max 2 hr No just first 2 hr Where IDAS graphics are poor re run perhaps fix times 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 332 10 11 12 13 14 15 Get a good real anaesthetic to review MSIE Stack overflow at line 0 intermittent Occurs if out back Investigate consequences in MSIE of loss of an image Perhaps test for this But there seems to be some other problem Is it a state variable being retained Look at divisions Improve footer colour from greenish Perhaps increase timeout to 3 min Left margin in CSS Plan out each 10 cases FANCY LOGO at start Changes for v 0 42 1 2 10 11 12 Fix up demo done A final comment added now fix interface Introductory menu as text no But tried
293. modification would be to use a mi crotime value combined with a UNIX timestamp modulo an appropriate interval It would then be wise to determine the maximum key value ever and always add this to the modified timestamp to prevent that odd failure See below 2 There is a residual catch How do we obtain our value if 1 ok return 0 fail 3 GetSQL handDB SELECT uValue FROM UIDS WHERE uValueLock now get new key Sq The above ensures that if a reset has already occurred the key fetch will fail It is true that if this occurs then there will be a gap in the record but this gap signals a process defect which must be identified The important consideration is that if the timeout detecting process now kicks in the number will still be updated If it doesn t then the following vvill succeed and the tvvo are mutually exclusive 3 Finally allovv others to get the next value DoSQL handDB UPDATE UIDS SET uValueLock 931 SET uValue j WHERE uValueLock now release lock This will fail if somebody has already performed the reset but even then the increment will have occurred and we can proceed so there is no need to test for success Note that the casts and multiple accesses in the above will tend to slow things a fair bit so if we really require vast numbers of keys generated quickly this solution is probab
294. my datrules LOCALPATH SRULEFILE open DATRULES datrules or amp Die Unable to open datrules my DATRULES lt DATRULES gt 4 load all lines close DATRULES SFILENAME SLOCALPATH FILENAME open FILE FILENAME or amp Die Unable to open source file lt SFILENAM sPrint Debugging file FILENAME 1 my QINDATA lt FILE gt close FILE my doutf SOUTPATHSLOCALFILE dat Print An Source file lt FILENAME gt n Output path lt SOUTPATH gt An Local file SLOCALFILE An Output file lt Sdoutf gt 2 open DOUTFILE gt Sdoutf or amp Die XCRASHx Could not open output DAT FILE doutf n obtain headers from input file SINDATA 0 get header lin my COLNAMES split get names my cc 0 clumsy count my cn my SCOLLOOKUP foreach cn COLNAMES COLLOOKUP cn cc sPrint An Column lookup cn gt cc 3 debug cc hy now given name can get position of column HERE WILL PROCESS datrules txt into RULES array my GRULES my SRCOUNT 0 my dr foreach dr DATRULES if dr wx if comment 4 ignore elsif length Sdr lt 4 ignore short lines E gt
295. n var ti THISIMAGE 1 10 modulo if ti 0 check me ClearLayeredImages document images mainimage src MYIMAGES THISIMAGE src y var fred document getElementBylId XImage ti fred src MYIMAGES THISIMAGE src return 1 can continue clear given set of radio buttons function ClearRadiobuttons g for i 0 i g length i if glil checked true glil checked false thanks to http www somacon com pl43 php for function GetRadioValue radioObj if radioObj return 0 var radioLength radioObj length if radioLength undefined if radioObj checked 136 7 EZ SHW AN INTERACTIVE return radioObj value else return 0 bl for var i i radioLength if radio0bj i checked return radio0b3 i value return itt 0 function DoSubmit WEB BASED APPLICATION 137 var valid false var rank GetRadioValue document myform rankF var rec GetRadioValue document myform fRec var choice GetRadioValue document myform fChoice var b4 GetRadioValue document myform fBefore alert Debug values are rank rec b4 if rank gt 0 amp amp rank 6 88 rec gt 0 amp amp rec 3 88 choice gt 0 amp amp choice lt 3 amp amp b4 gt amp amp b4 3 valid true
296. n If SFIVEITEMS 31 Then if bits 0 4 are not set myDisable mCSV EndIf CSV to DAT is enabled when all processing was valid myDisable mDAT TestmDAT mDAT EZPATH FILENAME m FIX THIS gt TestFile INNNNNNNNNNNOOOOOOOOOO Must check on status of Perl submission FIX ME Add to SS list manual is valid when CSV to DAT succeeded myDisable mSS TestFile mSS SEZPATH dat FILENAME m dat Hmm Replay via SS is only valid when both ADD buttons succeeded myDisable REPL If SISLISTED 3 Then SS if both flags set 30 30 30 30 30 2 EZ CAPTURE MANUAL DATA CAPTURE 44 myEnable REPL EndIf or make this a rtn Convert to XML is only valid once get from sS succeeded myDisable sXML TestFile sXML EZPATH amp iar FILENAME iar XML to cSV is valid once convert is ok myDisable sCSV TestFile sCSV EZPATH 6 xml FILENAME xml ss CSV to DAT is valid once CSV made myDisable sDAT TestFile sDAT EZPATH 6 csv FILENAME s csv Add to sS list ss is valid once DAT made myDisable sSS TestFile sSS SEZPATH 6 dat FILENAME s dat test for dud buttons If mCSV 0 Then MsgBox ONTOP Error Dad button mCSV EndIf GUI MESSAGE LOOP
297. n if the anaesthetic ends several minutes after this Our rationale is that our x measurement is a calibration value and if we measure between manually constructed marks on the chart this is less reliable that if we measure between pre printed lines on the chart In addition if we either skip or include both the start and the end there is too much variability a nominal 9 minutes or 2a for us to check things accurately 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 330 5 Based on the preceding points a Acquire end time and duration within ez gui au3 check that these match and pass duration as a parameter to ez captur pl b In ez captur pl accept duration as a parameter and check this against the measured duration failing 1f the two don t match The only role of the time passed to this program is in calculation validation of alpha c Similarly pass duration to the keyboard capture routine ez keyboard pl 6 Also added a Operation name and b Brief description of the patient 7 Added ability to view CSV XML DAT files from GUI 8 QUIT button added to entry screen for GUI 9 Confirm OVERWRITE if file exists for raw data Also back up prior file 10 WEB PHP CREATION TO UPDATE Changes for version 0 38 0 40 Main focus will now be to get layered z index web page fully functional dis playing 200 or more layers Will also allow translucency in MSIE version 6 for the overlay when intervention is specifie
298. n of the record 5 Measurements above the calibration range will be recorded as outside the range rather than extrapolated values 2 2 Algorithm pseudocode We here develop some sketchy pseudocode that interprets data read in as a CSV file Even if you are very adept at Perl you might still wish to glace through this simple pseudocode before you move to the Perl code in the next section as this code is very simply written Each CSV file has an initial header line that can be ignored followed by any number of lines until end of file As this is DOS each line ends in CR LF hex adecimal OD 0A Each line is numbered sequentially followed by a comma and a single numeric value Main routine Let s create a pseudocode representation of the process The overall plan is to initialise certain variables check the basic calibration measurements and then process each data line in turn variables sbp dbp hr spo2 etoo2z idx 0 index into variables SetInitialValues datumA ReadLine t lt 0 if not datumA in ZERO gt fail Bad initial zeroing StoreZero t datumA datumB ReadLine MAXVAL ALPHA MINVAL TestYCal datumB datum lt ReadLine DURATION lt TesttCal datumC linecount 0 until end of file ReadLine datum t lt ProcessDatum t datum t is an integer end until datum lt ReadLine TesttCal datumC final check of data 2 EZ CAPTURE MANUAL
299. naesthetic we will not allow the manual view to follow the automatic immediately or vice versa Otherwise any order is permissible At the end the assessing anaesthetist is asked whether they thought this was a manual or an automated anaesthetic record VVe must consider in some detail the implications of multiple recorded values for an automated record versus interpolated values for the manual one It may well be necessary to interpolate on the manual record 10 WORKING PHP CODE 201 Add a new person User Superuser Person s details Forename Jane Surname Doe Year primary anaesthetic 1994 qualficaton gained Gender F y Role anaesthetist Please state main Mainly public area of practice Does anaesthetist have a favoured Cardiothoracics i y area of practice Enter new person Clear Form Return to main page Figure 5 Adding a new anaesthetist assessor 10 3 Entering a person Here we enter basic information about a person The person might be an anaes thetist assessor or a superuser When the administrator clicks on the Add new button the data are submitted as POST data to the PHP script called eZ_admin_personadded php Preliminary processing 1s first performed by the Javascript in the header of the page For superusers we can leave out values for First Qualified Current Spe cialty and Current Location At present we won t capture ethnicity email tele ph
300. ndDB FORENAME SURNAME STARTYEAR GENDER PERSONROLE SCURRENTSPECIALTY CURRENTLOCATION INSTUDY if SNEWID gt 0 print lt lt lt HTML2A lt p gt New user added lt p gt SFORENAME SURNAME has been added to the database Role code PERSONROLE HTML2A y if strlen STARTYEAR gt 3 print This person first qualified in STARTYEAR y E print lt lt lt HTML2X lt p gt It is now wise to add LOGIN details for this user Click a href eZ_do_editlogon php editlogon SNEWID gt here lt a gt to do sol HTML2X print lt lt lt HTML2E lt p gt lt a href eZ_add_person php gt Add lt i gt another lt i gt person lt a gt lt p gt lt a href mainpage php Return to main page lt a gt HTML2E else ARE similar cases print lt lt lt HTML2B FORM namem eZ added ACTION eZ admin personadded php myself METHOD POST onSubmit return CheckInput this gt lt input type hidden name forename value SFORENAME gt lt input type hidden name surname value SSURNAME gt lt input type hidden name startyear value SSTARTYEAR gt input type hidden name gender value SGENDER gt lt input type hidden name personrole value SPERSONROLE gt lt input type hidden name cu
301. now es tablish associative array of times my TIMECO my SALLTIM my j my ABEL oe Ur oe foreach j UNT ES 0 O each of which will refer to an unnamed 0 and array of labels INDATA SLIN if 3 ECOUN lt data gt lt time gt lt time gt lt label gt lt label gt lt value gt lt value gt lt my t 1 my my v if my f here s t H if if LABELS lbl Snow Print 12 y bl 2 3 exists SALL SALLTIMES St STIMECOUNT amp Print 4 IMES t TIMECOUNT line t c STIMECOUNT 2 nov SALL he tric label not yet defined make array exists LABELS lbl my lblarry os LABELS lbl lblarry IMES t ky bit v Storing value v for label store value for this 57 against this label Nn 1bl at time Snow 4 FORMAT TRANSLATION EZ XLATE 86 my STRIPLETS STRIPLETS NBP 1 signal a pressure next debug recover all values First the headers if header in triplets then make THREE headers print COUTFILE Time my headers keys SLABELS my h foreach h headers if exists TRIPLETS h amp Print An Triplet header h s h d h m 3
302. nput type checkbox name mbp ide checkb3 onClick gt document write span id labele Mean BP lt span gt document write lt br gt input type checkbox name hr id checkb4 onClick document write span id labelf gt Heart Rate lt span gt document write lt br gt input type checkbox name spo2 id checkb5 onClick document write span ide labelg SpO lt sub gt 2 lt sub gt lt span gt document write lt br gt input type checkbox name etco2 id checkb6 onClick document write span id labelh EtCO lt sub gt 2 lt sub gt lt span gt document write div document write td document write lt td gt y document write lt span class invisible smaller id labeli Optional comment lt span gt document write lt br gt lt textarea rows 4 cols 25 class invisible id textb name variab document write lt p gt lt input class invisible type button onClick StoreAnnotation i document write amp nbsp amp nbsp amp nbsp document write input class invisible type button onClick CancelArtefact id document write amp nbsp amp nbsp amp nbsp document write lt input class invisible type button onClicke StoreArtefact id document write td document write PEPA Vs document wri
303. ns pipes Sanitise SWEBKEYDATA might be wise to limit length fix me Sanitise PATIENTID Sanitise STARTTIME Sanitise FINALRANK Sanitise MANUALORAUTOMATIC Sanitise SEENBEFORE CheckCode FINALRANK bad rank value numeric heckCode MANUALORAUTOMATIC bad value manual automatic heckCode SEENBEFORE bad coded value for Seen Before Q Q nov write to the database WE must 1 Obtain the relevant key UPDATE ONESESSION SET osFinalRank NULL WHER Sq SELECT onesession FROM ONESESSION WHERE Person SUSERKEY AND osFinalRank IS NULL mySQL quirk as before list Ssession GetSQL ShandDB q find current session 2 For each rating create a RATING table entry Srowarray explode SWHOLESTRING print lt br gt Debug whole array f print_r rowarray foreach Srowarray as Sr if strlen r gt 10 arbitrary minimum WriteOneRating ShandDB session Sr 3 complete the ONESESSION entry SREPORTTIME date Y m d h i s now 11 ACTUAL ENTRY OF DATA q UPDATE ONESESSION SE 5 os WH ERE Repor osFinal osAutomatic osSeenBefore osChoice osComment osKeyData onesession DoSQL
304. nslated form XML dat gt DAT files translated from CSV LOG gt error logging X images gt images referred to by ez TEX Table 1 Directory structure of EZ The directories ez captur ez xlate ez shw and ez replay contain the relevant Perl and or Autolt executables that perform capture and formatting of raw data obtained from the digital calipers translation between various formats display as HTML pages and replay of DAT files through SAFERsleep 1 INTRODUCTION 7 Creating the directory structure Here s a little DOS batch file makedirectories bat to create this structure if not already made echo off cls m Q ez ez ez captur png ez replay help rawdata lar Q xml csv log dat images ez info ez xlate ez shu ez shwNphp ez shwNphpNimages ez shwNphpN js ez shw php css ez shw php sql ez shw php css ez shw php png ez shwNphpNpngNtopimages ez shwNphpNpngNsources ez shwNphpNdemo ez shwNphpNdemoNimages ez shwNphpNdemoNpng Bs 8 GB B B 33355 333355 SG GG 8 1 INTRODUCTION 8 1 2 DOS execution We have created a comprehensive Graphical User Interface GUI that is described in Section 2 4 However we also have created a number of useful DOS batch files used to run components of our program suite The main advantages of this console exec
305. nt in the sql subdirectory of the current directory or creation will fail php if is null handDB provided connected if is eZ populated S handDB if batch sql statements handDB sql eZ upgrade2 sql print p SUCCESS eZ database upgraded print lt p gt lt a href login php GO THERE lt a gt here should commit mysql query COMMIT ShandDB but mySQL auto commits by default ugh else print lt p gt ERRORx Failed to upgrade eZ database else print lt p gt ei database does NOT exist y mysql close handDB removed keep database open D I 2 gt 9 PHP ACCESS CODING 177 9 PHP access coding Web pages described in the HTML Section Section 7 1 above are served up using scripts written in PHP version 5 Data obtained from the HTML pages are written to the SQL database using PHP 9 1 Logging in login php Here s the main log in script which generates a log in page by writing HTML code together with a salt number The user types in their username and password which the page encrypts and then POSTS to InitialLogon php See Section 9 1 1 Note that apart from requiring the script eZ GLOBALS php which we ve al ready defined it contains SCONNECTIONPATH this script also needs ancil lary php which is described later Section 12 In addition because the
306. nue lt a gt better is to forward to that page gt lt body gt HTML file badcode htm This file should rarely if ever be displayed It indicates that bad data have been posted to a form and in consequence display of the page failed due to the Check Code function failing on a particular datum 9 PHP ACCESS CODING 183 lt h2 gt Lost data lt h2 gt Bad numeric data were sent to a PHP script Checking of a code failed lt p gt Click lt a href http www anaesthetist com eZ mainpage php here lt a gt to return to the main page lt p gt lt hr gt lt body gt 9 1 1 InitialLogon php The following script is invoked from the form specified by login php Section 9 1 If the submitted parameters username and password are garbage we return to login php Only after we ve sanitised these values do we try to connect to the database after which we log on if we can using the processLogon function described in Section 9 1 2 This script requires ValidFx php Section 9 2 and on success passes con trol mainpage php Section 10 1 The variable LOGGED_IN is set and passed to mainpage php otherwise mainpage will again try to confirm that the user is logged in The function CheckCode is contained in ancillary php The component function Force Html InitialLogon makes use of two tiny HTML files oops1 htm and oops2 htm GLOBAL SUSERKEY GLOBAL handDB GLOBAL THISPAGE STHISPAGE
307. o an internet database for subsequent analysis The database is fully described as is the PHP code that links the web page and interacting anaesthetist to the database The suite is thus divided into the following sections Programs to capture data from a pair of digital calipers Section 2 Translation utilities Section 4 that translate from IAR to XML XML to CSV and CSV to DAT formats Programs to replay data through IDAS and screen grab the resulting display Section 5 Web display and database routines Sections 7 9 including SQL code and PHP code 1 INTRODUCTION 1 1 A note on the directory structure This has become somewhat complex so in Table 1 we show the relationships be tween noteworthy directories and sub directories In select subdirectories we ve also listed important files in parenthesis ez ez captur ez captur pl ez gui au3 ez xlat ez xml2csv pl ez csv2dat pl AnaestheticViewer exe ez shw gt sql sql script gt php gt php scripts css gt cascading style sheet images images to display demo gt images X gt png ez replay gt ez replay au3 N capture gt captured PNG images ez info gt basic Case info rawdata gt raw csv files exported from Excel lar gt grab encrypted IAR files from IDAS xml gt files exported from IAR to XML CSV gt CSV files tra
308. o2 ExtractData value sbp rsbpxcaly dbp rdbpxcaly hr rhrecaly WriteCsvDatum time sbp dbp hr spo2 etco2 rsbp end for end routine WriteAllData rdbp rhr 2 EZ CAPTURE MANUAL DATA CAPTURE 20 2 3 Perl code raw data to CSV This code is somewhat more complex than the simple schema just outlined In Perl it s probably wise to declare globals in the main routine so we don t have a separate Initialisation section 2 3 1 Main routine We start with the usual Perl shebang and a whole lot of nasty global variables not calculated to win friends Note that we do NOT at present create or check for the existence of the log rawdata and csv sub directories Creation MUST be done manually We also assume that the working directory is not the directory in which this program ez captur pl is located but the main ez directory containing the destination csv sub directory usr local bin perl w use POSIX qw floor for date calculations my DEBUG 3 0 to turn off debugging l overview 2 detail 3 nitpicking my S STORECOUNT 1 also used for debugging my LOGPRINT 1 print to log my SWARNINGS 0 see usage my EZDIR ez my SEXITCODE 0 code on exiting Perl exit code reports defects 0 ok 1 sbp 2 dbp 4 hr 8 spo2 my BASELINE 20 20mmHg or bpm my VARIABLES sbp
309. oals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally NO WARRANTY BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE THERE IS NO WAR RANTY FOR THE PROGRAM TO THE EXTENT PERMITTED BY APPLICABLE LAW EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLD ERS AND OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WAR RANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE ENTIRE RISK AS TO THE QUAL ITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU SHOULD THE PRO GRAM PROVE DEFECTIVE YOU ASSUME THE COST OF ALL NECESSARY SER VICING REPAIR OR CORRECTION IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER OR ANY OTHER PARTY WHO MAY MODIFY AND OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE BE LIABLE TO YOU FOR DAMAGES INCLUDING ANY GENERAL SPECIAL INCI DENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR IN ABILITY TO USE THE PROGRAM INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES END OF TERMS AND CONDITIONS 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 326
310. of the calibration range We will soon explore some pseudocode as an overview of our approach and follow this by actual Perl code Finally we will describe how to automate parts of this process using Autolt Rationale The above approach might seem baroque but has the following advantages 1 We provide proof of the zero value and Y calibration values for the calipers at the start of every set of measurements 2 Atthe start and end we confirm the duration of the record and also provide a means of confirming the value of o so that measurements taken between normal time intervals eg at intervals of under five minutes are reliably indicated 3 Measurement is intuitive and quick The person doing the measuring can simply measure offsets from baseline where they encounter a measurement between normal time intervals they simply measure the offset and then record the measurement as usual 3Although what probably happened was the user forgot to signal a low value under 40 and simply measured the record We will issue a warning here 2 EZ CAPTURE MANUAL DATA CAPTURE 14 4 There is a system for recording unusually low values under 40 mmHg or under 40 min 2 This is robust in the sense that simply measuring this value will signal an error unless the value is exceptionally low in the range of alpha where an interpolated value will incorrectly be recorded ultimately resulting in an error in the apparent duratio
311. olation of blood pressures Um not keen on this but the argument is that without the interpolation things are more realistic There are several counter arguments to be discussed and we need to resolve the thorny question of anaesthetists perception of what they write on paper Anyway Pve put in the facility Looks nasty but similar to the original records The controlling variable is INTERPO LATEBPTOO 2 Fixed the intro screen in the demo file The problem was failure to update START png in the images of the demo directory 3 Adjust database so that we can accommodate twenty four records in a pre randomised structure To do this we must e Insert an inStudy field into the PERSON table This is an integer specifying the order in which the person was put into the study and allowing access to the corresponding line of randomised case numbers within the file csv RandomStudyCases csv A null value will signal that somebody is not a study participant allowing normal case access to occur e Create the csv file mentioned above e Update person insertion so that a tickbox allows someone to be put in the study The inStudy field will then be set to the maximum previous inStudy value plus one This involves adding the POST variable in Study to eZ admin personadded php and the necessary code to han dle this addition See usage of the SINSTUDY variable there and the changes in the calling script eZ add person php e Altert
312. one and physical address eZ add person php Full PHP HTML code follows Setting up a login name and password is yet another screen header Cache control no cache GLOBAL DEBUGGING GLOBAL handDB STHISPAGE eZ add person php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN 10 WORKING PHP CODE 202 SMAXUSERSTATUS EVERYONE success validate_login SHOW_USER E list SMYHEADER USERSTATUS eZHeaderGreet success MINUSERSTATUS MAXUSERSTATUS a new person STHISYEAR WhatYearIsIt f ancillary php INSERTED BELOW print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Administration Enter details of a person lt title gt LINK href css eZstyle css type text css rel stylesheet script type text javascript Gl SES The following is clumsy and must be adjusted if nev fields are added function CheckInput myform errorcount 0 if ValidForename myform forename 0 errorcount S y if ValidSurname myform surname 0 errorcount y if myform gender selectedindex 1 errorcount y if myform personrole select
313. ould not open OUTPUT FILE outname print OUTFI my KBCOUNT foreach d 0 ALLDATA SKBCOUNT Print print OUTFILE D I close OUTFILI n n E E Count Val ue Extracting nSKBCOUNT d lt Sd gt 2 E CSV TI 3 RETRIEVE FILES FROM SAFERSLEEP USING PERL 78 3 Retrieve files from SAFERsleep using Perl Here s the Perl script getcrypt pl placed in the ez ez xlate directory First we connect to SAFERsleep then we obtain a binary image of the encrypted LAR file and write it to the ez iar directory usr local bin perl w use strict use Win32 0DBC my SDEBUG 3 0 to turn off debugging 1 overviev 2 detail 3 nitpicking my LOGPRINT 1 print to log my EZDIR ez my SEXITCODE 0 code on exiting Perl global my CASENUM SARGV 0 e g S0029 my CONFILENAME SARGV 1 connection string file my PARAMS SARGV 2 eg debug 3 logprint 0 if PARAMS debug Nd command line control SDEBUG 1 if PARAMS logprint d SLOGPRINT 1 D I sOpenLog LOGPRINT EZDIR SCASENUM for debugging Print An Arguments are CASENUM CONFILENAME if CASENUM S d 4 i amp Die An Bad number lt SCASENUM gt PARAMS 3
314. page php Return to main page lt a gt lt h3 gt Data extraction lt h3 gt lt p gt Basic queries li gt lt a li gt lt a li gt lt a li gt lt a li gt lt a li gt lt a href view don php View number of assessments lt a gt href view sessions php Session overview lt a gt href view ratings php Details of ratings lt a gt href view assessors php View by assessor lt a gt href view cases php View by case lt a gt href showartefacts php case 0 amp CASI for each person ES Scaselist gt View artefacts lt a gt lt p gt lt a href mainpage php Return to main page lt a gt body html HTML0 10 8 2 View number of assessments he control view done php ValidFx php US US valida EADER US header Cac STHISPAG require once SMINUSERSTA SMAXUSERSTA success list 5 P E Fis d EV RYON ERSTATUS SMINUSI View number of assessme print HTMLO DOCTYPE HTML PUBLIC Lk D W3C no cache te login SHOW US 3 f our login validation script eZ ADMINISTRATOR MIN ER ZHeaderGr ERSTATUS t success SMAXUSERSTATUS nts 0 EN DTD HTML 4 01 Transitional l 10 WORKING PHP CODE 239 lt html lang en gt lt head gt title View number of assessments lt title gt LINK href css eZstyle css type text css
315. ploaded must end in a lowercase csv and is case sensitive Return to main page Figure 12 Backup and restore 10 7 Backup Here we encourage easy backup of all data apart from encrypted passwords to a CSV file which can be re imported if the dire need arises header Cache control no cache STHISPAGE eZ backup php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SHOW USER list MYHEADER USERSTATUS eZHeaderGreet success SMINUSERSTATUS MAXUSERSTATUS Backup data 0 iz print lt lt lt HTML1 lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt lt head gt lt title gt Extract data lt title gt LINK href css eZstyle css type text css rel stylesheet script type text javascript ee function CheckRestore myform if myform csvname value length 2 alert Invalid CSV name Need at least 1 character return false im if confirm Restore Are you sure 10 WORKING PHP CODE return return true D I hf 8 script lt head gt lt body gt SMYHEADER false h3 gt Back up lt h3 gt p gt lt a href backup all php Back up all data lt a gt CSV export When you save th s
316. ply creating small images in layers We will do one type of intervention at a time stacking them in columns over the 5 minute epoch 2 Another idea is to view all cases for one anaesthetist with 12 columns per panel and two stacked panels Each case will be represented as a vertical column extending up in time with similar colour size coding to the above 3 We might also view duplicate cases all of them comparing the two for each anaesthetist top and bottom again 4 We might wish to indicate whether a case handwritten or electronic was done first or second in the above 14 3 Changes for v 0 60 1 0 Added viewer for artefacts Fixed up some paths so this works with DogWagger 3 0 under Linux These changes alter the javascript file analysis8 s in the js di rectory and the file eZ view php and add the file showartefacts php Version 1 0 is slightly cleaned up with removal of redundant comments
317. print p DEBUG Message is msg readfile oopsl htm print msg readfile oops2 htm y HTML files oops1 htm and oops2 htm The following files might conveniently be combined into one file with a string to be substituted for the message in the centre Oh well here s oops1 htm lt head gt lt title gt Oops lt title gt LINK href css eZstyle css type text css rel stylesheet gt lt head gt lt body gt lt h2 gt Oops lt h2 gt There was a problem with logging on message follows gt Here s the second part oops2 htm lt p gt Click lt a href login htm gt here lt a gt to try again body 9 1 3 Javascript file md5 js Here s a Javascript file that mediates md5 encoding stored locally in ez shw php js and on the server in ez js Thanks to Paul Johnston for this md5 Javascript code A JavaScript implementation of the RSA Data Security Inc MD5 Message Digest Algorithm as defined in RFC 1321 Version 2 1 Copyright C Paul Johnston 1999 2002 Other contributors Greg Holt Andrew Kepert Ydnar Lostinet Distributed under the BSD License EE X 9 PHP ACCESS CODING 188 x See http pajhome org uk crypt md5 for more info x Configurable variables You may need to tweak these to be compatible with the server side but the defaults work in most cases x var hexcase 0 x hex output format 0 lowercase 1 uppercase x
318. proach outlined here we will be able to compare assess ments of chunks decades of ten anaesthetics at a time and each such decade will contain assessments of five pairs of anaesthetics presented at random but with no pair members presented one after the other The randomisation process is as follows 1 For a particular assessor This may marginally limit the ease of data extraction but allows multiple flags to be stored against one intervention without making another clumsy table and even addition of new flags 8 DATABASE DEFINITION 164 2 Choose the next five SUBJECT entries that have not yet been assessed by this assessor 3 Obtain the ten primary keys from the ANRECORD table that refer to these five subjects 4 Randomly choose an anrecord from among the ten entries and allocate it to the first element of a ten element array 5 Repeat the choice until no entry is left unchosen under the following con straints a For any pair of anrecord entries referring to the same subject if ele ment n in the array is one of the pair then neither element n 1 if it exists nor element n 1 if it exists may be the other member of the pair b If we encounter a situation where the final two unchosen elements both refer to the same subject i e one is a manual and one is an automated record for the same anaesthetic then we randomly choose one of these two elements and insert it as array element number 9 and we ex
319. r dy 1 p pr dy while dy gt 0 if drw this mkDiv x y 1 1 drw drw y yIncr if po 07 FEX p pru else p pr if drw this mkDiv x y 1 1 function mkOv left top width height var a width gt gt 1 b height gt gt 1 wod width amp l hod height amp 1 1 cx left a cy toptb x 0 b ox 0 oy b aa axa 1 bb bx b lt lt l st aa gt gt 1 x 1 b lt lt 1 bb tt bb551 aax b lt lt 1 1 w h while y gt 0 if st 0 st bbx x lt lt 1 3 tt bb lt lt l x 280 11 ACTUAL ENTRY OF DATA else if tt lt 0 st bb x 1 3 aa lt lt 1 x y 1 tt bb lt lt 1 x aa y 1 3 v X OX h oy y if w amp 2 amp amp h amp 2 this mkOvQds cx cy x 2 ox wod oy oy lthod 1 1 this mkOvOds cx cy x 1 x 1l wod y 1 ythod 1 1 else this mkOvQds cx x 1 oxtwod oy oy h hod w ox X oy Y else tt aax yxx1 3 st aa 1 y this mkDiv cx a cy oy 1 oy lt lt 1 hod this mkDiv cx ox wod cy oy a oxtl oy lt lt 1 hod function mkOv2D left top width height var s this stroke width s 1 height s 1 var a width gt gt 1 b height gt gt 1 wod width amp l hod height 1 1 cx left a toptb 0 b aa a xa 1 bb
320. r 128 The above table is not yet in use and we don t yet have a separate table for the fCode field 8 9 UIDS In this final table we create seeds for generating unique IDs for all of the other tables The SQL standard doesn t directly provide automatic key generation and although dialects do provide thinks like auto incrementing fields or permit user defined functions to fill the gap we will not use these facilities as they vary be tween databases We will rather take keys as we need them from the UIDS table Each new primary key for a new table entry will be fetched from the UIDS ta ble We don t have key seed fields for tables that will not ordinarily acquire new rows 9 The process of updating auto incrementing these source fields is rather tricky and database features designed to prevent errors may get in our way Problems only really arise where several users are concurrently accessing the same field in UIDS but we must account for this eventuality The accessory fields be ginning with aux are used to accommodate this necessity they must start off with values identical to the corresponding key fields CREATE TABLE UIDS uids integer constraint badUids primary key uids Person integer Persdata integer Anrecord integer Onesession integer Rating integer Subject integer NextSessions integer GGG G G G GS auxPerson integer auxPersdata integer auxAnre
321. r r 75 var sx 200 var sy 200 var hyp 100 var fnt 12 shadow Jjg setColor gray this fillArc sx 5 sy 5 r 0 360 jg ja fillEllipse sxt 5 r sy 5 r 2 r 2 r var st angle 0 for i 0 icthis data length i var angle Math round this datalil this maxx360 var pc Math round this data i this maxx 100 3g setColor this getColor this fillArc sx sy r st angle st_angle angle var ang rads st angler angle 2 x2xMath P1 360 var my Math sin ang rads x hyp var mx Math cos ang rads x hyp jg 291 11 ACTUAL ENTRY OF DATA 292 st_angle angle mxa mx 0 50 0 jg setColor black jg drawString this x_name i pc S sx mx mxXa sy my Jjg setColor black jg drawEllipse sx r sy r 2xr 2x1 jg paint HTML file baddb htm This ominous file signals an internal database error lt h2 gt Internal database error lt h2 gt An internal database error occurred This is not good Please drop me Jo van Sche lt a href http www anaesthetist com eZ mainpage php here lt a gt to return to the main page lt p gt lt hr gt lt body gt HTML file congrats htm Displayed when the user has exhausted all anaesthetics lt h2 gt Congratulations lt h2 gt You have exhausted our supply of cases If you drop me a line 1 11 try to put up some more if you wish lt p gt lt div align right Jo van Schalkwyk di
322. racters 5 errorcount if NastyString pwdl errmsg errmsg Password CANNOT contain characters errorcount y if ulogon length 4 errmsg errmsg Please supply user name 4 characters or more errorcount y if mypwd length lt 6 errmsg errmsg Your password IS 6 or more characters long errorcount if pwdl length lt 6 errmsg errmsg New user password minimum length must be 6 characters errorcount y if pwd2 length 6 errmsg errmsg 10 WORKING PHP CODE 214 User password minimum length confirmation must be 6 characters errorcount y if pwdl pwd2 errmsg errmsg Confirmatory password doesn t match errorcount y if errorcount gt 0 alert errmsg return false y now encrypt passwords mypwd hex md5 mypvd first encryption pwdl hex md5 pvd1 alert Debug md5 pud is pwdl pwdl XorStringJ pwdl mypwd alert Xor md5 pwd is pwdl if pwdl length 30 alert Oops return false Y 727 end xor section mypwd hex md5 mypwd 2nd encryption myform mypsud value mypwd myform nevpassvordl value pudl rr myform newpassword2 value return true function XorStringJ strA strB lgth strA length if lgth strB length return D I outs while lgth gt 0 lgth 1
323. re initial values for each variable sepa rately as lastvalues for each variable the easiest way is to simply push the value time pair to the stack 3 Read more values for each of the variables When a new variable value is obtained determine the step size for that variable and interpolate as many values as required to provide values every 30s as per IDAS replay Use linear interpolation at least for now Write these values for the particular variable push to a stack together with the relevant timestamps then write the new value and store it as the lastvalue 4 Repeat the above process as often as required We might later consider submitting the file name as a separate parameter to Perl 4 FORMAT TRANSLATION EZ XLATE 92 5 At the end go through each stack for each variable starting at the beginning and for each time write values for all variables unless no value has been determined up to this time for a particular variable in which case we write nothing for that variable 4 2 2 Perl code to translate to DAT Let s implement the above In addition we will render all floating point numbers with six digits after the decimal point all zeroes as encountered in the DAT files We add epsilon and then brutally truncate c 3333333 33333 m m i Perl program to translate from CSV format to IDAS DAT format usr local bin perl w se strict se POSIX qw floor
324. replace semicolons with commas ugh this is because cookie uses semicolons function Clipout str c var pindex str indexOf c while pindex gt 1 b4 str substring 0 pindex aftr str substring pindex 1 str b4 aftr pindex str indexOf c y return str function Replace str c r var pindex str indexo0f oc while pindex gt 1 b4 str substring 0 pindex aftr str substring pindex 1 str b4 r aftr pindex str indexOf c 141 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 142 return str function OneZero v if v 0 return 0 return 1 function WriteBottomNote CASENO NOTE X y w h values are in pixels eg 1 blah 10 465 945 40 document write document write document write document write document write document write document write document write document write lt div ide annotation class topskip Di style position absolute top y px left x 10 px vidth vu px height h px visibility visible background color 4FOF8FF z index 1 Case lt b gt CASENO lt b gt NOTE lt div gt function WriteForm ACTION PATIENTID document vrite document vrite document vrite document vrite lt body class nomargin bgcolor EEEEEER gt lt FORM name myform ide myform ACTION ACTION METHOD POS
325. resent we return a null string 3 Replacing all pipes with double quotes in the string q 4 sub amp FORMAT TRANSLATION EZ XLATE 102 ExtractDAT my Sr QD r D _ uses global TOkPa my q Print An Debug applying lt r gt to D 3 eval r valuate string put result in q if 580 if failed amp Print n Warning Missing variable or other eval failure 8 SWARNINGS SEXITCODE 0x08 f warning code eval failure return HMM what if D x doesn t exist if q NA i return if q NINI missing value return if SFORBIDMISSINGBPVALUES Non invasive BP check for missing values if q NIN missing NBP ie value ugh r tu urn y if q NIN missing NBP ie value ugh return y if q missing NBP ie value EXPLORE return clumsy hack for 2 CONVERT from mmHg to kPa if TOkPa if q 7 xETCO2N1 N1 NG N 2Nd NIS my kPa amp Trunc 2 7 50061505043 54 1 kPa 2 D Sq s N g replace all pipes with quotes Print gt lt q gt 3 return q A clumsy truncation routine coercing all numbers to floats with six digits 4
326. return c tiny S c tiny SalphaAlo SalphaAhi minlo minhi A elsif amp ISIN c CALB amp Print An Debug record type is B 1 return c tiny S c tiny SalphaBlo alphaBhi minlo minhi B elsif ISIN c CALC amp Print An Debug record type is C 1 return c tiny S c tiny alphaClo alphaChi minlo minhi C elsif amp ISIN c CALD amp Print An Debug record type is D 1 return c tiny S c tiny SalphaDlo alphaDhi minlo minhi D else amp Die Ain Bad Y calibration value c 2 EZ CAPTURE MANUAL DATA CAPTURE 27 Check the x time axis value sub TesttCal my St x t x _ amp StoretCal t x sanity checks here e g gt 10 min and lt 8 hours next determine duration in minutes my Savgalpha SALPHAhi SALPHAlo 2 avg nominal alpha range my d 5 x int x Savgalpha 5 Savgalpha return Sd In determining the duration we add a little bit to x in order to prevent a truncation error We repeat a similar test at the end the final datum sub TesttFinal my 56 x St x Q amp StoretCal t x next determine duration in minutes my Savgalpha SALPHAhi SALPHAlo 2 avg nominal alpha range my d 5 x int x avgalpha 5 avgalpha if d SDURATION amp Print An W
327. return i function GetTimestamp var date new Date var yyyy date getFullYear var mm MakeSerial 1 date getMonth 2 zero based var dd MakeSerial date getDate 2 var hh MakeSerial date getHours 2 var mi MakeSerial date getMinutes 2 var ss MakeSerial date getSeconds 2 return yyyy dem m k tf A E A co mg E Tat Ss TIMERS IMAGES SetMinTimer vrapper for setTimeout links timer to function RemindAfterlmin 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION function SetMinTimer t MINUTETIMER setTimeout RemindAfterlmin t ClearMinTimer trivial clear timeout function ClearMinTimer clearTimeout AAGH in case next re enabling is pending clearTimeout MINUTETIMER function ReplaceInnerText id newtext var jane document getElementByld id while jane firstChild jane removeChild jane firstChild y var MYT document createTextNode newtext jane appendChild MYT jane style visibility visible Display Elapsed time function MessageOn ReplaceInnerText elapsedTime THISIMAGE min MessagePaused similar to the above but indicate pause function MessagePaused ReplacelnnerText elapsedTime paused function RemindAfterlmin SkipToNext Image SkipToNextImage automatic mo
328. rewrite this so must be updated manually MsgBox ONTOP Debug File index is amp CURRFILENO 10 SCAPTUREINTERVAL SONEMINUTE SSLACKTIME i ACTUALLY RUN THINGS CLUMSILY BIG OUTER LOOP FOR SINGLE ANAESTHETICS SISMORE 1 While ISMOR SFD GetFileList SLISTNAME CURRFILENO If SFD 0 0 Then sgBox SONTOP Finished capturel Last line was amp SCURRFILENO Exit EndIf SCURRFILENO 1 bump count SCURRENTFILE SFD 1 SCAPTURECOUNT SFD 2 7 here might check the above are valid and reasonable If IsNumber SCAPTURECOUNT 0 0 Then sgBox 0 Error Bad capture count SCAPTURECOUNT amp _ for line CURRFILENO amp File is SCURRENTFILE Exit EndIf i MsgBox ONTOP Debug File is amp SCURRENTFILE Count 6 SCAPTURECOL Sstub StringSplit SCURRENTFILE will remove suffix SFILESTEM Sstub 1 SFAKENHI SS amp FILESTEM MsgBox SONTOP DEBUG Fake NHI is amp FAKENHI m P SSAVEPATH If Filel If No Exists SSAVEPATH t DirCreate SAV ez png amp SEIL ESTEM O Then Subdirectory for this patient EPATH Then 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 109 sgBox Error Failed to create directory 6 SAVEPATH Exit EndIf
329. rguments are respectively the path to the source file and the destination directory And here s a test file test c2d bat that requires no arguments echo off cls echo Translate CSV to SAFERsleep DAT file test only perl ez xlatelez csv2dat pl test datrules txt debug 3 logprint 0 ECHO Error level ECHO SERRORLEVELS Here s a similar test to convert captured data called test c2d bat that takes the output out T0001 csv from the test captur bat file and converts it to a DAT 4 FORMAT TRANSLATION EZ XLATE Translate CSV to SAFERsleep DAT file echo off cls echo perl ez xlatelez csv2dat pl ECHO Error level ECHO SERRORLEVELS out T0001 csv a test of CAPTUR 106 ED data 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 5 ez replay Replaying data via SAFERsleep 107 It is vitally important to note that the following code should only be run after SAFERsleep has been reconfigured to point to a testing server and not the live database This prevents the actual database from becoming clogged with dummy copies of records You should also disable the antibiotic warning in the IDAS ini file We launch IDAS in demonstration mode and play the DEMO DAT file suit ably modified by us grabbing screens from the program every minute and storing each screen as a sequentially numbered PNG file 5 1 Autolt code for monitor replay Here
330. rite write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write write span lt br gt lt inp lt br gt lt inp lt br gt lt inp lt br gt lt inp lt br gt lt inp A br gt lt inp lt br gt lt inp lt br gt lt inp lt div gt Ys td td width 40 lt tr gt ut lt span ut lt span ut lt span ut lt span ut lt span ut lt span ut lt span ut lt span lt br gt lt textarea rovse 3 lt p gt lt input type button lt input type button 01 144 ide ilabela give fluid lt span gt type checkbox name analgesia id analgesia id ilabelb give analgesia lt span gt type checkbox type checkbox name vasocons id ilabelc gt give vasoconstrictor name inotrope id vasocons id inotrope lt span gt id ilabeld give inotrope lt span gt type checkbox name bblock id bblock id ilabele adjust vapouriser lt span gt type checkbox type checkbox name incvent id ilabelf gt increase ventilation name decrvent
331. rlen STIME gt 1 4 if row exists if nov STIME gt TIMEOUT if timed out Squiet 4 force exit signal found row els SET UP the SALT table can later remove 6 05 while c K r rand Sqry INSERT INTO SALT salt sTime sValue VALUES c 100 r force time out DoSQL handDB Sqry insert salt rov c 1 y y Squiet 1 prevent infinite loop Y if quiet 20 tries failed if S quiet readfile busy htm exit D I we now have valid row SI and salt value U qry UPDATE SALT SET sTime now sValue J WHERE salt 1 DoSQL ShandDB qry store salt J value SALT J print p Debug row is I and salt is J lt p gt print lt lt lt HTMLO lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN gt lt html lang en gt n lt head gt lt title gt Log in to eZ lt title gt LINK href css eZstyle css type text css rel stylesheet script src js md5 lt script type text j lt avascript gt type text javascript gt lt script gt 9 PHP ACCESS CODING 179 if screen width 1024 screen height 768 alert Caution Your screen resolution of screen width by screen height Set Cookie test none if Get Cookie test Delete Cookie test
332. rrentSpecialty foreign key CurrentSpecialty references CURRENTSPECIALTY CurrentLocation integer constraint BadpdCurrentLocation foreign key CurrentLocation references CURRENTLOCATION Ethnicity integer constraint badPersEthnicity FOREIGN KEY Ethnicity REFERENCES ETHNICITY PhysicalAddress varchar 128 Email varchar 128 Telephone varchar 32 i We toss in pdGender for reasons of common sense and we ve added a pd Created field to allow us to determine when a particular entry was made Gender codes are 1 for female and 2 for male CurrentSpecialty is coded as below and refers to their main anaesthetic in terest CurrentLocation is where the person mainly practises Here are the relevant tables CREATE TABLE CURRENTSPECIALTY currentspecialty integer constraint badCurrentSpecialty primary key currentspecialty SpecialText varchar 32 INSERT INTO CURRENTSPECIALTY currentspecialty SpecialText VALUES 0 nil 1 General 2 Cardiothoracics 3 Obstetrics 4 other 8 DATABASE DEFINITION 161 We might wish to augment the above table somewhat CREATE TABLE CURRENTLOCATION currentlocation integer constraint badCurrentLocation primary key currentlocation LocationText varchar 32 INSERT INTO CURRENTLOC
333. rrentspecialty value SCURRENTSPECIALTY gt lt input type hidden name currentlocation value SCURRENTLOCATION gt lt input type hidden name confirmation value 1 gt lt h2 gt Please confirm lt h2 gt The following users have names similar to the one you wish to add FORENAME SURNAME Please lt i gt confirm lt i gt that you wish to add this user by clicking on the 10 WORKING PHP CODE 209 CONFIRM button below Obviously if the person already exists in the database Abort and do not confirm lt p gt lt div align center gt lt table width 655 border 2 gt lt tr gt lt td align center colspan 5 lt b gt Users with similar names lt b gt lt td gt lt tr gt lt tr gt lt td gt lt i gt Forename lt i gt lt td gt lt td gt lt i gt Surname lt i gt lt td gt lt td gt lt i gt Current role lt i gt lt td gt lt td gt lt i gt Year started lt i gt lt td gt lt td gt lt i gt Database ID No lt i gt lt td gt lt tr gt HTML2B NOTE that because similarnames was generated by SQLManySQL it is actually an array of arrays each sub array having one element This is nasty So we flatten the array to 1 dimension Ssimilarnames Flatten Ssimilarnames Susers GetUserDetails ShandDB similarnames get forename surname role year started print lt br gt Debugging print r users debug PrintDetailTable users 5 4 prin
334. rval we work through the rIflags in turn drawing a box of appropriate dimens id x 20000 arbitrary large No OFFS new Array 24 vertical offsets from baseline i while 3 lt 24 OFFS i 0 clear vertical offsets i a positive value means up y m 1 MASK 2 0 index into colours vhile m 512 clr COLOURS j es ri Tom 0 while i datlen for each datum A DAT i if A 1 8 m is bit set siz A 2 img parselnt A101 1 5 alert DEBUG Drawing datum for mask m item i DrawDatum id x y w h A 0 siz OFFS img clr A 4 A 5 id 1 bump id OFFS img parseInt siz move vertical offset y i 141 bump i y m mx2 move bit mask y end of function WriteData function DrawDatum id x y w h im siz yup clr stmp cmt img parselnt im 1 5 1 makes range 0 119 must gt 0 23 here might check img is 0 23 1771 boxw w 24 pixel width of each of 24 bins XOff x0 imgxboxv x offset might check that Yup siz BARSCALE lt h yoff parselnt y0 parseInt h BARSCALEx parseInt yup parselInt siz alert DEBUG Drawing datum ide id x xoff ye yoff document write div class anbox id L document write id document write style position absolute opacity 0 80 background color document write xoff document writ
335. rverName 4 FORMAT TRANSLATION EZ XLATE 83 4 Format translation ez xlate We have three tasks here 1 Turn a SAFERsleep LAR file into an XML file Section 2 4 5 2 Translate an XML file into a CSV file Section 4 1 2 3 Turn a CSV file into a DAT file for replay via SAFERsleep Section 4 2 The following sections address the last two tasks The TAR to XML translation has already been described above Section 2 4 5 4 1 Translate from XML to CSV From within the XML data we clip out and separate data tags in the following format lt data gt lt time gt 2008 03 31T10 09 42 lt time gt lt label gt ETCO2 lt label gt lt value gt 0 000000 lt value gt lt data gt The single line has been broken into two for the sake of legibility One approach is to identify all distinct times and create an ordered array of these times We then identify all labels make an array for each label and then enter values at each time where the label exists 4 1 1 Perl code translate to CSV The following perl program accepts a source file name The program opens the source XML file and using the same name but with a CSV rather than an XML suffix writes the file to the destination directory If the destination file exists it is simply overwritten The plan is 1 Get file name from the command line 2 Read in whole XML file 3 Identify all distinct times and store the times in order in an array called ALLTIMES It m
336. s ODBC i e SQL CLI connectivity 3 Perl version 5 6 See notes above we used ActivePerl version 5 6 1 binary build 635 2003 02 04 4 Autolt version 3 2 10 0 c 1999 2007 Jonathan Bennett amp Autolt Team 5 Javascript ECMAscript within a fairly recent Web browser e g FireFox version 2 0 or greater or Internet Explorer 5 or greater 28 At present owing to the removal of the Tk toolkit from later versions of Perl Dogwagger version 2 1 which requires Tk will choke on higher versions of Perl 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 327 6 A web based version of mySQL and a server running PHP version 3 or greater Optionally an SQL 3 compliant database other than mySQL might be used to test the code 7 BTEX for generation of documentation We used MikTex but any MI X2E compliant engine will work 8 My small Dogwagger program version 2 1 to extract files from the TEX source Make extract code from BTFX file Update this and manually run Dog Wagger if update IATEX file name echo off cls rem makefile perl dogwagger21 pl ez 060 tex A help file Here s help bat that simply reminds the user of what we can do from the com mand line echo off cls cho echo HELP WITH EZ cho echo captur capture from calipers process echo iar2xml list is in lezlez xlateliarlist txt echo xml2csv test xml xml to csv echo csv2dat test csv csv to IDAS format echo replay rep
337. s from the baseline vvith a centre value that is the average of the lower and upper limits Each of these ranges refers to a different type of record but each is equivalent to an actual value of 220 mmHg or a heart rate of 220 min 1 MAXVAL is used as a calibration 2 EZ CAPTURE MANUAL DATA CAPTURE 11 signal We will refer to the three types of records corresponding to the three ranges used above as type A type B and type C records respectively e MINVAL signals a measured value in the range of MAXVAL 10 MINVAL corresponds to a measurement extending from the baseline at 20 mmHg or a heart rate of 20 min to the line signalling a value of 40 mmHg or min 1 The x calibration value This is a measurement of duration from the start of the anaesthetic to the end of the anaesthetic but with two caveats 1 Measurement must start from a pre printed vertical line on the chart not a user defined mark that is one of the vertical lines used to mark the time This is normally a 5 minute mark unless the user has chosen a different time base Use the smallest printed interval If the first datum recorded is not on a pre printed vertical line then choose the line before the first user mark NOT aftervvards When recording data as described below signal the first recording as a missing value then measure the offset also described below 2 Measurement of the x axis calibration must likewise end ar a vertical pre printe
338. s index sub Backfill my 3 bkval j bkval _ _ my x split x j Sbkval return amp Commaline x Here s a copy of our Julian Gregorian subroutines stolen from our data cap ture Perl script in Section 2 3 sub Julian 1 my Ofy Sim Sid 9Sfh fmi fs SEE fy Stm 524 fh fmi fs ff _ my f f 367 Sfy int 7 fytint fm49 12 4 int 3 int fy fm 9 7 100 1 4 int 275 fm 9 d 1721028 5 Sfh fmi fs 0 S 60 60 24 return f sub Gregorian 4 FORMAT TRANSLATION EZ XLATE my 33 5 8 my SEPSILON 0 000001 5 SEPSILON my Z SR G A SB C my year month day ER floor jd 1721118 5 R jd 1721118 5 2 G Z 0 25 SA floor G 36524 25 B A floor A 4 year floor B G 365 25 C SB 52 floor 365 25 year month int 5 x C 456 153 Sday C int 153 x month 457 5 SR if month 5 12 year year 1 month month 12 y my gd 0 5 jd int Sjd if God gt 1 Julian starts at midday Sgd 1 D my gh gmi gs gh gd f clumsy gh x 24 gmi gh int gh gmi gh Sgmi 60 gs gmi gmi int gmi gs gmi gs x 60 return year amp DoubleDigit month amp DoubleDigit int day sDoubleDigit
339. s one lt p gt Clic K lt a href http www anaesthetist com eZ mainpage php here lt a gt to return to the main page lt p gt lt hr gt lt body gt 10 WORKING PHP CODE 212 Edit person s details User Superuser Return to main page or 1 FIRST please enter YOUR password This is a security measure 2 Enter user log on password for Darran Lovves darranl If exists can be left the same Enter new password a User log on name b New password Re type new password Gol Clear Farm Figure 6 Editing log on details 10 4 Editing log on details Here s the page eZ_do_editlogon php that accepts new log on details for the se lected user Once the administrator has entered the new details we must still POST the values to eZ do editlogon2 php We md5 encode the administrator password twice to prevent it being revealed Because the md5 encoded password being supplied for the user could be used to log on as that user if somebody listened in to a password changing session we xor the password with the singly md5 encoded administrator password before submit ting this Then the server side script can securely pull out the new password header Cache control no cache STHISPAGE eZ do editlogon php require once ValidFx php our login validation script SMINUSERSTATUS eZ ADMINISTRATOR MIN SMAXUSERSTATUS EVERYONE success validate login SH
340. s the code l C X ur Autolt Version 3 0 Program to copy a DAT file to the IDAS file DEMO DAT Then run IDAS in demonstration mode and repeatedly capture screen every minute using AutoIt and writing each captured image as a PNG file Repeat for multiple DAT files AutoIt includes Include lt ScreenCapture au3 gt include Date au3 for setting date time configuration TESTNOSERVER 1 1 1 if must check parochial note if no server machine home miscellaneous variables onst ONTOP 0x40000 SLACKTIME 920 ms hmm INITIALPAUSE 20000 ONEMINUTE 60000 ms 60s PREPARATION Load numbers etc Identify a file obal CURRENTFILE obal SCAPTURECOUNT EZPATH ez REPLAYPATH SEZPATH amp ez replayA LISTNAME REPLAYPATH SSLIST TXT 1 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP 108 get current file if left off in middle CurrentFile txt SCURRFILENO FileReadLine REPLAYPATH CurrentFile txt 1 open read close DEBUG ONLY CURRFILENO 1 if error lt gt 0 then r LE failed sgBox ONTOP FATAL Error Failed to open CurrentFile txt Exit EndIf at present do not
341. session AND rlimportance IS NOT NULL ORDER BY rImage rlimportance ignore artefacts FOR NOW SMANA SOQLManySQL ShandDB qry get markup for handwritten records manlen sizeof SMANA print lt lt lt HTML3 MANDIM Smanlen MANUAL new Array MANDIM HTML3 PHP fills in number SJsManu 3 0 while j lt manlen Sr Flatten MANA 3 m0 An M new Array Sr 0 lIl r 1 1l I r 211 1 r 311 521411 1 r 5 m0 preg replace m0 scape any quotel m0 preg replace m0 now can insert quotes SJsManu m0 SJsManu An MANUAL j MO Sj y print JsManu write electronic array Sqry SELECT MIN onesession FROM ONESESSION ANRECORD SUBJECT WHERE ONESESSION Anrecord ANRECORD anrecord AND ANRECORD Subject SUBJECT su SUBJECT sCode thiscase ANRECORD manual 0 list elesession GetSQL handDB Sqry SELECT rlmage FROM RATING riflags AND ONESESSION Person rlimportance thisass AND ary get first electronic session mic rAflags rTime rIcomment rAcomme 10 WORKING P
342. sgBox ONTOP Dx Info box 2 detected Send ENTER Hit enter at Login screen Else MsgBox ONTOP dX Info box 2 NOT detected Click OK 5 EZ REPLAY REPLAYING DATA VIA SAFERSLEEP Send ENTER ii EndIf 114 Hit enter at Login screen Sleep 3000 If WinExists Main Menu Then MsgBox ONTOP Dx Main menu detected Send ENTER new case default Else sgBox ONTOP Ooopsl No main menu Exit EndIf EndFunc Pr P EndCapture close all applications Func EndCapture xexit yexit END ANAESTHETIC MouseClick left xexit yexit hack back ALTER THE ABOVE TO RELATE TO SCREEN SIZE Sleep 1000 hack Send ENTER do you want to end anaesthetic YES Sleep 1000 hack Send TAB ENTER do NOT print Here to start another anaesthetic Send ENTER Sleep 10000 enough time to save etc 777 but we will Send TAB ENTER Sleep 5000 hack Send ENTER EndFunc D I 5 GetFileList Func GetFileList fname Fr Slineno get file list with number of frames to capture Dim FDAT 3 no data first line is a header line Sfname ln SFDAT 0 0 Pg Sin lineno Smyline FileRea
343. sure of say 77 mmHg but have a systolic and diastolic of zero If we allow interpolation of S D from prior values then we get a mean outside the S and D Ideally we should test for this and fix it but how We might replace S D outside the mean with NA but this won t stop the interpolation as things stand because we use NA to signal Please interpolate Using large negative or positive values for SD does not appeal 6 We found a few other problems Taking the XML and directly translating it for S0111 caused IDAS to stop inputting DAT data 7 There is also an unexplained problem with S0111 where a BP value is skipped and HR values are messed up This seems to somehow be a carry over from the flaky data at the start as if we trim the CSV or XML prior to the DAT conversion then things work fine 8 24 2 2009 We resume We now start writing queries of the incoming data First is a simple list of who has done what We ll insert this into view delete data 14 HARDWARE SOFTWARE USEFUL FILES CHANGE LOG 336 14 2 Changes for v 0 54 0 59 1 Main issue here is visualisation of the data obtained We will stack two im ages the final image for the handwritten record and the electronic version as played back through SAFERsleep We will then overlay colour coded representations of the interventions using 5 minute epochs This can be done for an individual anaesthetist or for the whole group We will make the overlays by sim
344. t write write write write write write write write write write lt div ide displayPanel style position absolute top px left x px width w px height h px visibility visible background color 4CCCCCC z index 1 img class prominent src images INTRO2 png alte vidthe w heighte h H name mainimage border 3 lt div gt hy y vn function WriteControlpanel x y w h arguments are in pixels eg 154 81 750 350 myBackground was translucent area that blanks things out when make intervention now opaque document document document document document document document document was document document document document document document document document document document document document document document document write write write write write write write write lt div ide myBackground style position absolute top y px Loft x o6 px width w px heighti h X7 px visibility hidden background color FOF8FF z index 20 border width thick border style solid border color 2Fl1D1D gt img src images white png width 780 height 350 write write write write write write write write write write write write
345. t lt l pru pr dx 1 p pr dx OX 7 Xj while dx gt 0 TtX if p gt D this mkDiv ox y x oxtad _S y yIncr p pru OX 7 Xj else p pr this mkDiv ox y 2 4 1 s else if s 3 gt 0 var 5 s dyxMath sqrt 1 dxxdx dy dy s 1 xdx dy dy 2778 11 ACTUAL ENTRY OF DATA _s s 4 Math ceil _s Math round s 1 else var s s var ad Math round s 2 var pr dx lt lt l pru pr dy 1 p pr dy oy y if y2 lt yl ad while dy gt 0 TE down this mkDiv x y 5 oy ytad y yIncr p pru oy Y else y yIncr p pr this mkDiv x2 y2 5 Oy y2 ad else vhile dy 5 0 y yIncr p gt 0 pk this mkDiv x oy p pru oy Y S y oytad else p pr this mkDiv x2 oy 5 y2 oy ad 1 function mkLinDott xl yl x2 y2 TE ix eh var 2 x2 var _y2 y2 x2 xl y2 yl xl _x2 yl _y2 var dx 2 1 dy Math abs y2 y1 x xl y yl 279 11 ACTUAL ENTRY OF DATA y ncr yl gt y2 1 1 drw true 1f dx gt dy var pr dycc1 pru pr dx 1 p pr dx while dx gt 0 if drw this mkDiv x y 1 1 drw drw if pow Qj y yIncr p pru else p pr TX if drw this mkDiv x y 1 1 else var pr dx lt lt l pru p
346. t later test for and warn about this anomaly Similar are StoreZero and StoreYCal and a smaller stack to store the few x axis time calibrations we do routine StoreZero x y push ZEROES x push ZEROES y end routine StoreZero routine StoreYCal x y push YCALS x push YCALS y end routine StoreYCal routine StoretCal x y push tCALS x push tCALS y end routine StoretCal Tests of calibration We must be able to test Y calibration At the same time based on the Y calibration value we determine the type of record and hence set the alpha value We also return the MINVAL routine TestYCal t c StoreYCaldtt c tiny 1 4 plusminus value for range alphaAlo 2 15 alphaAhi 2 35 alphaBlo 4 43 4 3 alphaBhi 4 63 alphaclo lt alphaCha lt 3 31 minlo lt tiny t 10 minhi lt lay EXILIO 2 EZ CAPTURE MANUAL DATA CAPTURE case value in CALA gt return c tiny cttiny alphaAlo alphaAhi murlo minha value in CALB gt return c tiny cttiny alphaBlo alphaBhi minle minhi value in CALC gt return c tiny cttiny alphaClo alphaBhi minlo minha default fail Bad calibration value end routine TestYCal routine TesttCal t c StoretCaldit co if t 5 or t gt 1000 gt fail Bad time base end routine TesttCal Main data processing H
347. t moves to the next case for this assessor and the ability to move to a new assessor Later we will allow composite images for all assessors for the given case DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN http www w3 org TR html4 loose dtd html lang en head lt title gt Graphical display of an assessment lt title gt lt link type text css rel stylesheet href css eZstyle css gt script src js analysis8 js type text javascript script script type text javascript Se 10 WORKING PHP CODE 243 here set up data THIS IS A DEMONSTRATION CASE 7 S3044 ASSESSOR 71015 BARSCALE 4 global multiplier bars CHECK ME SUPPLY SImage0 png finalimages S3044 m 120 pno SImagel png finalimages S3044 s 120 pno DravMsg 800 10 280 80 60 h3 Assessor h3 ASSESSOR white DravMsg 800 10 350 80 60 h3 Case h3 CASE white Writelegend 10 10 COLOURS INTERVENTIONS 9 finally the actual data WHAT WE NEED is an array of arrays each sub array will have data correspondi SELECT rImage rIflags rlimportance rAflags rTime rlcomment rAcomment FI WHERE RATING Onesession ONESESSION onesession AND ONESESSION Anrecord ANRECORD anrecord AND ANRECORD Subject SUBJECT s
348. t table with 5 columns print HTML2C lt tr gt lt td colspan 2 a href mainpage php Abort Do NOT add user FORENAME SURNAME lt a gt lt td gt lt td colspan 3 gt lt INPUT TYPE submit NAME submit VALUE CONFIRM Add this person gt lt td gt lt tr gt lt table gt lt div gt HTML2C y function InsertPerson myODBC FORENAME SSURNAM SSTARTYEAR gender role SCURRENTSPECIALTY CURRENTLOCATION SINSTUDY E if strlen STARTYEAR lt 4 f bad data default to 1900 ugh SSTARTYEAR 1900 if SINSTUDY 1 obtain actual value Sqry SELECT MAX inStudy FROM PERSON list sv GetSQL myODBC qry study code for person if strlen sv gt 0 SINSTUDY 14 sv ugh bump Start at 1 y 10 WORKING PHP CODE 210 nov date Y m d h i s SNEWID FetchKey myODBC Person f nev key for PERSON gry INSERT INTO PERSON person pMade FirstQualified inStudy VALUES SNEWID TIMESTAMP now DATE SSTARTYEAR 01 01 SINSTUDY DoSQL myODBC qry insert new person SiPERSDATA FetchKey myODBC Persdata gry INSERT INTO PERSDATA persdata Person PersonRole CurrentSpecialty CurrentLocation
349. t write y0 document write px width document write w document write px height document write h document write px z index document write k 1 document write img src images CLEAR png width document write w document write Un height document write h document write id XImage document write k 1 document write 5c split for TIDY document writeln div mmm EE Clock SEO e function LoadClock var i 0 while i lt 12 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION MYCLOCK il new Image 48 48 var cname images clk i png alert Debug Clock image is myname MYCLOCK il src cname i tt function Tick4 don t SetClock TICKER if TICKER gt 11 TICKER 0 y document images clock src MYCLOCK TICKER src function Tick5 TICKER if TICKER gt 11 TICKER 0 TICKTIME 5000 revert to 5s per tick y document images clock src MYCLOCK TICKER src SetClock TICKTIME function StopClock clearTimeout CLOCKTICK function SetClock t CLOCKTICK setTimeout Tick5 t function RestartClock var left ONEMINUTE TICKER TICKTIME if left lt TICKTIME left TICKTIME y SetMinTimer left SetClock TICKTIME function SpeedTime TICKTIME QUICKTIME clearTimeout CLOCKTICK
350. tained within to mySQL We will use this facility to create an entire database lt p gt First let s connect to the database We use th Z_database_connect script which must be installed in the correct directory lt php GLOBAL ShandDB SDEBUGGING 1 4 O off require once eZ GLOBALS php require once SCONNECTIONPATH handDB eZ database connect if is null handDB print lt p gt lt b gt Connected to eZ database lt b gt else print lt p gt Database connection xFATILEDA lt p gt We now have an open connection to the database with a handle in lt i gt ShandDB lt i gt We ll test to see whether the database creation script has already been run using a function called lt b gt is_eZ_populated lt b gt which checks for the existence of the UIDS table and if the table doesn t exist we run the whole creation script php function is eZ populated handDB query SELECT uids FROM UIDS WHERE uids 1 Sok mysql query query ShandDB return ok function batch sql statements handDB fname GLOBAL DEBUGGING SMETACOUNT 1 Sfdata file Sfname Slurp in array of lines here process lines as per our usual parser In the call to FetchNextLine query is by reference query Slinecount 0 while FetchNextLine query fdata linecount if SDEBUGGING print lt br gt Deb
351. te table document write td document write tr document write table document write div the following clumsily rely on the globals CNORMX CNORMY ugh function DisplaceControlPanel move control panel up and left var cp document getElementByld myControls cp style left CNORMX 150 px cp style top CNORMY 50 px function RestoreControlPanel move control panel back to normal location var document getElementByld myControls is MSIE7 screwing up the following v0 42 check me jvs cp style left CNORMX px cp style top CNORMY px function WriteFinalReport x y w h final assessment at top e g 129 5 818 451 document write lt div id finalReport class invisible mymenu document write style position absolute top y document vrite px left x document write px vidth w document vrite px height h document write px visibility hidden background color FOF8FF z index 100 gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 146 document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document document docum
352. the terms of this License whose permissions for other licensees extend to the entire whole and thus to each and every part regardless of who wrote it Thus it is not the intent of this section to claim rights or contest your rights to work written entirely by you rather the intent is to exercise the right to control the distribution of derivative or collective works based on the Program In addition mere aggregation of another work not based on the Program with the Program or with a work based on the Program on a volume of a storage or distribution medium does not bring the other work under the scope of this License 4 You may copy and distribute the Program or a work based on it under Section 2 in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following a Accompany it with the complete corresponding machine readable source code which must be distributed under the terms of Sections 1 and 2 above on a medium custom arily used for software interchange or b Accompany it with a written offer valid for at least three years to give any third party for a charge no more than your cost of physically performing source distri bution a complete machine readable copy of the corresponding source code to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange or c Accompany it with the information you received as to
353. ts under this License How ever parties who have received copies or rights from you under this License will not have their licenses terminated so long as such parties remain in full compliance 6 You are not required to accept this License since you have not signed it However noth ing else grants you permission to modify or distribute the Program or its derivative works These actions are prohibited by law if you do not accept this License Therefore by mod ifying or distributing the Program or any work based on the Program you indicate your acceptance of this License to do so and all its terms and conditions for copying distribut ing or modifying the Program or works based on it 7 Each time you redistribute the Program or any work based on the Program the recipient automatically receives a license from the original licensor to copy distribute or modify the Program subject to these terms and conditions You may not impose any further restric tions on the recipients exercise of the rights granted herein You are not responsible for enforcing compliance by third parties to this License 8 If as a consequence of a court judgment or allegation of patent infringement or for any other reason not limited to patent issues conditions are imposed on you whether by court order agreement or otherwise that contradict the conditions of this License they do not excuse you from the conditions of this License If you cannot distribute
354. ttp www gnu org copyleft lesser html var jg ihtm jg ie jg fast jg dom jg moz jg n4 document layers amp amp typeof document classes undefined function chkDHTM x i x document body null tabl Artei sam 11 ACTUAL ENTRY OF DATA 275 jg_ie x amp amp typeof x insertAdjacentHTML undefined jg dom x amp amp jg ie amp amp typeof x appendChild undefined amp amp typeof document createRange undefined amp amp typeof i document createRange setStartBefore undefined amp amp typeof i createContextualFragment undefined jg ihtm jg ie amp amp jg dom amp amp x amp amp typeof x innerHTML undefined jg fast jg ie amp amp document all amp amp window opera jg moz jg dom amp amp typeof x style MozOpacity undefined function pntDoc this wnd document write jg fast this htmRpc this htm this htm function pntCnvDom var x document createRange x setStartBefore this cnv x x createContextualFragment jg fast this htmRpc this htm this cnv appendChild x this htm function pntCnvIe this cnv insertAdjacentHTML BeforeEnd jg fast this htmRpc this htm this htm function pntCnvIhtm this cnv innerHTML 4 this htm this htm function pntCnv this htm EE s function mkDiv x y w h this htm div style position absolut
355. turn FAILED HORRIBLY EndIf FileWriteLine fh Header line FileWriteLine fh partname amp amp SDURATION FileClose fh might test for success FileWriteLine Slogname New entry at line 1 Return 1 7 written to line 1 EndIf 2 EZ CAPTURE MANUAL DATA CAPTURE 55 Slineno ScanFile fpath partname logname 3 If lineno 1 Then FileWriteLine logname Error 2 Bad file amp fpath Return 0 FAILED HORRIBLY EndIf If lineno gt 0 Then WAS found FileWriteLine Slogname Entry found at line amp lineno Return lineno EndIf not found so append to file FileWriteLine fpath partname amp SDURATION clumsy beyond belief Slineno ScanFile fpath partname logname 3 If lineno 1 Then FileWriteLine logname Error 4 Bad file fpath Return 0 FAILED HORRIBLY EndIf If lineno gt 0 Then FOUND FileWriteLine Slogname Entry inserted at line amp lineno Return lineno EndIf FileWriteLine logname Error 3 Bad file amp fpath Return 0 FAILED EndFunc Func ScanFile path uhat logname DEBUG file FileOpen path 0 read only If file 1 Then If SDEBUG 3 Then FileWriteLine 1ogname FILE NOT OPENED EndIf Return 1 fail horribly EndIf If SDEBUG 3
356. ubject AND SUBJECT sCode 83044 AND ONESESSION Person 1015 AND ANRECORD manual 1 ORDER BY rImage manual 0 for electronic data NO000000000000000000000 We must NOT pull out BOTH sets for duplicates FIX we must also indicate order which of manual electronic was seen first by this ANDIM 6 PHP fills in number ELEDIM 7 ditto ANUAL new Array MANDIM ELEC new Array ELEDIM rlImage riflags rIimportance rAflags rTime rIcomment rAcommer 0 new Array 1 511 5 1 20090214164429 testing ANUAL 0 MO 0 new Array 30 1 2 4 20090214164602 ANUAL 1 MO 0 new Array 707 2 3 15 20090214164653 a clinical note ANUAL 21 M 0 new Array 80 74 4 15 20090214164852 ANUAL 3 M 0 new Array 90 8 75 1 20090214164934 ANUAL 4 MO 0 new Array 120 511 5 16 20090214165136 ANUAL 5 MO 10 WORKING PHP CODE o 0 T E okt r1 O I 1 new 23 2 0 new 31 nev 41 nev ELEC 5 0 nev ELEC 6 x b Hot r xj Il Q l next Writel 0 DrawMsg 1 and ov WriteData
357. ugging Squery else print 4 y if preg match Ns CREA H ENS TABLENS Nw W im 8 DATABASE DEFINITION 173 Squery matches ver 0 64 Stblname matches 1 if tblname METATABLE iq INSERT INTO METATABLE metatable TableName VALUES METACOUNT tblname SMETACOUNT 1 if mysql query iq handDB print Xn Error with metadata tblname H if mysql query query handDB print An Error during SQL execution mysql error return 0 f fail y query print lt br gt Number of lines submitted linecount return 1 success function FetchNextLine 8 query fdata STATIC LINE on first pass made zerol while LINE lt count fdata Stxt Sfdata SLINE get next line SLINE EL if preg match txt if not comment query query txt if preg match N Ns txt terminal return 1 y SLINE 0 4 in case re invoke FetchNextlLine return 0 f no more lines The relevant SQL initialisation file is called lt i gt eZ sql lt i gt and must be present in the sql subdirectory of the current directory or creation will fail php if is null handDB provided connected if is eZ populated handDB if bat
358. unc Func TestmDAT mDAT EZPATH FILENAME SUFFIX if csv file has been made enable DAT conversion 1 NO rather test if successful return from Perl invocation FIX ME If FileExists SEZPATH csv FILENAME amp SUFFIX csv Then myEnable mDAT EndIf ndFunc ri test whether fil xists and if it does enable the relevant button Func TestFile btn SWHOLEPATH SFILENAME SUFFIX If FileExists WHOLEPATH 6 FILENAME amp SUFFIX Then myEnable btn EndIf EndFunc Store a parameter to the INF file Func StoreParam EZPATH FILENAME parmno value fnam EZPATH 6 ez infoY FILENAME amp inf If Not FileExists fnam Then MsgBox ONTOP Error INF File doesn t exist fnam return EndIf SARR Slurp fnam ARR parmnol value Vomit fnam ARR REWRITE EndFunc 2 4 1 Invoke Notepad Here we look for all relevant log files and work through them until we get the last file which we display by opening up NotePad We minimise the GUI until the log 2 EZ CAPTURE MANUAL DATA CAPTURE file closes Func LogNotepad fnam 53 SEZPATH EZPATH amp log SE 5 h If h MsgBox ONTOP FileFindFirstFil 1 Then Oops Return EndIf
359. ution are simplicity and clarity especially when it comes to debugging The batch files include Raw data capture and processing e captur bat Capture data from digital calipers Section using an Autolt script Translation between formats Conversion of IAR to XML format is now accomplished within the main GUI program written in Autolt we simply invoke the IDAS viewer and write the resulting output to an XML file Other translations are e xml2csv bat Invokes a Perl program to translate the source XML file first argument in ez xml to a CSV file stored in the csv subdirectory of ez The batch file test x2c bat performs this transformation on a test file Section 4 1 2 e csv2dat bat Invokes a Perl program to translate source file to a DAT file stored in ez dat FIX ME The batch file test c2d bat does this on a sample file Section 4 2 3 The preceding files therefore mediate two pathways of data acquisition The first is manually via measurements obtained from digital calipers stored as CSV files in ez rawdata and then translated to processed CSV files stored in ez csv followed by translation to SAFERsleep DAT files for submission to IDAS The second is automatically stored in SAFERsleep retrieved from the server as TAR files stored in ez iar decoded to XML in ez xml and then translated sequen tially to CSV and DAT files Replay a data file through IDAS e replay bat Replay a file through S
360. v hr lt p gt Click a href http www anaesthetist com eZ mainpage php here lt a gt to return to the main page body Here s the similar congrats2 htm shown to study participants lt h2 gt Thanks a million lt h2 gt That s all of the cases We really appreciate your contribution Give me a phone call and I have a free coffe you as a tiny token of our thanks lt p gt lt div align right gt Regards Jo van Schalkv div hr lt p gt Click a href http www anaesthetist com eZ mainpage php here lt a gt to return to the main page body 11 ACTUAL ENTRY OF DATA 293 11 3 Entering anaesthetic subject details Here we enter basic information about an anaesthetic record and the associated subject anonymised patient eZ add anaesthetic php Initially we will add the following The S code of the subject for example S0012 e A rather generic description of the subject including co morbidities The ASA and ASA E ratings of the subject The subject s age in years although this is not at present displayed The subject s gender e A brief description of the operation being performed e The number of images associated with the anaesthetic record header Cache control no cache GLOBAL DEBUGGING GLOBAL handDB STHISPAGE eZ add anaesthetic php require once ValidFx php f our login validation script SMINUSERSTATUS eZ ADMINISTRATOR M
361. vement to next image function SkipToNext Image HideThanks ANYONETHERE if ANYONETHERE lt 1 StopClock alert Are you still there Click OK to continue RestartClock ANYONETHERE TIMEOUT y if ShowNextImage ClearMinTimer SetMinTimer ONEMINUTE y MoveToNext Image invoked after storing data below function MoveToNext Image ANYONETHERE TIMEOUT reset count TIMESTAMP GetTimestamp if ShowNextImage SetMinTimer ONEMINUTE 134 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 135 SpeedTime y DoNext Invoked on clicking next Simply hides thanks moves function DoNext if STARTUP 1 document getElementById elapsedLabel style visibility visible while RELOADED gt 0 whip through images until current one RELOADED QuickShowNext Image y ArtOn IntOn HideAllInputs in case mess from IE7 check me v0 42 document images mainimage src CLEARIMAGE src also for IE7 STARTUP 0 y document getElementByld nextbutton value FF 5 HideThanks ANYONETHERE TIMEOUT reset count if ShowNextImage SpeedTime advance clock quickly BrieflyDisableNext y function Nextoff clearTimeout AAGH in case next re enabling is pending document getElementBylId nextbutton disabled true function NextOn document getElementById nextbutton disabled fa
362. x 1 3 aa4x y 1 pxl cx x dw x lt lt 1 wod tt bb lt lt l x x aalx y lt lt 1 3 5 dh oy y this mkDiv pxl cy oy dw dh this mkDiv pxl cy y hod dw dh OX Xj oy Y else tt aa2x y 1 3 st aa4x y this mkDiv cx a cy oy wtl oy lt lt 1 hod fillPolygon method implemented by Matthieu Haller This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib C source of GD 1 8 4 found at http www boutell com gd THANKS to Kirsten Schulz for the polygon fixes 11 ACTUAL ENTRY OF DATA 287 The intersection finding technique of this code could be improved by remembering the previous intertersection and by using the slope That could help to adjust intersections to produce a nice interior extrema x this fillPolygon function array x array y var i var y var miny maxy var xl yl var x2 y2 var indl ind2 var ints var n array x length if n return miny array yl0 maxy array 10 for aS S cn 244 if array_y i lt miny miny array ylil if array y i gt maxy maxy array y for y miny y lt maxy y var polyInts new Array ints 0 for i i n 144 LE 14 indl n 1 ind2 0 else indl i 1 ind2 i yl array_ylindl y2 array ylind21 if yl lt y2 xl array x indl x2 array xlind2
363. xit turn off calipers shut down PC and remove USB interface module and calipers We have partially automated the above process This automation involves ac quiring and saving basic information about the record before initiating capture capturing separate caliper data for the systolic blood pressure diastolic blood pressure and heart rate and entering SpO and ETCO data from the keyboard We used XP and cannot guarantee that this will work under Vista 2 EZ CAPTURE MANUAL DATA CAPTURE 10 prior to invoking a Perl script to integrate the raw data into a final CSV file Au tomation is achieved using the Windows program Autolt for which we ve written scripts described in Section 2 4 uu l x li 1111111111 T r r r T T T T T T T L a 20 00 OS BROS EENE ANI AN ee eR 11111111111 X axis me call V i oral 1A Ke LL TUTE LI GR 40 1 111111 4 1 1 4 4 4 2 LLLLLLI 0 l Tili AE ELL kal 1 TA KS c 11 RA AAR SEER ON ES CR LL D UL LL 1 Mia E WE ini T Figure 1 Constant values The process of data entry uses certain short cuts to signal detailed structure of the record calibration and zeroing and check measurements Note the follovving values ZERO is a value in the range of 0 05 to 0 05 mm MAXVAL signals a value in one of three ranges 59 61 mm 56 3 58 3 mm and 83 9 85 9 mm all being offset
364. xplorer under 7 Finally however we abandoned the translucent image It didn t look that great and slowed down Firefox version 2 7 1 1 Thanks page After the user has finished with the demo page we refer to thanks htm lt DOCTYPE HTML PUBLIC W3C DTD HTML 4 01 Transitional EN http www w3 org TR htm14 loose dtd gt 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 127 lt html lang en gt lt head gt title Demo finished lt title gt lt link type text css rel stylesheet href css eZstyle css gt lt head gt lt body gt lt table width 95 gt lt tr gt lt td width 150 a href index htm gt img border 0 title Back alt eZ logo src images tinyezlogo png gt lt a gt td td lt h2 gt Thank you lt h2 gt td tr table hr div align center gt lt table bgcolor 4 FOFOFO0 border 1 width 60 gt lt tr gt lt td gt lt div class marginal gt amp nbsp lt p gt Thanks for trying out our tiny demonstration of the capabilities of ez None of your interventions were stored as this is simply a demonstration page If you are an anaesthetist and wish to work through our online anaesthetic record give me a call At present this offer is limited to anaesthetists working for lt i gt Auckland District Health Board lt i gt so it ll be easy for you to find me on the ADHB intranet Johan van Schalkwyk
365. y the reverse encode n elements from WEBKEYDATA function EncodeKeyArray n 1 0 kass frz while i lt n here might check that WEBKEYDATA i exists v WEBKEYDATA i if v 250 v 250 149 7 EZ SHW AN INTERACTIVE WEB BASED APPLICATION 150 1 E y return ks here s the decimal to hex converter eg 31 gt 1F function d2h d return d toString 16 function Later t myminutes t is byref object var jd GetJulian t alert Debug Julian conversion jd myminutes 24x60 Gregorian t jd alters t yyyy mm hh 4 4 mi function GetJulian t var yyyy 1900 parseInt t getYear ugh var mm 1 parseInt t getMonth ughugh var dd parseInt t getDate var hh parseInt t getHours var mi parseInt t getMinutes var ss parselnt t getSeconds return Julian yyyy mm dd hh mi ss function Julian yyyy mm dd hh mi ss var f f 367 parseInt 7 yyyy parseInt mm 9 12 4 parseInt 3x parseInt yyyy mm 9 7 100 1 4 parseInt 275 mm 9 dd 1721028 5 hh mi ss 60 60 24 op return f function Gregorian t jd t is byref object var EPSILON 0 000001 3d EPSILON var Z R G A B C var year month day Z Math floor jd 1721118 5 R jd 1721118 5 2 G 2 0 25 A Math floor G 36524 25 B
366. y TIMESTAMP SARGV 3 my SPARAMS SARGV 4 if PARAMS debug d SDEBUG y if PARAMS logprint d SLOGPRINT y sOpenLog LOGPRINT SRAWFILENAME DATTYPE t start writing to error debug log sPrint An Command line arguments are SRAWFILENAME DATTYPE DURATION PARAMS avoid lt stdin gt bug in Perl SARGV 0 amp ReadConsole SDATTYP amp Print n END of da HERE WRITE DATA TO amp WriteKbData SRAWPAT Gl ta acquisi RAW FILE SDURATION STIMESTAMP tion Xnxn 1 H SRAWFIL ENAME SDATTYPE 2 EZ CAPTURE MANUAL DATA CAPTURE 71 if NARNINGS gt 0 print An xxxNOTExxx There was were NARNINGS warning s Please consult the log print An Finished Nn CloseLog LOGPRINT exit SEXITCODE Here s the logging routine sub OpenLog my islog SRAWFILENAME DATTYPE Sislog SRAWFILENAME SDATTYPE _ if islog return if not logging my TODAY amp GetLocalTime my logfile ez log SRAWFILENAME DATTYPE S TODAY LOG open LOGFILE gt Slogfile or die CRASH Could not open LOG logfile n print An Writing to log file logfile sub CloseLog my islog islog if islog close LOGFIL _ Here are the subsidiary routines
367. y were created This allows us to re import backed up data without relational problems The name of the table is METATABLE and we clearly have to make it before the other tables CREATE TABLE METATABLE metatable integer constraint badMetatable primary key metatable TableName varchar 32 Now that we ve sorted that out here s PERSON 8 1 PERSON CREATE TABLE PERSON person integer constraint badPerson primary key person pExpiration integer pLoginName varchar 16 pPassword varchar 32 pSID varchar 32 pValue varchar 255 FirstQualified integer inStudy integer pMade timestamp 8 DATABASE DEFINITION 159 We ve moved the Forename Surname and PersonRole fields from the PER SON table to the PERSDATA table below We ve also moved FirstQualified from the PERSDATA table to here as it can only ever have one value and belongs here The additional fields required by our PHP program are pExpiration is a UNIX timestamp used to handle time out if a user overstays their welcome at present we time out after a fixed maximum period of 1 hour rather than monitoring for inactivity pLoginName is the log in name of a user if appropriate pPassword which accommodates an md5 encoded password pSID is a session ID and pValue is used to store stuff The most recent page visited by this user We ve also added pMade a timestamp for the creation of a
368. zero and Y calibrate and acquire readings as usual but Finally as part of the heart rate series repeat the zero the Y calibration and as a last reading repeat the X axis calibration measurement according to the previously specified rules The following data values are special e As already mentioned a value of ZERO followed by a large number signals a zeroing calibration pair 2 EZ CAPTURE MANUAL DATA CAPTURE 13 A double ZERO is entered for every missing 5 minute reading The two values must be identical e A ZERO followed by a value between ZERO and MINVAL is used to sig nal the special case where a recorded reading is under 40 for example a diastolic BP under 40 or a heart rate under 40 This way we easily encode interpolated time values but still preserve the information such as it is for the rare cases where extremely low values are recorded e A value greater than ZERO and less than the maximum value of o signals an added reading between 5 minute intervals After these two values we insert the Y offset of the point in question Note than an offset of ZERO should never occur as this is on the line and a conventionally recorded datum e A value between alpha and MINVAL signals an error e A value of MAXVAL or greater signals that the measured value exceeds the maximum range Note that this value should not be interpreted as an actual reading but merely a signal that the range is exceeded or out
Download Pdf Manuals
Related Search
Documentation documentation documentation template documentation tools documentation synonym documentation meaning documentation creator documentation needed for real id documentation control software documentation software documentation images documentation icon documentation fee documentation specialist documentation as code documentation standards documentation specialist jobs documentation python documentation for real id documentation generator documentation html documentation for visual studio code documentation django documentation api documentation unity documentation matlab
Related Contents
DuoTwin Condensing - manuale Manuale d`installazione PDFカタログ - リーダ式基礎機械 Oracle ZFS Storage ZS3-2 AFT - MTE Prof. Danillo Lorusso Seg. e Saúde no Trabalho Guide De Démarrage Rapide FRENIC MEGA Philips Voice Tracer 2500 加 M 。 R Gigaset C455 Copyright © All rights reserved.
Failed to retrieve file