Index: ccr2ccd-xslt/trunk/make/Nancy-ccr_qrda-M1.xsl
===================================================================
--- ccr2ccd-xslt/trunk/make/Nancy-ccr_qrda-M1.xsl	(revision 993)
+++ ccr2ccd-xslt/trunk/make/Nancy-ccr_qrda-M1.xsl	(revision 994)
@@ -515,118 +515,4 @@
                   </section>
                 </component>
-                    <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Problems">
-                        <component>
-                            <section>
-                                <templateId root="2.16.840.1.113883.3.88.11.83.103" assigningAuthorityName="HITSP/C83"/>
-                                <templateId root="1.3.6.1.4.1.19376.1.5.3.1.3.6" assigningAuthorityName="IHE PCC"/>
-                                <templateId root="2.16.840.1.113883.10.20.1.11" assigningAuthorityName="HL7 CCD"/>
-                                <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Problem list"/>
-                                <title>Problems</title>
-                                <text>
-                                    <table>
-                                        <tbody>
-                                            <tr>
-                                                <th>Type</th>
-                                                <th>Date</th>
-                                                <th>Code</th>
-                                                <th>Description</th>
-                                                <th>Status</th>
-                                                <th>Source</th>
-                                            </tr>
-                                            <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
-                                                <tr>
-                                                    <td>
-                                                        <xsl:value-of select="a:Type/a:Text"/>
-                                                    </td>
-                                                    <td>
-                                                        <table>
-                                                            <tbody>
-                                                                <xsl:apply-templates select="a:DateTime"/>
-                                                            </tbody>
-                                                        </table>
-                                                    </td>
-                                                    <td>
-                                                        <xsl:apply-templates select="a:Description/a:Code"/>
-                                                    </td>
-                                                    <td>
-														<xsl:attribute name="ID">
-															<xsl:value-of select="a:CCRDataObjectID"></xsl:value-of>
-														</xsl:attribute>
-                                                        <xsl:value-of select="a:Description/a:Text"/>
-                                                    </td>
-                                                    <td>
-                                                        <xsl:value-of select="a:Status/a:Text"/>
-                                                    </td>
-                                                    <td>
-                                                        <xsl:call-template name="actorName">
-                                                            <xsl:with-param name="objID" select="a:Source/a:Actor/a:ActorID"/>
-                                                        </xsl:call-template>
-                                                    </td>
-                                                </tr>
-                                            </xsl:for-each>
-                                        </tbody>
-                                    </table>
-                                </text>
-                                <xsl:for-each select="/a:ContinuityOfCareRecord/a:Body/a:Problems/a:Problem">
-                                    <entry typeCode="DRIV">
-                                        <act classCode="ACT" moodCode="EVN">
-                                            <templateId root="2.16.840.1.113883.10.20.1.27"/>
-                                            <!-- Problem act template -->
-
-                                            <!-- <id> -->
-                                            <xsl:call-template name="ccdID">
-                                                <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
-                                            </xsl:call-template>
-
-                                            <code nullFlavor="NA"/>
-
-                                            <xsl:call-template name="ccdPerformer">
-                                                <xsl:with-param name="ccrActorReference" select="a:Source/a:Actor"/>
-                                            </xsl:call-template>
-
-                                            <entryRelationship typeCode="SUBJ">
-                                                <observation classCode="OBS" moodCode="EVN">
-                                                    <templateId root="2.16.840.1.113883.10.20.1.28" assigningAuthorityName="CCD"/>
-                                                    <!--Problem observation template-->
-
-                                                    <!-- <id> -->
-                                                    <xsl:call-template name="ccdID">
-                                                        <xsl:with-param name="ccrObjectID" select="a:CCRDataObjectID"/>
-                                                        <xsl:with-param name="suffix"></xsl:with-param>
-                                                    </xsl:call-template>
-
-                                                    <code code="55607006" displayName="Problem" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
-
-                                                    <text>
-                                                        <reference>
-                                                            <xsl:attribute name="value">
-                                                                <xsl:text>#</xsl:text>
-                                                                <xsl:value-of select="a:CCRDataObjectID"/>
-                                                            </xsl:attribute>
-                                                        </reference>
-                                                    </text>
-
-                                                    <statusCode code="completed"/>
-
-                                                    <xsl:call-template name="ccdDateTime">
-                                                        <xsl:with-param name="dt" select="a:DateTime"/>
-                                                    </xsl:call-template>
-
-                                                    <xsl:call-template name="ccdCodedValue">
-                                                        <xsl:with-param name="ccrCodedDescription" select="a:Description"/>
-                                                    </xsl:call-template>
-
-                                                    <xsl:call-template name="ccdStatus">
-                                                        <xsl:with-param name="ccrStatus" select="a:Status"/>
-                                                    </xsl:call-template>
-                                                </observation>
-                                            </entryRelationship>
-
-                                        </act>
-                                    </entry>
-                                </xsl:for-each>
-                            </section>
-                        </component>
-                    </xsl:if>
                     <xsl:if test="a:ContinuityOfCareRecord/a:Body/a:Procedures">
                         <component>
@@ -775,4 +661,75 @@
                         </component>
                     </xsl:if>
+<component>
+<section>
+<!--We are including only a coverage activity for Medicare here. There is also policy activity and and authorization activity that I don't think we need to report for QRDA, at least not for most reports-->
+<templateId root="2.16.840.1.113883.10.20.1.9"/>
+<!-- 48768-6 is payment sources and is fixed CQ-188,189,190-->
+<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Payment Sources"/>
+<!--CQ-191,192-->
+<title>Payers</title>
+<text />
+<!--medicare-->
+<entry typeCode="DRIV">
+<!--WVP moodCode is DEF is definition to describe the characteristics of who must be involved in an act CQ-194,195-->
+<act classCode="ACT" moodCode="DEF">
+<!--WVP coverage activity template is the 10.20.1.20 CQ-193-->
+<templateId root="2.16.840.1.113883.10.20.1.20"/>
+<!--Coverage Shall Include and Act ID CQ-196-->
+<!--looks like a UUID to me-->
+<id root="1751b180-8a54-11df-a4ee-0800200c9c66"/><!--FIX!!!???-->
+<!--CQ-197-198 It appears that statusCode="completed" need to follow the code code ... here and below-->
+
+<!--CQ199,200-->
+<code code="48768-6" codeSystem="2.16.840.1.113883.6.1" displayName="Payment sources"/>
+<statusCode code="completed"/>
+
+<!--A coverage activity shall contain on or more act/entryRelationship. The value for  act/entryRelationship/@typeCode shall be COMP which SHALL be  the CMS QRDA Policy Activity CQ-201, 203-->
+<!--It MAY contain an entryRelationship/sequenceNumber CQ-202-->
+<entryRelationship typeCode="COMP">
+<!--  for the act is event with moodCode EVN  CQ-205,206,207-->
+<act classCode="ACT" moodCode="EVN">
+<!--Policy activity is the 10.20.1.26 template CQ-205-->
+<templateId root="2.16.840.1.113883.10.20.1.26"/>
+<templateId root="2.16.840.1.113883.3.249.11.100.7"/>
+
+<!-- act/id which is the group or contract number related to the insurance policy or program CQ-208-->
+<id root="dbbb6311-8a4d-11df-a4ee-0800200c9c66"/><!--!!!FIX-->
+<!--Act statusCode must be completed CQ-210-->
+<!--This SHOULD be present and comes from the downloadable resource S display name is in quotes AUTOPOL - "automobile" policy;EHCPOL additional insurance in addition to Medicare in this case
+HSAPOL "Health Spending Account";PUBLICPOL "public healthcare" which is NOT Medicare - maybe a state program for example
+WBCPOL is "workers compensation" CQ-211,212-->
+<!--<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>-->
+<code code="PUBLICPOL" codeSystem="2.16.840.1.113883.5.4" displayName="Public Healthcare"/>
+<!--WVP performer type codes are numerous but PRF is performer representing the Payer CQ-213-->
+<statusCode code="completed"/>
+<performer typeCode="PRF">
+
+<!--performer/assignedEntity id is the payer identification and the extension comes from the downloadable resource section I insurance plan TYPE CQ-214-->
+<assignedEntity>
+<id root="2.16.840.1.113883.12.86" extension="MC"/>
+<!--<representedOrganization>
+<name>CMS</name>
+</representedOrganization>-->
+</assignedEntity>
+</performer>
+<!-- Act/participant @typeCode this represents the covered party CQ-215-->
+<participant typeCode="COV">
+<participantRole>
+<!--A covered party in a policy activity SHOULD contain one or more participant/participantRole/id to represent the patien's member of subscriber identifier with respect to the payer
+For participant/paricipantRole/id either the Social Security Number or HIC Number SHALL be submitted for Medicare patients. for SSN the ID @root SHALL be 2.16.840.1.113883.4.1 where
+the HIC id/@root shall be 2.16.840.1.113883.3.249.13 CQ-216"RoleCode" in the downloadable resource-->
+<!-- in this case theextension is the patients SSN for a medicare patient so it is the same each time for one patient-->
+<id root="2.16.840.1.113883.4.1" extension="@@SSN@@"/>
+<!--The covered party in tha policy activity SHOULD contain exactly one particpant/participantRole/code for self, family etc from the valuse set PolicyOrPrograCoverageRoleType 2.16.840.1.113883.1.11.19809 CQ-217,218-->
+<code code="SELF" codeSystem="2.16.840.1.113883.5.111" displayName="Self"/>
+</participantRole>
+</participant>
+</act>
+</entryRelationship>
+</act>
+</entry>
+</section>
+</component>
 </section>
 </component>
