Tuesday, October 9, 2012

Production Issue! Patient Vitals Documentation: XSL Transform

Last week there was serious production issue that I had to fix. The issue was patients acute (critical) vital signs were not showing up on patient documentation.

The analyst found out acute vital signs would not show up if there was more than one set of acute vital signs. In their testing, they found out if you only have one set of acute vital signs then the acute vital signs would show up.

Here's a very simple diagram of how Emergency Documentation system flows:

Database <---> dll <---> web service <--->   .Net website

I had a lot of places to look.

I found a method that had an XML transform. This transform was converting XML returned by a stored procedure into HTML.  In debugging the web application I determined that the acute vitals data 'went missing' in the code below.

Code from private method in web service:

 XmlReader reader = XmlReader.Create(new StringReader(xml));
                StringBuilder output = new StringBuilder();
                XmlWriter writer = XmlWriter.Create(output);
                XslCompiledTransform Xsl = new XslCompiledTransform();
                Xsl.Load(xslFile);
                Xsl.Transform(reader, writer);
                html = output.ToString(0, output.Length);
                return html.Substring(html.IndexOf("));


For XML clause in the select statement from the stored procedure:
 FOR XML PATH('Vitals'),root('Visit')




I needed a lesson in XSLT but first I had to understand the business rules.
The users did not want to see any acute vital column headers in the patient documentation if there was no acute vitals taken.  Examples below:
Vitals Table without Acute Data

Vitals Table with Acute Data













A team leader here told me the XSL file could have a bug in it. He also said that I could debug these XSL files in Visual Studio. I did some online research to find out what XSL files and what transforming is. XML transforms is a way of converting XML data to: Another XML, HTML, or other text. I can see how handy this would be.  




In debugging the XSL I found that there was a variable called accuteV.  If this variable contained the value of "on" then the extra acute columns would be rendered in the html output. This variable was being set in a For-Each statement. While debugging, I noticed  if there was more than one row being returned with acute data, the accuteV variable would no longer contain any value. It was like accuteV went out of scope!

I did more online research and found out that variables in XSLT are immutable!  They can only be assigned to once. Turns out that XSLT is a function language.  The original developer had treated this as a procedural language. 

This bug of assigning a value to a variable within a For-Each explained why acute data would show up when there was only one row of acute data, but would disappear if more than one row of acute data. 

A very strange bug is very easily explained with some knowledge of how XLST works.

Now knowing the exact problem the challenge was to fix it quickly with little code changes as possible. 

I tried a few workarounds with setting the variable   The goal was not to change any other part of the XSL. I wanted all the existing code to remain the same. I did not have time to become a XSL expert and did not want to take ownership of this file either.  I tried to add  an 'and' to the if statement checking if acuteV was all ready 'on'.  I also tried to store the sum of the lengths of the acute nodes in question.  Neither of these worked.  I was stuck. 

Lucky for me the same team leader who had lead me to the XSL was working on this as well.  His found a solution to find out if there's any acute data anywhere in the XML, and only assign 'on' to acuteV once.  This solution worked like a charm!  Big Thank yous were given and Hi Fives all around.

Original XLS snip:
<xsl:variable name="acuteV" >
    <xsl:for-each select="Visit/Vitals/Acute">
      <xsl:if test="string-length(Aline)>0 or string-length(CVP)>0 or string-length(ICP)>0 or string-length(ET)>0 or string-length(FI)>0">
        <xsl:text>on</xsl:text>
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>

Fixed XLS full file:

xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.stylusstudio.com/xquery">
  <xsl:variable name="WeGotData" >
    <xsl:for-each select="Visit/Vitals/Acute">
      <xsl:value-of select='concat(Aline,CVP,ICP,ET,FI)'/>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="acuteV">
    <xsl:choose>
      <xsl:when test="$WeGotData!=''">
        <xsl:text>on</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>off</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="cols">
    <xsl:choose>
      <xsl:when test="$acuteV='on'">
        <xsl:text>13</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>8</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:attribute-set name="borders">            
  <xsl:attribute name="style">border-bottom:solid 1px;border-right:solid 1px;</xsl:attribute>  
  </xsl:attribute-set>     
  <xsl:attribute-set name="bordersWithColspan">       
  <xsl:attribute name="colspan"><xsl:value-of select="$cols"></xsl:value-of></xsl:attribute>       
  <xsl:attribute name="style">border-bottom:solid 1px;border-right:solid 1px;</xsl:attribute>  
  </xsl:attribute-set>
  <xsl:attribute-set name="markinError">
    <xsl:attribute name="style">text-align:center;text-decoration:line-through;</xsl:attribute>
  </xsl:attribute-set>
  <xsl:template match="/">
    <html>
      <head/>
      <body style="font-size:9pt;font-family:Verdana;">
        <div style="text-align: none;">
          <br/>
          <table align="none" style="border-style: none;border-width: 0pt;background-color:transparent;font-family:Verdana;" cellspacing="1pt">
            <tbody>
              <tr>
                <td style="border-style: none;border-width: 2pt;padding: 2pt;vertical-align: middle;">
                  
                    <span style="font-size: 10.5pt;font-weight: bold;">
                      Vitals/Progress Notes
                    </span>
                  
                </td>
              </tr>
            </tbody>
          </table>
          <br/>
          <table style="border-style:none;border-color:black;border-collapse:collapse;background-color:transparent;font-family:Verdana;" cellpadding="0" cellspacing="0" >
            <tbody >
              <tr >
                <td  style="border-style: solid;border-width: 1px;width:60pt;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: left;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      Event Time
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      Temp
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      P
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      BP
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      RR
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      Sat
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size:9pt;font-weight: bold;">
                      Pain
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size:9pt;font-weight: bold;">
                      Pupils
                    </span>
                  </div>
                </td>
                <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                  <div style="text-align: center;">
                    <span style="font-size: 9pt;font-weight: bold;">
                      GCS
                    </span>
                  </div>
                </td>
                <xsl:if test="$acuteV='on'">
                  <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                    <div style="text-align: center;">
                      <span style="font-size:9pt;font-weight: bold;">
                        A-line
                      </span>
                    </div>
                  </td>
                  <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                    <div style="text-align: center;">
                      <span style="font-size:9pt;font-weight: bold;">
                        CVP
                      </span>
                    </div>
                  </td>
                  <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                    <div style="text-align: center;">
                      <span style="font-size:9pt;font-weight: bold;">
                        ICP
                      </span>
                    </div>
                  </td>
                  <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                    <div style="text-align: center;">
                      <span style="font-size:9pt;font-weight: bold;">
                        ET C02
                      </span>
                    </div>
                  </td>
                  <td style="border-style: solid;border-width: 1px;padding: 0pt;vertical-align: middle;">
                    <div style="text-align: center;">
                      <span style="font-size:9pt;font-weight: bold;">
                        FiO2
                      </span>
                    </div>
                  </td>
                </xsl:if>
              </tr>
              <xsl:for-each select="Visit/Vitals">
                <xsl:choose>
                  <xsl:when test="Type='NOTE'">
                    <tr>
                      <td style="border-right: solid 1px;border-bottom: solid 1px; border-left:solid 1px; width:60pt;">
                        <div style="text-align: left; font-size:9pt">
                          
                          <xsl:variable name="lastDate" select="DateTimeTaken/Date"/>
                          <xsl:if test="not(preceding-sibling::Vitals[DateTimeTaken/Date=$lastDate])">
                            <xsl:value-of select="DateTimeTaken/Date"/>
                            <br/>
                          </xsl:if>
                          <xsl:value-of select="DateTimeTaken/Time"/>
                        </div>
                      </td>
                      <td  xsl:use-attribute-sets="bordersWithColspan" >
                        <div style="text-align: left;font-size:9pt">
                          <xsl:if test="IsDeleted='1'" >
                            <xsl:attribute name="style">text-decoration:line-through;font-size:9pt</xsl:attribute>
                          </xsl:if>
 
                          <xsl:value-of select="ProgressNote"/>
 
                        </div>
                        <xsl:if test="IsDeleted='1'" >
                          <div style="text-align: left;font-size:9pt">
                            <xsl:value-of select="ErrorReason"/>
                          </div>
                        </xsl:if>
                      </td>
                    </tr>
                  </xsl:when>
                  <xsl:when test="Type='ED' or Type='TRIAGE'">
                    <tr>
                      <td >
                        <xsl:choose>
                          <xsl:when test="string-length(ProgressNote)>0 or string-length(ErrorReason)>0"  >
                            <xsl:attribute name="style">border-left:solid 1px;border-bottom:none;border-right:solid 1px</xsl:attribute>
                          </xsl:when>
                          <xsl:otherwise>
                            <xsl:attribute name="style">border-left:solid 1px;border-right: solid 1px;border-bottom:solid 1px;width:60pt;</xsl:attribute>
                          </xsl:otherwise>
                        </xsl:choose>
                        <div style="text-align: left;font-size:9pt">
                          
                          <xsl:variable name="lastDate" select="DateTimeTaken/Date"/>
                          <xsl:if test="not(preceding-sibling::Vitals[DateTimeTaken/Date=$lastDate])">
                            <xsl:value-of select="DateTimeTaken/Date"/>
                            <br/>
                          </xsl:if>
                          <xsl:value-of select="DateTimeTaken/Time"/>
                          <xsl:if test="Type='TRIAGE'">(T)</xsl:if>
                        </div>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(Temp/Temp)>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="Temp/Temp"/>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(Pulse/Pulse)>0 or string-length(Pulse/Rhythm)>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'"  >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="Pulse/Pulse" />
                              <xsl:if test="'string=length(Pulse/Rhythm>0'">
                                <br/>
                                <xsl:value-of select="Pulse/Rhythm" />
                              </xsl:if>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(BP/High)>0 or string-length(BP/Low)>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="BP/High"/>
                              <xsl:if test="string-length(BP/High) >0">
                                <xsl:text> / </xsl:text>
                              </xsl:if>
                              <xsl:value-of select="BP/Low"/>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(RespRate/RespRate)" >
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="RespRate/RespRate" />
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(Sat/SaO2)>0 or string-length(Sat/RA)>0 or string-length(Sat/Liters>0)" >
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="Sat/SaO2" />
                              <xsl:if test="string-length(Sat/Liters)>0">
                                <br/>
                                <xsl:value-of select="concat(Sat/Liters,'L')"/>
                              </xsl:if>
                              <xsl:if test="string-length(Sat/RA)>0">
                                <br/>
                                <xsl:value-of select="Sat/RA" />
                              </xsl:if>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          <xsl:when test="string-length(Pain/Level)>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="Pain/Level" />
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td style="border-right: solid 1px;border-bottom:solid 1px;">
                        <xsl:choose>
                          <xsl:when test="string-length(Pupils/LeftPupils)>0 or string-length(Pupils/RightPupils)>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:if test="string-length(Pupils/Leftmm) >0">
                                <xsl:text>L:</xsl:text>
                                <xsl:value-of select="concat(Pupils/Leftmm,substring(Pupils/LeftPupils,1,1))" />
                              </xsl:if>
                              <br/>
                              <xsl:if test="string-length(Pupils/Rightmm) >0">
                                <xsl:text> R:</xsl:text>
                                <xsl:value-of select="concat(Pupils/Rightmm,substring(Pupils/RightPupils,1,1))"/>
                              </xsl:if>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <td xsl:use-attribute-sets="borders" >
                        <xsl:choose>
                          
                          <xsl:when test="GCS/Score>0">
                            <div style="text-align: center;font-size:9pt">
                              <xsl:if test="IsDeleted='1'" >
                                <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                              </xsl:if>
                              <xsl:value-of select="substring(GCS/EyeOpening,1,1)" />
                              <xsl:text>,</xsl:text>
                              <xsl:value-of select="substring(GCS/VerbalResponse,1,1)" />
                              <xsl:text>,</xsl:text>
                              <xsl:value-of select="substring(GCS/Motor,1,1)"/>
                              <xsl:text>=</xsl:text>
                              <xsl:value-of select="GCS/Score"/>
                            </div>
                          </xsl:when>
                          <xsl:otherwise>
                            <span> </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>
                      <xsl:if test="$acuteV='on'">
                        <td xsl:use-attribute-sets="borders" >
                          <xsl:choose>
                            <xsl:when test="string-length(Acute/Aline)>0">
                              <div style="text-align: center;font-size:9pt">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Acute/Aline" />
                              </div>
                            </xsl:when>
                            <xsl:otherwise>
                              <span> </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </td>
                        <td xsl:use-attribute-sets="borders" >
                          <xsl:choose>
                            <xsl:when test="string-length(Acute/CVP)>0">
                              <div style="text-align: center;font-size:9pt">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Acute/CVP" />
                              </div>
                            </xsl:when>
                            <xsl:otherwise>
                              <span> </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </td>
                        <td xsl:use-attribute-sets="borders" >
                          <xsl:choose>
                            <xsl:when test="string-length(Acute/ICP)>0">
                              <div style="text-align: center;font-size:9pt">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Acute/ICP" />
                              </div>
                            </xsl:when>
                            <xsl:otherwise>
                              <span> </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </td>
                        <td xsl:use-attribute-sets="borders" >
                          <xsl:choose>
                            <xsl:when test="string-length(Acute/ET)>0">
                              <div style="text-align: center;font-size:9pt">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Acute/ET" />
                              </div>
                            </xsl:when>
                            <xsl:otherwise>
                              <span> </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </td>
                        <td xsl:use-attribute-sets="borders" >
                          <xsl:choose>
                            <xsl:when test="string-length(Acute/FI)>0">
                              <div style="text-align: center;font-size:9pt">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-align:center;text-decoration:line-through;font-size:9pt</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Acute/FI" />
                              </div>
                            </xsl:when>
                            <xsl:otherwise>
                              <span> </span>
                            </xsl:otherwise>
                          </xsl:choose>
                        </td>
                      </xsl:if>
                      <xsl:if test="string-length(ProgressNote)>0 or string-length(ErrorReason)>0" >
                        <tr>
                          <td style="border-left:solid 1px black; border-bottom:solid 1px;border-right:solid 1px;"> </td>
                          <td  xsl:use-attribute-sets="bordersWithColspan" >
                            <xsl:if test="string-length(ProgressNote)>0" >
                              <div style="font-size:9pt;">
                                <xsl:if test="IsDeleted='1'" >
                                  <xsl:attribute name="style">text-decoration:line-through</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="ProgressNote" />
                              </div>
                            </xsl:if>
                            <xsl:if test="string-length(ErrorReason)>0" >
                              <div style="font-size:9pt;">
                                <xsl:value-of select="ErrorReason" />
                              </div>
                            </xsl:if>
                          </td>
                        </tr>
                      </xsl:if>
                    </tr>
                  </xsl:when>
                </xsl:choose>
              </xsl:for-each>
            </tbody>
          </table>
          <br/>
          <table align="none" style="border-style: none;border-width: 0pt;background-color:transparent;" cellspacing="1pt">
            <tbody>
              <tr>
                <td style="border-style: none;border-width: 2pt;padding: 2pt;vertical-align: middle;">
                   <div style="font-size: 10pt;font-weight: bold;">
                      Details:
                   </div>
                  
                </td>
              </tr>
            </tbody>
          </table>
          <table style="background-color:transparent;font-family:Verdana;font-size:9pt">
            <xsl:for-each select="Visit/Vitals">
              <tr>
                <td>
                  <div>
                    <xsl:if test="IsDeleted='1'" >
                      <xsl:attribute name="style">text-decoration:line-through;font-size:9pt</xsl:attribute>
                    </xsl:if>
                    <span style="font-size: 9pt;font-style: italic">
                      Event Time:
                    </span>
                    <xsl:value-of select="DateTimeTaken/Date"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="DateTimeTaken/Time"/>
                    <br/>
                    <span style="font-size: 9pt;font-style: italic;">
                      Time Recorded: 
                    </span>
                    <xsl:value-of select="DateTimeRecorded"/>
                    <br/>
                    <span style="font-size: 9pt;font-style: italic;">
                      Entered By:
                    </span>
                    <xsl:value-of select="username"/>
                    <xsl:choose>
                      <xsl:when test="Type='ED' or Type='TRIAGE'">
                        <xsl:if test="string-length(BP) > 0">
                          <div style="text-align: none;">
                            <span style="font-size: 9pt;font-style: italic;">
                              BP: 
                            </span>
                            <xsl:value-of select="BP/High" />
                            <xsl:text>/</xsl:text>
                            <xsl:value-of select="BP/Low" />
                            <xsl:if test="string-length(BP/Site) > 0">
                              <xsl:text> Site:</xsl:text>
                              <xsl:text> </xsl:text>
                              <xsl:value-of select="BP/Site"/>
                            </xsl:if>
                            <xsl:if test="string-length(BP/Position) > 0">
                              <xsl:text> Position: </xsl:text>
                              <xsl:text> </xsl:text>
                              <xsl:value-of select="BP/Position"/>
                            </xsl:if>
                          </div>
                        </xsl:if>
                        <xsl:if test="string-length(Temp/Temp) > 0">
                          <div style="text-align: none;">
                            <span style="font-size: 9pt;font-style: italic;">
                              Temp:  
                            </span>
                            <xsl:value-of select="Temp/Temp"/>
                            <xsl:if test="string-length(Temp/Site) > 0">
                              <xsl:text>   Site: </xsl:text>
                              <xsl:value-of select="Temp/Site"/>
                            </xsl:if>
                          </div>
                        </xsl:if>
                        <xsl:if test="string-length(Pain/Level) > 0">
                          <div style="text-align: none;">
                            <span style="font-size: 9pt;font-style: italic;">
                              Pain Scale: 
                            </span>
                            <xsl:value-of select="Pain/Scale"/>
                            <xsl:text> - </xsl:text>
                            <xsl:value-of select="Pain/Level" />
                          </div>
                        </xsl:if>
                        <xsl:if test="string-length(Pupils/LeftPupils) >0">
                          <div style="text-align: none;">
                            <span style="font-size: 9pt;font-style: italic;">
                              Pupils: 
                            </span>
                            <xsl:text>Left: </xsl:text>
                            <xsl:value-of select="Pupils/LeftPupils"/>
                            <xsl:text>  </xsl:text>
                            <xsl:value-of select="Pupils/Leftmm"/>
                            <xsl:text> mm</xsl:text>
                            <xsl:text>   Right: </xsl:text>
                            <xsl:value-of select="Pupils/RightPupils"/>
                            <xsl:text>  </xsl:text>
                            <xsl:value-of select="Pupils/Rightmm"/>
       <xsl:if test="string-length(Pupils/RightPupils) >0">
      <xsl:text> mm</xsl:text>
       </xsl:if>
 
                          </div>
                        </xsl:if>
                        <xsl:if test="string-length(GCS/Type) > 0">
                          <div style="text-align: none;">
                            <span style="font-size: 9pt;font-style: italic;">
                              Glasgow Coma Scale: 
                            </span>
                            <xsl:if test="string-length(GCS/EyeOpening) > 0">
                              <xsl:text>Eye Opening: </xsl:text>
                              <xsl:value-of select="GCS/EyeOpening" />
                            </xsl:if>
                            <xsl:if test="string-length(GCS/VerbalResponse) > 0">
                              <xsl:text> Verbal: </xsl:text>
                              <xsl:value-of select="GCS/VerbalResponse" />
                            </xsl:if>
                            <xsl:if test="string-length(GCS/Motor) > 0">
                              <xsl:text> Motor: </xsl:text>
                              <xsl:value-of select="GCS/Motor" />
                            </xsl:if>
      <xsl:if test="string-length(GCS/Score) > 0">
                              <xsl:text> Score: </xsl:text>
                              <xsl:value-of select="GCS/Score" />
                            </xsl:if>
                          </div>
                        </xsl:if>
                      </xsl:when>
                    </xsl:choose>
                  </div>
                  <br/>
                </td>
              </tr>
            </xsl:for-each>
          </table>
          <br/>
          <br/>
        </div>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


XML:
<Visit>
  <Vitals>
    <Type>ED</Type>
    <DateTimeTaken>
      <datetimetaken>2012-10-09T10:08:00</datetimetaken>
      <Date>10/09/2012</Date>
      <Time>10:08</Time>
    </DateTimeTaken>
    <DateTimeRecorded>10/09/2012 10:09</DateTimeRecorded>
    <BP>
      <High>110</High>
      <Low>180</Low>
      <Site></Site>
      <Position></Position>
      <Deferred></Deferred>
    </BP>
    <Temp>
      <Temp>99.0</Temp>
      <Site>Temporal</Site>
      <Deferred></Deferred>
    </Temp>
    <RespRate>
      <RespRate>11</RespRate>
      <Deferred></Deferred>
    </RespRate>
    <Pulse>
      <Pulse>11</Pulse>
      <Rhythm></Rhythm>
      <Deferred></Deferred>
    </Pulse>
    <Sat>
      <SaO2>1</SaO2>
      <Liters></Liters>
      <RA></RA>
    </Sat>
    <Pain>
      <Level>4</Level>
      <Scale>Numeric</Scale>
      <Deferred></Deferred>
    </Pain>
    <Pupils>
      <LeftPupils>Brisk</LeftPupils>
      <Leftmm>1</Leftmm>
      <RightPupils>Brisk</RightPupils>
      <Rightmm>1</Rightmm>
    </Pupils>
    <GCS>
      <Score>6</Score>
      <Type>adult</Type>
      <EyeOpening>4 - Spontaneous</EyeOpening>
      <VerbalResponse>1 - None</VerbalResponse>
      <Motor>1 - None</Motor>
    </GCS>
    <Acute>
      <Aline></Aline>
      <CVP></CVP>
      <ICP></ICP>
      <ET></ET>
      <FI></FI>
    </Acute>
    <username>Jay Tarantino, MD-Attending</username>
    <ProgressNote></ProgressNote>
    <ErrorReason></ErrorReason>
    <IsDeleted>0</IsDeleted>
    <UserId>jmt67</UserId>
    <vitalsid>140</vitalsid>
  </Vitals>
  <Vitals>
    <Type>ED</Type>
    <DateTimeTaken>
      <datetimetaken>2012-10-09T10:27:00</datetimetaken>
      <Date>10/09/2012</Date>
      <Time>10:27</Time>
    </DateTimeTaken>
    <DateTimeRecorded>10/09/2012 10:28</DateTimeRecorded>
    <BP>
      <High>111</High>
      <Low>1</Low>
      <Site>LeftArm</Site>
      <Position>Sitting</Position>
      <Deferred></Deferred>
    </BP>
    <Temp>
      <Temp>111.0</Temp>
      <Site>Temporal</Site>
      <Deferred></Deferred>
    </Temp>
    <RespRate>
      <RespRate>1</RespRate>
      <Deferred></Deferred>
    </RespRate>
    <Pulse>
      <Pulse>11</Pulse>
      <Rhythm>Regular</Rhythm>
      <Deferred></Deferred>
    </Pulse>
    <Sat>
      <SaO2>1</SaO2>
      <Liters></Liters>
      <RA>RA</RA>
    </Sat>
    <Pain>
      <Level>4</Level>
      <Scale>Numeric</Scale>
      <Deferred></Deferred>
    </Pain>
    <Pupils>
      <LeftPupils>Brisk</LeftPupils>
      <Leftmm>1</Leftmm>
      <RightPupils>Brisk</RightPupils>
      <Rightmm>1</Rightmm>
    </Pupils>
    <GCS>
      <Score>6</Score>
      <Type>adult</Type>
      <EyeOpening>4 - Spontaneous</EyeOpening>
      <VerbalResponse>1 - None</VerbalResponse>
      <Motor="">
        1 - None</Motor>
    </GCS>
    <Acute>
      <Aline>110/80</Aline>
      <CVP></CVP>
      <ICP></ICP>
      <ET></ET>
      <FI></FI>
    </Acute>
    <username>Jay Test, MD-Attending</username>
    <ProgressNote></ProgressNote>
    <ErrorReason></ErrorReason>
    <IsDeleted>0</IsDeleted>
    <UserId>fake</UserId>
    <vitalsid>141</vitalsid>
  </Vitals>
</Visit>



Tuesday, September 18, 2012

Look what VS 2012 did to my VS 2010!

VS 2012 is useless to me for my work project.
What compiles fine in VS 2008 and VS 2010 throws up errors:

error CS1502: The best overloaded method match for 'System.Web.UI.HtmlControls.HtmlTableRowCollection.Add(System.Web.UI.HtmlControls.HtmlTableRow)' has some invalid arguments

Oh and now getting the same error in VS 2010 where it was working before VS 2012 install!

Searching the online forums several developers having same issue.  Seems that some attributes and elements within the table element have to be removed in order for the project to compile again.

I've seeing a lot of "remove the runat='server' as working solutions.  This is unacceptable.  The tables are refreanced on server side.  This is a huge project with several developers writing code.

I uninstalled .NET runtime 4.5 and now both VS 2012 and VS 2010 are hosed.

Now stuck with using VS 2008 until I can hopefully repair the VS 2012 install so I can at least go back to using VS 2010.




Monday, September 3, 2012

And where does that go, that goes this way!

Ride of the Brownshirts SC and myself this AM!  About 20 miles in 2 hours.  Weather was fine, with fog and some drizzle.  We rode into the Blue Hills from Quincy and did sections of the multi-use trails and the adjoining single track.



  As always a fun ride and a great work out.



Saturday, September 1, 2012

Blue Hills HIke

Great Hike today in the Blue Hills.  SM and I hiked the trails around Hancock Hill for a few hours. We had nice QSO with Pi K1RV on simplex from near one of the summits.  

The WX was a perfect day.  Temps in the 70sF and good 12 MPH winds.  and Sunny!

We did get some APRS positions reported via Internet gateways, so you can see some of our track in the photos below.


Happy Trails!



I have not been posting but I've been riding

I figured I would stop posting every mountain bike ride.  Especially the local after work rides.  For the last few weeks I've been getting in 2 to 3 local rides per week.  I have to keep it in mind to stay in this pattern of more than one ride  per week.  I'm noticing my skills and strength improving for each extra ride.

Happy Trails!



Friday, August 10, 2012

local

Ah yesterday SC and I rode local.  Did about 10 miles in an hour or so.  I've learned to enjoy the local trails.  It's great to meet up with a good buddy and  just ride out from the house for a good workout.  My legs are still feeling the burn today.

It's okay for me to repeat a loop in the same ride.  The 2nd or 3rd time around I can improve and try to pick a different line.