150 likes | 280 Views
Backlog/Register. August 2, 2007 Christina Quiles. Register entry form. Developed using ext: JavaScript library with AJAX and UI components High performance widget quality Editable data grid: Inline editing Embedded widgets Sort by column Validation Paging Tabs Performance. patient
E N D
Backlog/Register August 2, 2007 Christina Quiles
Register entry form • Developed using ext: • JavaScript library with AJAX and UI components • High performance widget quality • Editable data grid: • Inline editing • Embedded widgets • Sort by column • Validation • Paging • Tabs • Performance
patient • patientID • arvID • lname, fname • addrDistrict • dobDd,Mm,Yy • ageYears • sex • encounter • siteCode, patientID, visitDateDd,Mm,Yy • lastModified • encounterType • seqNum • creator • createDate • clinicPatientID?? • discEnrollment • siteCode, patientID, visitDate • transferClinics, transferDateMm,Y • reasonDiscDeath, Mm,Yy • drugs • siteCode, patientID, visitDate • drugID • startMm,Yy, stopMm,Yy • vitals • siteCode, patientID, visitDate • Pregnant, LmpDd,Mm,Yy • medEligARVs • siteCode, patientID, visitDate • PMTCT, cd4LT200, tlcLT1200 • currentHIVstage • commAuthEnroll, Dd,Mm,Yy • arvEnrollment • siteCode, patientID, visitDate • PMTCT, cd4LT200, tlcLT1200 • currentHIVstage • commAuthEnroll, Dd,Mm,Yy • labs • siteCode, patientID, visitDate • labID • result (positive) • resultDateDd,Mm,Yy Register-Encounter Mapping Pre-ART Register • Date enrolled in chronic HIV care • Patient clinic ID No. • Last Name, First Name • Age • Sex • Address • Death, transfer out • Confirmed HIV+ result • INH, CTX, or Fluco start/stop date • Tb treatment • Pregnancy due date • PMTCT link • WHO clinical stage • Date medically eligible for ART • Clinical stage at start of ART • Why medically eligible • Date eligible and ready for ART • ART start date • Unique ART number 10 12 6 2 Register overlap
Register-Encounter Mapping (Encounter Type) Pre-ART Register ART Register • ART start date • Unique ART number • Why medically eligible • Patient clinic ID No. • Last Name, First Name • Age • Sex • Address • WHO clinical stage at ART start • Weight, Height • Functional Status • CD4 at ART start • INH, CTX, or Fluco start/stop date • Pregnancy due date • PMTCT link • Regimen -1st line • Regimen -2nd line • Regimen tracking • Date enrolled in chronic HIV care • Patient clinic ID No. • Last Name, First Name • Age • Sex • Address • Death, transfer out • Confirmed HIV+ result • INH, CTX, or Fluco start/stop date • Tb treatment • Pregnancy due date • PMTCT link • WHO clinical stage • Date medically eligible for ART • Why medically eligible • Date eligible and ready for ART • Clinical stage at start of ART • ART start date • Unique ART number Follow-up Discontinuation Lab Intake
Process • On load: • Data is retrieved through JSON from the database, each row is parsed and entered into the datagrid based on associations • After a cell is edited: • Text in changed field gets sent to the server in JSON • JSON is decoded using php and the new value is used to update the server • Update trigger and determination of data passed to the JSON is easily modifiable • modify one field , a row, or the whole data set • What about editing dates in fields? • grid.on(‘beforeedit’, savePrevValue);
Code • All code is ccquiles/registry: • Registry.php • Edit-grid-ART.js • Patientjson.php
<select name="Sex" id="sex" style="display: none;"> <option value="Unknown">Unknown</option> <option value="Female">Female</option> <option value="Male">Male</option> </select> <select name="elig" id="elig" style="display: none;"> <option value="cd4">Cd4 count</option> <option value="clinical">Clinical Only</option> <option value="TLC">TLC</option> </select> <table> <tr><td> <div id="tabs1"> <div id="reg" class="tab-content"> <div id="grid-panel" style="width:800px;height:400px;"> <div id="editor-grid"></div> <div id="editGrid"> </div> </div> </div> <div id="tb" class="tab-content">TB and Other Treatments</div> <div id="sym" class="tab-content">Symptoms</div> <div id="art" class="tab-content">ART</div> </div> </td></tr> </table> registry.php
var cm = new Ext.grid.ColumnModel([{ header: "Date enrolled in HIV care", dataIndex: 'HIVdate', width: 130, renderer: formatDate, editor: new Ed(new fm.DateField({ format: 'm/d/Y', minValue: '01/01/2006', disabledDays: [0, 6], disabledDaysText: 'No patient appts on weekends' })) },{ header: "Patient clinic ID No.", dataIndex: 'pid', width: 97, var ds = new Ext.data.Store({ proxy: new Ext.data.ScriptTagProxy({ url: 'patientjson.php' }), reader: new Ext.data.JsonReader({ root: 'results', totalProperty: 'total', id: 'id' }, [ {name: 'HIVdate', mapping: 'HIVdate', type: 'date'}, {name: 'pid', mapping: 'patientID', type: 'string'}, {name: 'lname', mapping: 'lname', type: 'string'}, {name: 'fname', mapping: 'fname', type: 'string'}, edit-grid-ART.js
// create the editor grid var grid = new Ext.grid.EditorGrid('editor-grid', { ds: ds, cm: cm, //selModel: new Ext.grid.RowSelectionModel(), enableColLock:false }); //activate function updateDB when a cell is edited grid.on('afteredit', updateDB); function updateDB(oGrid_event){ console.log('made it into update'); jsonData = " "; record = ds.getModifiedRecords(); jsonData = jsonData + Ext.util.JSON.encode(record.data) + ","; jsonData = jsonData.substring(0,jsonData.length-1) + " "; console.log(jsonData); gridForm.submit( { //waitMsg: 'Saving changes, please wait...', url:'patientjson.php?ac=saveData', //php function that saves the data params:{data:jsonData}, success:true, failure: function(form, action) { console.log('not done'); alert('Oops the delete did not work out too well!'); } } ); } gridForm.render('editGrid'); edit-grid-ART.js (continued)
if(empty($_GET['ac'])){ $arr = array(); $entry = array(); $qry_count = "select count(*) from patient"; $result_count = mssql_query ($qry_count) or die ("error". mssql_get_last_message()." ".$qry_count); while($row = mssql_fetch_array($result_count)){ $rows = $row[0]; } $qry = "select top ".$_GET['limit']." patientID, lname,fname,ageYears,sex,addrDistrict from patient order by patient_id; "; $result = mssql_query ($qry) or die ("error". mssql_get_last_message()." ".$qry); while($obj = mssql_fetch_assoc($result)) { $patientID = $obj['patientID']; } $entry = $obj; switch($entry["sex"]){ case 0: $entry["sex"] = "Unknown"; break; case 1: $entry["sex"] = "Male"; break; case 2: $entry["sex"] = "Female"; break; echo $_GET['callback'].'({"total":"'.$rows.'","results":'.json_encode($arr).'})'; patientjson.php
Database Additions • Add flag to encounter (isRegistry) • Unique ART id to patient • Add transferIn to medicalEligARVs • Add tbTreatment table • Add clinical stage (?)
Discussion points • For encounter look up… should I be using encounter or encValid? • Adding one encounter with multiple date entries, or multiple encounters • Should the Unique ART be automatically generated? • How is Regimen tracking used? • Is patientID unique?
Register Upload Function • Status: • Still no register sample • How uniform are the registers across sites? • What kind of Unique ART number is assigned? • Options • php script similar to the save method implemented in the register, that parses an excel file and tries update / insert • Web Service using ODBC • others? • What to do about invalid data? • Run validation on each field (e.g., sex)
What’s left? • Tabs, paging • Finalizing the register load function