[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openmrs-svn
Subject:    [30901] openmrs-modules/chica/tags: Version 1.60. 6 removes validation when parsing hl7 messages fro
From:       svn-noreply () openmrs ! org
Date:       2014-09-10 3:48:58
Message-ID: 20140910034859.0FB9540231 () openmrs ! osuosl ! org
[Download RAW message or body]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[30901] openmrs-modules/chica/tags: Version 1.60.6 removes validation when \
parsing hl7 messages from CHIRP</title> </head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>30901</dd>
<dt>Author</dt> <dd>msheley</dd>
<dt>Date</dt> <dd>2014-09-10 03:48:58 +0000 (Wed, 10 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Version 1.60.6 removes validation when parsing hl7 messages from CHIRP</pre>

<h3>Added Paths</h3>
<ul>
<li>openmrs-modules/chica/tags/Release 1.60.6/</li>
<li><a href="#openmrsmoduleschicatagsRelease1606metadataconfigxml">openmrs-modules/chica/tags/Release \
1.60.6/metadata/config.xml</a></li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/ADHD/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/Asthma/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/adolescent alcohol/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/adolescent depression_suicide/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/adolescent drugs/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/adolescent sexuality/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/developmental study/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/maternal depression/</li> \
<li><a href="#openmrsmoduleschicatagsRelease1606srcorgopenmrsmodulechicahl7immunizationImmunizationRegistryQueryjava">openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java</a></li>
 </ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#openmrsmoduleschicatagsRelease1606metadataconfigxml">openmrs-modules/chica/tags/Release \
1.60.6/metadata/config.xml</a></li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/ADHD/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/Asthma/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/adolescent alcohol/</li> <li>openmrs-modules/chica/tags/Release \
1.60.6/ruleLibrary/adolescent depression_suicide/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/adolescent drugs/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/adolescent sexuality/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/developmental study/</li> \
<li>openmrs-modules/chica/tags/Release 1.60.6/ruleLibrary/maternal depression/</li> \
<li><a href="#openmrsmoduleschicatagsRelease1606srcorgopenmrsmodulechicahl7immunizationImmunizationRegistryQueryjava">openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="openmrsmoduleschicatagsRelease1606"></a>
<div class="propset"><h4>Property changes: openmrs-modules/chica/tags/Release \
1.60.6</h4> <pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="addfile"><h4>Added: svn:ignore</h4></div>
<a id="svnmergeinfo"></a>
<div class="addfile"><h4>Added: svn:mergeinfo</h4></div>
<span class="cx">/openmrs-modules/chica/branches/chica 1.7.x compatible \
gis:26923-29251 </span><span class="cx">/openmrs-modules/chica/branches/chica 1.7.x \
compatible immunization:29719-30406 </span><span \
class="cx">/openmrs-modules/chica/branches/openmrs 1.6.1 compatible:15010-20687 \
</span><a id="openmrsmoduleschicatagsRelease1606metadataconfigxml"></a> <div \
class="delfile"><h4>Deleted: openmrs-modules/chica/tags/Release \
1.60.6/metadata/config.xml (30883 => 30901)</h4> <pre class="diff"><span>
<span class="info">--- openmrs-modules/chica/trunk/metadata/config.xml	2014-09-03 \
                03:00:09 UTC (rev 30883)
+++ openmrs-modules/chica/tags/Release 1.60.6/metadata/config.xml	2014-09-10 03:48:58 \
UTC (rev 30901) </span><span class="lines">@@ -1,357 +0,0 @@
</span><del>-&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
-&lt;!DOCTYPE module PUBLIC &quot;-//OpenMRS//DTD OpenMRS Config 1.0//EN&quot; \
                &quot;http://resources.openmrs.org/doctype/config-1.0.dtd&quot;&gt;
-
-&lt;module configVersion=&quot;1.0&quot;&gt;
-    
-    &lt;!-- Chica Module Properties --&gt;
-    &lt;id&gt;chica&lt;/id&gt;
-    &lt;name&gt;Chica&lt;/name&gt;
-    &lt;version&gt;1.60.5&lt;/version&gt;
-    &lt;package&gt;org.openmrs.module.@MODULE_ID@&lt;/package&gt;
-    &lt;author&gt;Vibha Anand and Tammy Dugan&lt;/author&gt;
-    &lt;description&gt;
-            Runs CHICA specific tasks.
-    &lt;/description&gt;
-
-    &lt;activator&gt;@MODULE_PACKAGE@.ChicaActivator&lt;/activator&gt;
-    
-    &lt;!-- /Chica Module Properties --&gt;
-    
-    &lt;require_version&gt;1.1.10.2283&lt;/require_version&gt;
-    &lt;require_modules&gt;
-        &lt;require_module \
                version=&quot;2.29.0&quot;&gt;org.openmrs.module.dss&lt;/require_module&gt;
                
-        &lt;require_module \
                version=&quot;2.0.0&quot;&gt;org.openmrs.module.atd&lt;/require_module&gt;
                
-        &lt;require_module \
version=&quot;1.3.30&quot;&gt;org.openmrs.module.sockethl7listener&lt;/require_module&gt;
                
-        &lt;require_module \
                version=&quot;1.0.4&quot;&gt;org.openmrs.module.rgccd&lt;/require_module&gt;
                
-        &lt;require_module \
                version=&quot;1.7.1&quot;&gt;org.openmrs.module.chirdlutil&lt;/require_module&gt;
                
-        &lt;require_module \
version=&quot;2.0.0&quot;&gt;org.openmrs.module.chirdlutilbackports&lt;/require_module&gt; \
                &lt;/require_modules&gt;
-    &lt;extension&gt;
-        &lt;point&gt;org.openmrs.admin.list&lt;/point&gt;
-        &lt;class&gt;org.openmrs.module.chica.extension.html.AdminList&lt;/class&gt;
-    &lt;/extension&gt;
-    
-    &lt;advice&gt;
-        &lt;point&gt;org.openmrs.module.sockethl7listener.service.SocketHL7ListenerService&lt;/point&gt;
                
-        &lt;class&gt;@MODULE_PACKAGE@.advice.TriggerPatientAfterAdvice&lt;/class&gt;
-    &lt;/advice&gt;
-    &lt;advice&gt;
-        &lt;point&gt;org.openmrs.module.atd.service.ATDService&lt;/point&gt;
-        &lt;class&gt;@MODULE_PACKAGE@.advice.TriggerPatientAfterAdvice&lt;/class&gt;
-    &lt;/advice&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.statsConfigFile&lt;/property&gt;
-        &lt;description&gt;This file contains configuration for chica statistics.
-        This file can be found at metadata/stats_config.xml
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.kiteHost&lt;/property&gt;
-        &lt;defaultValue&gt;134.68.32.31&lt;/defaultValue&gt;
-        &lt;description&gt;Host address to query for mrf dump and aliases.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.kitePort&lt;/property&gt;
-        &lt;defaultValue&gt;17094&lt;/defaultValue&gt;
-        &lt;description&gt;Port to query for mrf dump and aliases.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.kiteTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
-        &lt;description&gt;Timeout for mrf dump and alias queries (in seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.mrfArchiveDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where a copy of the mrf dump is stored.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.aliasArchiveDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where a copy of the alias query result is \
                stored.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.greaseBoardRefresh&lt;/property&gt;
-        &lt;defaultValue&gt;15&lt;/defaultValue&gt;
-        &lt;description&gt;Refresh period is seconds for the grease board refresh.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.mrfParseErrorDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where a copy of an mrf query result that \
                couldn't be parsed is stored.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;   
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.smsParseErrorDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where a copy of an sms checkin hl7 message that \
                couldn't be parsed is stored.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;   
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.mckessonParseErrorDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where a copy of an mckesson checkin hl7 message \
                that couldn't be parsed is stored.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.outboundHl7ArchiveDirectory&lt;/property&gt;
-        &lt;description&gt;Location to archive constructed outbound hl7 messages
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.pagerBaseURL&lt;/property&gt;
-        &lt;defaultValue&gt;http://www.ipnpaging.com/page.html&lt;/defaultValue&gt;
-        &lt;description&gt;Base URL of the pager service
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.pagerNumber&lt;/property&gt;
-        &lt;defaultValue&gt;3175431631&lt;/defaultValue&gt;
-        &lt;description&gt;Number for support pager for CHICA clinic.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.pagerUrlMessageParam&lt;/property&gt;
-        &lt;defaultValue&gt;message&lt;/defaultValue&gt;
-        &lt;description&gt;Name for the URL parameter containing the message text.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.pagerUrlNumberParam&lt;/property&gt;
-        &lt;defaultValue&gt;pin&lt;/defaultValue&gt;
-        &lt;description&gt;Name for the URL parameter containing the pager number.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;   
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.retireProvidersPeriod&lt;/property&gt;
-        &lt;defaultValue&gt;90&lt;/defaultValue&gt;
-        &lt;description&gt;Time period in days before inactive providers (no \
                encounters) are voided by a cron job&lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.greaseboardCheckoutState&lt;/property&gt;
-        &lt;defaultValue&gt;FINISHED&lt;/defaultValue&gt;
-        &lt;description&gt;State that tells us to remove the patient from the \
                greaseboard&lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.pagerWaitTimeBeforeRepage&lt;/property&gt;
-        &lt;defaultValue&gt;15&lt;/defaultValue&gt;
-        &lt;description&gt;How long to wait before the GET HELP NOW sends another \
                page request from Greaseboard&lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.medicationListTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
-        &lt;description&gt;Timeout for medication list queries (in seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.genericProviderId&lt;/property&gt;
-        &lt;description&gt;Generic provider id to use for medication query when no \
                other provider id.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.immunizationInputDirectory&lt;/property&gt;
-        &lt;description&gt;Directory containing results of immunization queries of \
                mrf dump. Becomes input to immunization forecasting.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.immunizationOutputDirectory&lt;/property&gt;
-        &lt;description&gt;Directory containing results of the immunization \
                forecasting.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.immunXSLT&lt;/property&gt;
-        &lt;description&gt;Directory containing xslt transform needed for \
                immunization query result xml.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.immunizationListTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;1&lt;/defaultValue&gt;
-        &lt;description&gt;Timeout for immunization list queries (in seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.stylesheetDirectory&lt;/property&gt;
-        &lt;description&gt;Directory where XSLT stylesheets are contained.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.growthChartConfigFile&lt;/property&gt;
-        &lt;description&gt;Location of the growth chart configuration file.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.growthChartPlotImage&lt;/property&gt;
-        &lt;description&gt;Location of the image used to make plots on the growth \
                charts.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisMapUrl&lt;/property&gt;
-        &lt;description&gt;The base URL to generate a CHICA GIS map.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisDataUrl&lt;/property&gt;
-        &lt;description&gt;The base URL to generate a CHICA GIS data.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisTutorRadius&lt;/property&gt;
-        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
-        &lt;description&gt;The map radius (in miles)of the tutoring resources for \
                the CHICA GIS map generation.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisExerciseRadius&lt;/property&gt;
-        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
-        &lt;description&gt;The map radius (in miles)of the exercise resources for \
                the CHICA GIS map generation.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisDentalRadius&lt;/property&gt;
-        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
-        &lt;description&gt;The map radius (in miles)of the dental resources for the \
                CHICA GIS map generation.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisToppingFilter&lt;/property&gt;
-        &lt;defaultValue&gt;6&lt;/defaultValue&gt;
-        &lt;description&gt;The maximum number of search result giving by the CHICA \
                GIS service.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;10&lt;/defaultValue&gt;
-        &lt;description&gt;The timeout for CHICA GIS queries (in seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisMaxRadius&lt;/property&gt;
-        &lt;defaultValue&gt;10&lt;/defaultValue&gt;
-        &lt;description&gt;The maximum radius to search for GIS data.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisConnectionTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
-        &lt;description&gt;The connection timeout for CHICA GIS queries (in \
                seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisMinAge&lt;/property&gt;
-        &lt;defaultValue&gt;1&lt;/defaultValue&gt;
-        &lt;description&gt;The minimum age (in years) for the GIS query.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.presnetConnectionTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
-        &lt;description&gt;The connection timeout for Presnet connections (in \
                seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.presnetReadTimeout&lt;/property&gt;
-        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
-        &lt;description&gt;The read timeout for Presnet connections (in seconds).
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.gisMinimumSearchResults&lt;/property&gt;
-        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
-        &lt;description&gt;The minimum number of search results to be met before \
                results are displayed on the forms.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.passcode&lt;/property&gt;
-        &lt;description&gt;Passcode used by mobile products to view CHICA data.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.allowableHL7MessageSources&lt;/property&gt;
-        &lt;defaultValue&gt;ECW&lt;/defaultValue&gt;
-        &lt;description&gt;Comma delimited list of allowable sources for hl7 ADT \
                messages.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationQueryActivated&lt;/property&gt;
-        &lt;defaultValue&gt;true&lt;/defaultValue&gt;
-        &lt;description&gt;Activate query to CHIRP registry
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationQueryConfigFile&lt;/property&gt;
-        &lt;description&gt;Location the configuration file for the hl7 immunization \
                query.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationQueryPassword&lt;/property&gt;
-        &lt;description&gt;Password to CHIRP registry.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationQueryURL&lt;/property&gt;
-        &lt;description&gt;CHIRP URL
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationQueryUserId&lt;/property&gt;
-        &lt;description&gt;Userid for access to CHIRP.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.chica.activateVXU&lt;/property&gt;
-        &lt;defaultValue&gt;false&lt;/defaultValue&gt;
-        &lt;description&gt;Allow hl7 VXU update to CHIRP immunization \
                registry&lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.ImmunizationOutputDirectory&lt;/property&gt;
-        &lt;description&gt;CHIRP hl7 query and response file directory
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    &lt;globalProperty&gt;
-        &lt;property&gt;chica.activateVXUToCreatePatient&lt;/property&gt;
-        &lt;description&gt;Activate VXU to create a patient in the CHIRP registry.
-        &lt;/description&gt;
-    &lt;/globalProperty&gt;
-    
-    
-    
-    &lt;!-- Internationalization --&gt;
-    &lt;!-- All message codes should start with @MODULE_ID@.* --&gt;
-    &lt;messages&gt;
-        &lt;lang&gt;en&lt;/lang&gt;
-        &lt;file&gt;messages.properties&lt;/file&gt;
-    &lt;/messages&gt;
-    &lt;!-- /Internationalization --&gt;
-    
-    &lt;mappingFiles&gt;
-        hcageinf.hbm.xml
-        lenageinf.hbm.xml
-        wtageinf.hbm.xml
-        bmiage.hbm.xml
-        encounter.hbm.xml
-        study.hbm.xml
-        study_attribute.hbm.xml
-        study_attribute_value.hbm.xml
-        old_rule.hbm.xml
-        chica1_patient.hbm.xml
-        chica1_patient_obsv.hbm.xml
-        chica1_appointments.hbm.xml
-        insurance_category.hbm.xml
-        family.hbm.xml
-        patient_family.hbm.xml
-        chica_hl7_export.hbm.xml
-        ddst.hbm.xml
-        high_bp.hbm.xml
-        chica_hl7_export_map.hbm.xml
-        chica_hl7_export_status.hbm.xml
-    &lt;/mappingFiles&gt;
-    
-    &lt;!-- Servlets --&gt;
-    &lt;!-- Accessed through the url \
                /pageContext()/moduleServlet/&lt;moduleId&gt;/&lt;servlet-name&gt; \
                --&gt;
-    &lt;servlet&gt;
-        &lt;servlet-name&gt;chicaMobile&lt;/servlet-name&gt;
-        &lt;servlet-class&gt;@MODULE_PACKAGE@.web.ChicaMobileServlet&lt;/servlet-class&gt;
                
-    &lt;/servlet&gt;
-    
-&lt;/module&gt;
-
</del></span></pre></div>
<a id="openmrsmoduleschicatagsRelease1606metadataconfigxmlfromrev30900openmrsmoduleschicatrunkmetadataconfigxml"></a>
 <div class="copfile"><h4>Copied: openmrs-modules/chica/tags/Release \
1.60.6/metadata/config.xml (from rev 30900, \
openmrs-modules/chica/trunk/metadata/config.xml) (0 => 30901)</h4> <pre \
class="diff"><span> <span class="info">--- openmrs-modules/chica/tags/Release \
                1.60.6/metadata/config.xml	                        (rev 0)
+++ openmrs-modules/chica/tags/Release 1.60.6/metadata/config.xml	2014-09-10 03:48:58 \
UTC (rev 30901) </span><span class="lines">@@ -0,0 +1,357 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;!DOCTYPE module PUBLIC &quot;-//OpenMRS//DTD OpenMRS Config 1.0//EN&quot; \
&quot;http://resources.openmrs.org/doctype/config-1.0.dtd&quot;&gt; +
+&lt;module configVersion=&quot;1.0&quot;&gt;
+    
+    &lt;!-- Chica Module Properties --&gt;
+    &lt;id&gt;chica&lt;/id&gt;
+    &lt;name&gt;Chica&lt;/name&gt;
+    &lt;version&gt;1.60.6&lt;/version&gt;
+    &lt;package&gt;org.openmrs.module.@MODULE_ID@&lt;/package&gt;
+    &lt;author&gt;Vibha Anand and Tammy Dugan&lt;/author&gt;
+    &lt;description&gt;
+            Runs CHICA specific tasks.
+    &lt;/description&gt;
+
+    &lt;activator&gt;@MODULE_PACKAGE@.ChicaActivator&lt;/activator&gt;
+    
+    &lt;!-- /Chica Module Properties --&gt;
+    
+    &lt;require_version&gt;1.1.10.2283&lt;/require_version&gt;
+    &lt;require_modules&gt;
+        &lt;require_module \
version=&quot;2.29.0&quot;&gt;org.openmrs.module.dss&lt;/require_module&gt; +        \
&lt;require_module version=&quot;2.0.0&quot;&gt;org.openmrs.module.atd&lt;/require_module&gt;
 +        &lt;require_module \
version=&quot;1.3.30&quot;&gt;org.openmrs.module.sockethl7listener&lt;/require_module&gt;
 +        &lt;require_module \
version=&quot;1.0.4&quot;&gt;org.openmrs.module.rgccd&lt;/require_module&gt; +        \
&lt;require_module version=&quot;1.7.1&quot;&gt;org.openmrs.module.chirdlutil&lt;/require_module&gt;
 +        &lt;require_module \
version=&quot;2.0.0&quot;&gt;org.openmrs.module.chirdlutilbackports&lt;/require_module&gt; \
&lt;/require_modules&gt; +    &lt;extension&gt;
+        &lt;point&gt;org.openmrs.admin.list&lt;/point&gt;
+        &lt;class&gt;org.openmrs.module.chica.extension.html.AdminList&lt;/class&gt;
+    &lt;/extension&gt;
+    
+    &lt;advice&gt;
+        &lt;point&gt;org.openmrs.module.sockethl7listener.service.SocketHL7ListenerService&lt;/point&gt;
 +        &lt;class&gt;@MODULE_PACKAGE@.advice.TriggerPatientAfterAdvice&lt;/class&gt;
 +    &lt;/advice&gt;
+    &lt;advice&gt;
+        &lt;point&gt;org.openmrs.module.atd.service.ATDService&lt;/point&gt;
+        &lt;class&gt;@MODULE_PACKAGE@.advice.TriggerPatientAfterAdvice&lt;/class&gt;
+    &lt;/advice&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.statsConfigFile&lt;/property&gt;
+        &lt;description&gt;This file contains configuration for chica statistics.
+        This file can be found at metadata/stats_config.xml
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.kiteHost&lt;/property&gt;
+        &lt;defaultValue&gt;134.68.32.31&lt;/defaultValue&gt;
+        &lt;description&gt;Host address to query for mrf dump and aliases.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.kitePort&lt;/property&gt;
+        &lt;defaultValue&gt;17094&lt;/defaultValue&gt;
+        &lt;description&gt;Port to query for mrf dump and aliases.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.kiteTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
+        &lt;description&gt;Timeout for mrf dump and alias queries (in seconds).
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.mrfArchiveDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where a copy of the mrf dump is stored.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.aliasArchiveDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where a copy of the alias query result is \
stored. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.greaseBoardRefresh&lt;/property&gt;
+        &lt;defaultValue&gt;15&lt;/defaultValue&gt;
+        &lt;description&gt;Refresh period is seconds for the grease board refresh.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.mrfParseErrorDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where a copy of an mrf query result that \
couldn't be parsed is stored. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;   
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.smsParseErrorDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where a copy of an sms checkin hl7 message that \
couldn't be parsed is stored. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;   
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.mckessonParseErrorDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where a copy of an mckesson checkin hl7 message \
that couldn't be parsed is stored. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.outboundHl7ArchiveDirectory&lt;/property&gt;
+        &lt;description&gt;Location to archive constructed outbound hl7 messages
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.pagerBaseURL&lt;/property&gt;
+        &lt;defaultValue&gt;http://www.ipnpaging.com/page.html&lt;/defaultValue&gt;
+        &lt;description&gt;Base URL of the pager service
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.pagerNumber&lt;/property&gt;
+        &lt;defaultValue&gt;3175431631&lt;/defaultValue&gt;
+        &lt;description&gt;Number for support pager for CHICA clinic.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.pagerUrlMessageParam&lt;/property&gt;
+        &lt;defaultValue&gt;message&lt;/defaultValue&gt;
+        &lt;description&gt;Name for the URL parameter containing the message text.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.pagerUrlNumberParam&lt;/property&gt;
+        &lt;defaultValue&gt;pin&lt;/defaultValue&gt;
+        &lt;description&gt;Name for the URL parameter containing the pager number.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;   
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.retireProvidersPeriod&lt;/property&gt;
+        &lt;defaultValue&gt;90&lt;/defaultValue&gt;
+        &lt;description&gt;Time period in days before inactive providers (no \
encounters) are voided by a cron job&lt;/description&gt; +    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.greaseboardCheckoutState&lt;/property&gt;
+        &lt;defaultValue&gt;FINISHED&lt;/defaultValue&gt;
+        &lt;description&gt;State that tells us to remove the patient from the \
greaseboard&lt;/description&gt; +    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.pagerWaitTimeBeforeRepage&lt;/property&gt;
+        &lt;defaultValue&gt;15&lt;/defaultValue&gt;
+        &lt;description&gt;How long to wait before the GET HELP NOW sends another \
page request from Greaseboard&lt;/description&gt; +    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.medicationListTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
+        &lt;description&gt;Timeout for medication list queries (in seconds).
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.genericProviderId&lt;/property&gt;
+        &lt;description&gt;Generic provider id to use for medication query when no \
other provider id. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.immunizationInputDirectory&lt;/property&gt;
+        &lt;description&gt;Directory containing results of immunization queries of \
mrf dump. Becomes input to immunization forecasting. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.immunizationOutputDirectory&lt;/property&gt;
+        &lt;description&gt;Directory containing results of the immunization \
forecasting. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.immunXSLT&lt;/property&gt;
+        &lt;description&gt;Directory containing xslt transform needed for \
immunization query result xml. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.immunizationListTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;1&lt;/defaultValue&gt;
+        &lt;description&gt;Timeout for immunization list queries (in seconds).
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.stylesheetDirectory&lt;/property&gt;
+        &lt;description&gt;Directory where XSLT stylesheets are contained.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.growthChartConfigFile&lt;/property&gt;
+        &lt;description&gt;Location of the growth chart configuration file.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.growthChartPlotImage&lt;/property&gt;
+        &lt;description&gt;Location of the image used to make plots on the growth \
charts. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisMapUrl&lt;/property&gt;
+        &lt;description&gt;The base URL to generate a CHICA GIS map.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisDataUrl&lt;/property&gt;
+        &lt;description&gt;The base URL to generate a CHICA GIS data.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisTutorRadius&lt;/property&gt;
+        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
+        &lt;description&gt;The map radius (in miles)of the tutoring resources for \
the CHICA GIS map generation. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisExerciseRadius&lt;/property&gt;
+        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
+        &lt;description&gt;The map radius (in miles)of the exercise resources for \
the CHICA GIS map generation. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisDentalRadius&lt;/property&gt;
+        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
+        &lt;description&gt;The map radius (in miles)of the dental resources for the \
CHICA GIS map generation. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisToppingFilter&lt;/property&gt;
+        &lt;defaultValue&gt;6&lt;/defaultValue&gt;
+        &lt;description&gt;The maximum number of search result giving by the CHICA \
GIS service. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;10&lt;/defaultValue&gt;
+        &lt;description&gt;The timeout for CHICA GIS queries (in seconds).
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisMaxRadius&lt;/property&gt;
+        &lt;defaultValue&gt;10&lt;/defaultValue&gt;
+        &lt;description&gt;The maximum radius to search for GIS data.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisConnectionTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
+        &lt;description&gt;The connection timeout for CHICA GIS queries (in \
seconds). +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisMinAge&lt;/property&gt;
+        &lt;defaultValue&gt;1&lt;/defaultValue&gt;
+        &lt;description&gt;The minimum age (in years) for the GIS query.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.presnetConnectionTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
+        &lt;description&gt;The connection timeout for Presnet connections (in \
seconds). +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.presnetReadTimeout&lt;/property&gt;
+        &lt;defaultValue&gt;5&lt;/defaultValue&gt;
+        &lt;description&gt;The read timeout for Presnet connections (in seconds).
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.gisMinimumSearchResults&lt;/property&gt;
+        &lt;defaultValue&gt;3&lt;/defaultValue&gt;
+        &lt;description&gt;The minimum number of search results to be met before \
results are displayed on the forms. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.passcode&lt;/property&gt;
+        &lt;description&gt;Passcode used by mobile products to view CHICA data.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.allowableHL7MessageSources&lt;/property&gt;
+        &lt;defaultValue&gt;ECW&lt;/defaultValue&gt;
+        &lt;description&gt;Comma delimited list of allowable sources for hl7 ADT \
messages. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationQueryActivated&lt;/property&gt;
+        &lt;defaultValue&gt;true&lt;/defaultValue&gt;
+        &lt;description&gt;Activate query to CHIRP registry
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationQueryConfigFile&lt;/property&gt;
+        &lt;description&gt;Location the configuration file for the hl7 immunization \
query. +        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationQueryPassword&lt;/property&gt;
+        &lt;description&gt;Password to CHIRP registry.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationQueryURL&lt;/property&gt;
+        &lt;description&gt;CHIRP URL
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationQueryUserId&lt;/property&gt;
+        &lt;description&gt;Userid for access to CHIRP.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.chica.activateVXU&lt;/property&gt;
+        &lt;defaultValue&gt;false&lt;/defaultValue&gt;
+        &lt;description&gt;Allow hl7 VXU update to CHIRP immunization \
registry&lt;/description&gt; +    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.ImmunizationOutputDirectory&lt;/property&gt;
+        &lt;description&gt;CHIRP hl7 query and response file directory
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    &lt;globalProperty&gt;
+        &lt;property&gt;chica.activateVXUToCreatePatient&lt;/property&gt;
+        &lt;description&gt;Activate VXU to create a patient in the CHIRP registry.
+        &lt;/description&gt;
+    &lt;/globalProperty&gt;
+    
+    
+    
+    &lt;!-- Internationalization --&gt;
+    &lt;!-- All message codes should start with @MODULE_ID@.* --&gt;
+    &lt;messages&gt;
+        &lt;lang&gt;en&lt;/lang&gt;
+        &lt;file&gt;messages.properties&lt;/file&gt;
+    &lt;/messages&gt;
+    &lt;!-- /Internationalization --&gt;
+    
+    &lt;mappingFiles&gt;
+        hcageinf.hbm.xml
+        lenageinf.hbm.xml
+        wtageinf.hbm.xml
+        bmiage.hbm.xml
+        encounter.hbm.xml
+        study.hbm.xml
+        study_attribute.hbm.xml
+        study_attribute_value.hbm.xml
+        old_rule.hbm.xml
+        chica1_patient.hbm.xml
+        chica1_patient_obsv.hbm.xml
+        chica1_appointments.hbm.xml
+        insurance_category.hbm.xml
+        family.hbm.xml
+        patient_family.hbm.xml
+        chica_hl7_export.hbm.xml
+        ddst.hbm.xml
+        high_bp.hbm.xml
+        chica_hl7_export_map.hbm.xml
+        chica_hl7_export_status.hbm.xml
+    &lt;/mappingFiles&gt;
+    
+    &lt;!-- Servlets --&gt;
+    &lt;!-- Accessed through the url \
/pageContext()/moduleServlet/&lt;moduleId&gt;/&lt;servlet-name&gt; --&gt; +    \
&lt;servlet&gt; +        &lt;servlet-name&gt;chicaMobile&lt;/servlet-name&gt;
+        &lt;servlet-class&gt;@MODULE_PACKAGE@.web.ChicaMobileServlet&lt;/servlet-class&gt;
 +    &lt;/servlet&gt;
+    
+&lt;/module&gt;
+
</ins></span></pre></div>
<a id="openmrsmoduleschicatagsRelease1606srcorgopenmrsmodulechicahl7immunizationImmunizationRegistryQueryjava"></a>
 <div class="delfile"><h4>Deleted: openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java \
(30883 => 30901)</h4> <pre class="diff"><span>
<span class="info">--- \
openmrs-modules/chica/trunk/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java	2014-09-03 \
                03:00:09 UTC (rev 30883)
+++ openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java	2014-09-10 \
03:48:58 UTC (rev 30901) </span><span class="lines">@@ -1,935 +0,0 @@
</span><del>-package org.openmrs.module.chica.hl7.immunization;
-
-/**
- * 
- */
-
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Hibernate;
-import org.openmrs.Concept;
-import org.openmrs.ConceptMap;
-import org.openmrs.Encounter;
-import org.openmrs.Patient;
-import org.openmrs.PatientIdentifier;
-import org.openmrs.PatientIdentifierType;
-import org.openmrs.PersonAddress;
-import org.openmrs.PersonAttribute;
-import org.openmrs.PersonAttributeType;
-import org.openmrs.PersonName;
-import org.openmrs.api.AdministrationService;
-import org.openmrs.api.ConceptService;
-import org.openmrs.api.LocationService;
-import org.openmrs.api.PatientService;
-import org.openmrs.api.PersonService;
-import org.openmrs.api.context.Context;
-import org.openmrs.module.chica.ImmunizationForecast;
-import org.openmrs.module.chica.ImmunizationForecastLookup;
-import org.openmrs.module.chica.ImmunizationPrevious;
-import org.openmrs.module.chica.ImmunizationQueryOutput;
-import org.openmrs.module.chica.service.ChicaService;
-import org.openmrs.module.chirdlutil.util.HttpUtil;
-import org.openmrs.module.chirdlutil.util.Util;
-import org.openmrs.module.chirdlutilbackports.hibernateBeans.Error;
-import org.openmrs.module.chirdlutilbackports.service.ChirdlUtilBackportsService;
-
-import ca.uhn.hl7v2.HL7Exception;
-import ca.uhn.hl7v2.model.Message;
-import ca.uhn.hl7v2.model.Type;
-import ca.uhn.hl7v2.model.v231.datatype.CE;
-import ca.uhn.hl7v2.model.v231.datatype.CX;
-import ca.uhn.hl7v2.model.v231.datatype.FN;
-import ca.uhn.hl7v2.model.v231.datatype.NM;
-import ca.uhn.hl7v2.model.v231.datatype.ST;
-import ca.uhn.hl7v2.model.v231.datatype.TS;
-import ca.uhn.hl7v2.model.v231.datatype.XAD;
-import ca.uhn.hl7v2.model.v231.datatype.XPN;
-import ca.uhn.hl7v2.model.v231.group.VXX_V02_PIDNK1;
-import ca.uhn.hl7v2.model.v231.message.VXQ_V01;
-import ca.uhn.hl7v2.model.v231.message.VXR_V03;
-import ca.uhn.hl7v2.model.v231.message.VXU_V04;
-import ca.uhn.hl7v2.model.v231.message.VXX_V02;
-import ca.uhn.hl7v2.model.v231.segment.NK1;
-import ca.uhn.hl7v2.model.v231.segment.OBX;
-import ca.uhn.hl7v2.model.v231.segment.PID;
-import ca.uhn.hl7v2.model.v231.segment.RXA;
-import ca.uhn.hl7v2.parser.PipeParser;
-import ca.uhn.hl7v2.util.Terser;
-import ca.uhn.hl7v2.validation.impl.NoValidation;
-
-/**
- * @author tmdugan
- * 
- */
-public class ImmunizationRegistryQuery
-{
-	private static Log log = LogFactory.getLog(ImmunizationRegistryQuery.class);
-
-	private static org.openmrs.Encounter encounter = null;
-	private static String CHIRP_NOT_AVAILABLE = &quot;CHIRP_not_available&quot;;
-	private static String NOT_IN_CHIRP = &quot;not_in_chirp_registry&quot;;
-	private static String NOT_MATCHED = &quot;CHIRP_match_not_found&quot;;
-	private static String NEXT_OF_KIN = &quot;Next of Kin&quot;;
-	private static String IMMUNIZATION_REGISTRY = &quot;Immunization Registry&quot;;
-	private static String MATCHED = &quot;CHIRP_match_found&quot;;
-	private static String CREATED = &quot;CHIRP_patient_created&quot;;
-	private static  String SOURCE = &quot;CVX&quot;;
-	private static String GENERIC = &quot;CVX unspecified&quot;;
-	private static String ERROR_CATEGORY = &quot;Query Immunization List \
                Connection&quot;;
-	private static String LOINC_DOSE_NUMBER_CODE = &quot;30973-2&quot;;
-	private static String LOINC_EARLIEST_TIME_TO_GIVE = &quot;30981-5&quot;;
-	private static String LOINC_DATE_VACCINE_DUE = &quot;30980-7&quot;;
-	private static String LOINC_VACCINE_TYPE = &quot;30956-7&quot;;
-	private static String CHIRP_ERROR = &quot;CHIRP is not accessible.&quot;;
-	private static String CHIRP_PARSING_ERROR = &quot;CHIRP HL7 parsing error.&quot;;
-	private static String CHIRP_UPDATE_FAILED = &quot;CHIRP is accessible, but the \
                immunization update failed.&quot;;
-	private static String CHIRP_RESPONSE_INVALID = &quot;CHIRP response was empty or \
                invalid&quot;;
-	
-	/**
-	 * 
-	 * Auto generated method comment
-	 * 
-	 * @param messageString
-	 * @param mrn
-	 * @param patientId
-	 */
-	private static void createImmunizationList(String messageString, String mrn,
-			Integer patientId) {
-
-		if (messageString == null) {
-			log.info(&quot;immunization list is null for mrn: &quot; + mrn
-					+ &quot; so immunization list could not be created&quot;);
-			return;
-		}
-
-		try {
-
-			messageString = messageString.trim();
-
-			if (messageString.length() == 0) {
-				return;
-			}
-			String newMessageString = messageString;
-			PipeParser pipeParser = new PipeParser();
-			pipeParser.setValidationContext(new NoValidation());
-			Message message = null;
-			try {
-				message = pipeParser.parse(newMessageString);
-			} catch (Exception e) {
-				
-				logError( CHIRP_PARSING_ERROR, 
-						&quot;HL7 response = &quot; + messageString ,
-						null, patientId);
-				return;
-			}
-			parseImmunizations(message, patientId);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	public static void parseImmunizations(Message message, Integer patientId)
-			throws Exception {
-		
-		ConceptService conceptService = Context.getConceptService();
-		ChicaService chicaService = \
                Context.getService(org.openmrs.module.chica.service.ChicaService.class);	
                
-		ImmunizationForecastLookup.removeImmunizationList(patientId);
-		
-		if (message instanceof VXR_V03) {
-			VXR_V03 vxr = (VXR_V03) message;
-			int numReps = vxr.getORCRXARXROBXNTEReps();
-			for (int i = 0; i &lt; numReps; i++) {
-				HashMap&lt;String, ImmunizationPrevious&gt; prevImmunizationList = new \
                HashMap&lt;String, ImmunizationPrevious&gt;();
-				HashMap&lt;String, ImmunizationForecast&gt; forecastedImmunizationList = new \
                HashMap&lt;String, ImmunizationForecast&gt;();
-			
-				RXA rxa = vxr.getORCRXARXROBXNTE(i).getRXA();
-				
-				String vaccineCode = null;
-				String vaccineName = null;
-				String vaccineDate = null;
-				NM doseNM = null;
-				
-				
-				ImmunizationPrevious previousImmunization = null;
-				ImmunizationForecast forecastedImmunization = null;
-
-				// previously given vaccines
-				if (rxa != null) {
-					vaccineCode = rxa.getAdministeredCode().getIdentifier()
-							.getValue();
-					vaccineName = rxa.getAdministeredCode().getText()
-							.getValue();
-					doseNM = rxa.getAdministrationSubIDCounter();
-					
-					
-					//2013-05-08 - Format for forecasted messaegs no longer has 
-					// 0 for the dose number.  Now that same field has 999 just like the 
-					//vaccine history.  The forecasting messages now have 
-					//vaccine code = 998 and name = &quot;no vaccine administered&quot;.
-					if (vaccineCode != null &amp;&amp; \
                !vaccineCode.equalsIgnoreCase(&quot;998&quot;)){
-						// This is a previous immunization	
-						Integer doseNumber = Integer.valueOf(doseNM.getValue());
-						vaccineDate = rxa.getDateTimeEndOfAdministration()
-						.getTimeOfAnEvent().getValue();
-						
-						System.out.println(&quot;history: &quot; + vaccineCode + &quot; &quot; 
-								+ vaccineName + &quot; &quot; 
-								+ doseNM.getValue() + &quot; &quot; 
-								+ vaccineDate);
-					
-					  	// Use Concept maps vaccine category
-						// Combination vaccines will map to multiple codes
-						Concept cvxVaccineConcept = conceptService.getConceptByMapping(vaccineCode, \
                SOURCE );
-						if (cvxVaccineConcept == null ){
-							log.info(&quot;Immunization: CVX vaccine code &quot; + vaccineCode + &quot; \
                (&quot; + vaccineName + &quot;) &quot; + &quot;not mapped to a \
                concept&quot; );
-							continue;
-						}
-						
-						//Get all general (unspecified) mapped vaccine concepts for each RXA vaccine \
                code.
-						List&lt;ConceptMap&gt; conceptMaps = \
                chicaService.getConceptMapsByVaccine(cvxVaccineConcept, GENERIC);
-						if (conceptMaps == null || conceptMaps.size() == 0){
-							continue;
-						}
-						
-						for (ConceptMap conceptMap: conceptMaps){
-							String unspecifiedVaccineCode = conceptMap.getSourceCode();
-							String unspecifiedVaccineName = &quot;&quot;;
-							Concept unspecifiedVaccineConcept = \
                conceptService.getConceptByMapping(unspecifiedVaccineCode, SOURCE );
-							if (unspecifiedVaccineConcept != null &amp;&amp; \
                unspecifiedVaccineConcept.getName() != null){
-								unspecifiedVaccineName = unspecifiedVaccineConcept.getName().getName();	
-							}
-							if (vaccineCode != null) {
-								previousImmunization = new ImmunizationPrevious();
-	
-								previousImmunization.setVaccineName(unspecifiedVaccineName);
-								previousImmunization
-										.setVaccineCode(unspecifiedVaccineCode);
-								previousImmunization.setPatientId(patientId);
-								previousImmunization.setDate(vaccineDate);
-								previousImmunization.setDose(doseNumber);
-								prevImmunizationList.put(unspecifiedVaccineCode,
-										previousImmunization);
-							}
-						} 
-						
-						// add the previous immunizations
-						for (ImmunizationPrevious prevImmunization : prevImmunizationList
-								.values()) {
-
-							Integer immundDoseNumber = prevImmunization.getDose();
-
-							if (immundDoseNumber != null &amp;&amp; immundDoseNumber &gt; 0) {
-								ImmunizationQueryOutput immuneOutput = ImmunizationForecastLookup
-										.getImmunizationList(patientId);
-
-								if (immuneOutput == null) {
-									immuneOutput = new ImmunizationQueryOutput();
-									ImmunizationForecastLookup.addImmunizationList(
-											patientId, immuneOutput);
-								}
-
-								immuneOutput.addImmunizationPrevious(prevImmunization);
-							}
-						}
-						
-					}
-					else {
-					
-						// get the rxa information for forecasting
-							// 2013-05-08 - CHIRP changed - vaccine code and vaccine code are useless.
-							// Get the vaccine name from a value in an OBX.
-							// Now we need to through forecast OBX information for forecasting 
-						forecastedImmunization = new ImmunizationForecast();
-						
-						int numObs = vxr.getORCRXARXROBXNTE(i).getOBXNTEReps();
-						for (int j = 0; j &lt; numObs; j++) {
-							OBX obx = vxr.getORCRXARXROBXNTE(i).getOBXNTE(j).getOBX();
-							if (obx == null){
-								continue;
-							}
-							String obxCode = obx.getObservationIdentifier()
-								.getIdentifier().getValue();
-							if (obxCode == null) {
-								continue;
-							}
-							Type obxValue = obx.getObservationValue(0).getData();
-							if (obxValue == null){
-								continue;
-							}
-							String obsValueType = obxValue.getName();
-							
-						
-							// this code indicates the type of vaccine
-							if (obxCode.equals(LOINC_VACCINE_TYPE)) {
-								if (obsValueType.equals(&quot;CE&quot;)) {
-									CE data = (CE) obxValue;
-									if (data == null || data.getIdentifier() == null
-											||data.getText() == null){
-										//Must have a vaccine type
-										continue;
-									}
-									
-									//Note: newer hl7 has a junky vaccine name
-									String obxVaccineName = data.getText()
-										.getValue();
-									if (obxVaccineName != null &amp;&amp; forecastedImmunization != null) {
-										forecastedImmunization
-											.setVaccineName(obxVaccineName);
-									}	
-									
-									String obxVaccineCode = data.getIdentifier()
-										.getValue();
-									if (obxVaccineCode != null &amp;&amp; forecastedImmunization != null) {
-										forecastedImmunization
-											.setVaccineCode(obxVaccineCode);
-									}	
-								}
-							}
-							// this code indicates the due date of the next
-							// vaccination
-							if (obxCode.equals(LOINC_DATE_VACCINE_DUE)) {
-								if (obsValueType.equals(&quot;TS&quot;)) {
-									TS data = (TS) obxValue;
-									String dateString = data.getTimeOfAnEvent()
-										.getValue();
-									if (dateString != null &amp;&amp; forecastedImmunization != null) {
-										forecastedImmunization
-											.setDateDue(dateString);
-									}	
-								}
-							}
-	
-						// this code indicates the dose of the next vaccination
-						//if (obxCode.equals(&quot;30979-9&amp;30973-2&quot;)) {
-							if (obxCode.equals(LOINC_DOSE_NUMBER_CODE)) {
-								if (obsValueType.equals(&quot;NM&quot;)) {
-									NM data = (NM) obxValue;
-									String dataString = data.getValue();
-									if (dataString != null &amp;&amp; forecastedImmunization != null) {
-										forecastedImmunization.setDose(Integer
-											.parseInt(dataString));
-									}
-								}
-							}
-	
-							// this code indicates the earliest date of the next
-							// vaccination
-							//if (obxCode.equals(&quot;30979-9&amp;30981-5&quot;)) {
-							if (obxCode.equals(LOINC_EARLIEST_TIME_TO_GIVE)) {
-								if (obsValueType.equals(&quot;TS&quot;)) {
-									TS data = (TS) obxValue;
-									String dateString = data.getTimeOfAnEvent()
-											.getValue();
-									if (dateString != null &amp;&amp; forecastedImmunization != null ) {
-										forecastedImmunization
-												.setEarliestDate(dateString);
-									}
-								}
-							}
-							
-							
-						}
-						
-						//Create the forecasted list 
-						
-						String forecastVaccineCode = forecastedImmunization.getVaccineCode();
-						//get the concept for hl7 CVX vaccine code
-						Concept vaccineConcept = \
                conceptService.getConceptByMapping(forecastVaccineCode, SOURCE );
-						if (vaccineConcept == null){
-							log.error(&quot;ImmunizationForecast: CVX vaccine code not mapped to a \
concept : &quot; + forecastVaccineCode + &quot; (&quot;  + \
                forecastedImmunization.getVaccineName() );
-							continue;
-						}
-						
-						//Find the mapped codes for the concept
-						List&lt;ConceptMap&gt; conceptMaps = \
                chicaService.getConceptMapsByVaccine(vaccineConcept, GENERIC); 
-						if (conceptMaps == null || conceptMaps.size() == 0){
-							log.info(&quot;ImmunizationForecast: No unspecified CVX code exists for \
                concept: &quot; 
-									+ vaccineConcept.getName().getName() + &quot;,  CVX: &quot; + \
                forecastVaccineCode);
-						}
-						
-						//Get the unspecified name and cvx code to add to forecasting list
-						for (ConceptMap conceptMap : conceptMaps) {
-							
-							String unspecfiedCode = conceptMap.getSourceCode();
-							if (unspecfiedCode == null || \
                unspecfiedCode.trim().equalsIgnoreCase(&quot;&quot;) ){
-								log.info(&quot;ImmunizationForecast: Concept map exists, but no source_code \
                defined.  Concept id: &quot; 
-										+ conceptMap.getConcept().getConceptId());
-								continue;
-							}
-							Concept unspecifiedConcept = \
                conceptService.getConceptByMapping(unspecfiedCode, SOURCE );
-							if (unspecifiedConcept == null || unspecifiedConcept.getName() == null ){
-								log.info(&quot;ImmunizationForecast: There is no concept for CVX code: \
                &quot;
-										+ unspecfiedCode);
-								continue;
-							}
-							
-							String unspecifiedVaccineName = unspecifiedConcept.getName().getName();
-
-							forecastedImmunization.setVaccineName(unspecifiedVaccineName);
-							forecastedImmunization
-									.setVaccineCode(unspecfiedCode);
-							forecastedImmunization.setPatientId(patientId);
-							forecastedImmunizationList.put(unspecfiedCode,
-									forecastedImmunization);
-							
-						}
-												
-						//loop through forecast immunization obx
-						// added the forecasted immunizations
-						for (ImmunizationForecast foreImmunization : forecastedImmunizationList
-								.values()) {
-	
-							Integer doseNumber = foreImmunization.getDose();
-	
-							if (doseNumber != null &amp;&amp; doseNumber &gt; 0) {
-								ImmunizationQueryOutput immuneOutput = ImmunizationForecastLookup
-										.getImmunizationList(patientId);
-	
-								if (immuneOutput == null) {
-									immuneOutput = new ImmunizationQueryOutput();
-									ImmunizationForecastLookup.addImmunizationList(
-											patientId, immuneOutput);
-								}
-	
-								immuneOutput.addImmunizationForecast(foreImmunization);
-							}
-						}
-					}// end of forecast parsing
-				}// rxa exists
-			}//end of loop through all rxa's
-		}// is VXR
-	}
-	
-	private static String getData(String message){
-		String data = &quot;&quot;;
-		try {
-			AdministrationService adminService = Context.getAdministrationService();
-			String userId = adminService
-			.getGlobalProperty(&quot;chica.ImmunizationQueryUserId&quot;);
-			String password = adminService
-			.getGlobalProperty(&quot;chica.ImmunizationQueryPassword&quot;);
-
-			data = URLEncoder.encode(&quot;USERID&quot;, &quot;UTF-8&quot;) + &quot;=&quot;
-			+ URLEncoder.encode(userId, &quot;UTF-8&quot;);
-			data += &quot;&amp;&quot; + URLEncoder.encode(&quot;PASSWORD&quot;, \
                &quot;UTF-8&quot;) + &quot;=&quot;
-			+ URLEncoder.encode(password, &quot;UTF-8&quot;);
-			
-			if (message != null &amp;&amp; message.contains(&quot;VXU&quot;)){
-				data += &quot;&amp;&quot; + URLEncoder.encode(&quot;debug&quot;, \
                &quot;UTF-8&quot;) + &quot;=&quot;
-				+ URLEncoder.encode(&quot;debug&quot;, &quot;UTF-8&quot;);
-				data += &quot;&amp;&quot; + URLEncoder.encode(&quot;deduplication&quot;, \
                &quot;UTF-8&quot;) + &quot;=&quot;
-				+ URLEncoder.encode(&quot;deduplication&quot;, &quot;UTF-8&quot;);
-			}
-			data += &quot;&amp;&quot; + URLEncoder.encode(&quot;MESSAGEDATA&quot;, \
                &quot;UTF-8&quot;) + &quot;=&quot;
-			+ URLEncoder.encode(message, &quot;UTF-8&quot;);
-		} catch (Exception e) {
-			e.printStackTrace();
-		} 
-		return data;		
-		
-	}
-	
-	public static String queryCHIRP( Encounter encounter){
-		
-		AdministrationService adminService = Context.getAdministrationService();
-		ConceptService conceptService = Context.getConceptService();
-		PatientService patientService = Context.getPatientService();
-		String dir = adminService.getGlobalProperty(&quot;chica.ImmunizationOutputDirectory&quot;);
                
-		String url = adminService.getGlobalProperty(&quot;chica.ImmunizationQueryURL&quot;);
                
-		Integer timeout = \
Integer.parseInt(adminService.getGlobalProperty(&quot;chica.immunizationListTimeout&quot;));
                
-		String activateQuery = \
                adminService.getGlobalProperty(&quot;chica.ImmunizationQueryActivated&quot;);
                
-		boolean OkToQuery = false;
-		if (activateQuery != null &amp;&amp;
-				 (activateQuery.equalsIgnoreCase(&quot;true&quot;) 
-						|| activateQuery.equalsIgnoreCase(&quot;yes&quot;) 
-						|| activateQuery.equalsIgnoreCase(&quot;T&quot;) 
-						|| activateQuery.equalsIgnoreCase(&quot;Y&quot;))){
-			OkToQuery = true;
-
-		}
-		
-		Concept statusConcept = conceptService.getConceptByName(&quot;CHIRP_Status&quot;);
-		timeout = timeout*1000;
-		String queryResponse = null;
-		long queryTime = 0;
-		Integer encounterId = encounter.getEncounterId();;
-		Patient chicaPatient = encounter.getPatient();
-		PipeParser parser = new PipeParser();
-		
-		try {
-			
-			// Get identifier
-			chicaPatient = patientService.getPatient(chicaPatient.getPatientId());
-			Hibernate.initialize(chicaPatient);
-			String mrn = chicaPatient.getPatientIdentifier().getIdentifier();
-			
-			//construct vxq
-		
-			ImmunizationQueryConstructor constructor = new ImmunizationQueryConstructor();
-			VXQ_V01 vxq = new VXQ_V01();
-			String vxqString = ImmunizationQueryConstructor.constructVXQ(vxq, encounter);
-			if (vxqString == null || vxqString.trim().equals(&quot;&quot;)){
-				log.error(&quot;Immunization: VXQ string for &quot; + mrn + &quot; is null or \
                empty.&quot;);
-				return null;
-			}
-			
-			ImmunizationQueryConstructor.saveFile(dir, vxqString, &quot;vxq_1&quot;, \
                encounter);
-			String data = getData(vxqString);
-			log.info(&quot;Immunization: vxq = &quot; +  vxqString);
-			if (!OkToQuery){
-				log.info(&quot;Immunization: Activate query: &quot; + OkToQuery);
-				return null;
-			}
-			
-			//post VXQ
-			long queryStartTime = System.currentTimeMillis();
-			
-			
-			try {
-				queryResponse = HttpUtil.post(url, data,timeout,timeout);
-				queryTime = System.currentTimeMillis()-queryStartTime;
-			} catch (Exception e1) {
-				logError(CHIRP_ERROR 
-						, Util.getStackTrace(e1),
-						url, encounter.getPatientId());
-				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-						, new Date());
-				return null;
-			}
-			
-			// log post timing
-			log.info(&quot;Immunization:  Encounter = &quot; + encounter.getEncounterId() + 
-					&quot; CHIRP response time = &quot; + queryTime);
-			log.info(&quot;Immunization:  CHIRP response text = &quot; + queryResponse);
-			
-			//log errors
-			if (queryResponse == null ){
-				logError( CHIRP_ERROR, &quot;&quot;,  url, encounter.getPatientId());
-				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-						, new Date());
-				return null;
-			}
-			
-			if (queryResponse.isEmpty() || queryResponse.trim().equals(&quot;&quot;)) {
-				logError(CHIRP_RESPONSE_INVALID, &quot;&quot;, url, encounter.getPatientId());
-				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-						, new Date());
-				return null;
-			}
-			
-			//CHIRP does not send QCK MSH segment in proper format!! 
-			//FIRST do a string search for &quot;QCK&quot; to avoid parsing errors,
-			//THEN, if not &quot;QCK&quot;, continue parse the response.
-			
-			//patient not found
-			
-			if (queryResponse.indexOf(&quot;|QCK&quot;) &gt; 0){
-				
-				
-				//save the obs and file
-				Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_IN_CHIRP, new \
                Date());
-				ImmunizationQueryConstructor.saveFile(dir, queryResponse, &quot;qck&quot;, \
                encounter);
-				
-				//create the patient in chirp with VXU if VXU is activated.
-					
-				VXU_V04 vxu = new VXU_V04();
-				ImmunizationQueryConstructor.constructVXU(vxu,encounter); 
-				String vxuString = ImmunizationQueryConstructor.getVXUMessageString(vxu);
-				ImmunizationQueryConstructor.saveFile(dir, vxuString, &quot;vxu&quot;, \
                encounter);
-				data = getData(vxuString);
-				
-				//Only send VXU if VXU update is enabled in global property
-				
-				String activateVXUToCreatePatient = \
                adminService.getGlobalProperty(&quot;chica.activateVXUToCreatePatient&quot;);
                
-				log.info(&quot; Immunization: Create Patient VXU Activated = &quot; + \
                activateVXUToCreatePatient);
-				log.info(&quot; Immunization: Create Patient VXU String = &quot; + vxuString);
-				if (activateVXUToCreatePatient != null &amp;&amp; 
-					(activateVXUToCreatePatient.equalsIgnoreCase(&quot;true&quot;) 
-							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;yes&quot;) 
-							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;T&quot;) 
-							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;Y&quot;))){
-					try {
-						queryResponse = HttpUtil.post(url, data,timeout,timeout);	
-						log.info(&quot;Immunization: Create patient response = &quot; +  \
                queryResponse);
-						if (queryResponse != null &amp;&amp; \
                queryResponse.contains(&quot;accepted&quot;)){
-							Util.saveObs(chicaPatient, statusConcept, encounterId, CREATED, new Date());
-						} else {
-							//Chirp status remains at &quot;not in chirp&quot;
-							logError(CHIRP_UPDATE_FAILED, 
-									 queryResponse, url, encounter.getPatientId());
-						}
-						ImmunizationQueryConstructor.saveFile(dir, queryResponse, \
                &quot;vxu_confirm&quot;, encounter);
-						
-					} catch (IOException e) {
-						logError(CHIRP_ERROR, 
-								Util.getStackTrace(e),
-								url, encounter.getPatientId());
-						Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-								, new Date());	
-						return null;
-					}
-						
-				}				
-				return null;
-			}
-						
-			
-			//Parse to get MSA for error information.
-			//CHIRP  sends invalid characters!  Remove before parsing.
-			String msaControlId = &quot;&quot;;
-			queryResponse = removeIllegalCharacter(queryResponse);
-			Message queryResponseMessage;
-			try {
-				queryResponseMessage = parser.parse(queryResponse);
-				Terser terser = new Terser(queryResponseMessage);
-				msaControlId = terser.get(&quot;/MSA-1-1&quot;);
-				if (msaControlId == null || !msaControlId.equalsIgnoreCase(&quot;AA&quot;) )
-				{
-					logError(CHIRP_ERROR,
-							&quot;HL7 response: &quot; + queryResponse, url, encounter.getPatientId());
-					Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-							, new Date());
-					return null;
-				}
-			} catch (HL7Exception hl7e){
-				logError( CHIRP_PARSING_ERROR, 
-						&quot;HL7 response = &quot; + queryResponse ,
-						null, encounter.getPatientId());
-				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-						, new Date());
-				return null;
-			}
-		
-			//VXX possible match
-			
-			if (queryResponseMessage instanceof VXX_V02) {
-				
-				ImmunizationQueryConstructor.saveFile(dir, queryResponse, &quot;vxx_1&quot;, \
                encounter);
-				
-				//match check
-				
-				Set&lt;Patient&gt; chirpPatients = getChirpPatients(queryResponseMessage);
-				PatientMatching patientMatching = new PatientMatching();
-				Patient matchPatient = patientMatching.verifyPatientMatch(chicaPatient, \
                chirpPatients);
-				if (matchPatient == null){
-					log.info(&quot;Immunization: Patient not matched in CHIRP. Encounter id = \
                &quot; + encounterId);
-					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
                Date());
-					return null;
-				}
-				
-				//Match found..  Save identifier for patient that matches.
-				//Do not save as preferred
-				try {
-					PatientIdentifier identifier = \
                matchPatient.getPatientIdentifier(IMMUNIZATION_REGISTRY);
-					if (identifier != null){
-						identifier.setPreferred(false);
-						chicaPatient.addIdentifier(identifier);
-						patientService.savePatient(chicaPatient);
-					}
-				} catch (Exception e1) {
-					log.error(Util.getStackTrace(e1));
-					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
                Date());
-					return null;
-				}
-				
-				//Construct the 2nd vxq
-				
-				vxqString = constructor.updateVXQ(vxqString, matchPatient);
-				log.info(&quot;Immunization: 2nd Vxq: &quot; +  vxqString);
-				ImmunizationQueryConstructor.saveFile(dir, vxqString, &quot;vxq_2&quot;, \
                encounter);
-					
-				//requery
-				
-				data = getData(vxqString);
-				queryStartTime = System.currentTimeMillis();
-				queryResponse = HttpUtil.post(url, data, timeout, timeout);	
-				
-				log.info(&quot;Immunization: Requery CHIRP response time = &quot; + \
                encounter.getEncounterId()
-						+ &quot;: &quot; + (System.currentTimeMillis()-queryStartTime) + \
                &quot;msec&quot;);
-				
-				if (queryResponse == null || queryResponse.trim().equals(&quot;&quot;)
-						|| !queryResponse.contains(&quot;MSH&quot;)) {
-					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
                Date());
-					return null;
-				}
-				
-				//remove possible illegal character from CHIRP
-				try {
-					queryResponse = removeIllegalCharacter(queryResponse);
-					PipeParser pipeParser = new PipeParser();
-					queryResponseMessage = pipeParser.parse(queryResponse);
-				} catch (HL7Exception e) {
-					logError( CHIRP_PARSING_ERROR, 
-							&quot;HL7 response = &quot; + queryResponse ,
-							null, encounter.getPatientId());
-					Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-							, new Date());
-					return null;
-				}
-				
-				log.info(&quot;Immunization: CHIRP response after requery = &quot; + \
                queryResponse);
-				//VXX 2nd time after requery indicates no confirmed match
-				if (queryResponseMessage instanceof VXX_V02) {
-					ImmunizationQueryConstructor.saveFile(dir, queryResponse, &quot;vxx_2&quot;, 
-								encounter);
-					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
                Date());
-					return null;
-						
-				}
-				
-			}
-			
-			//VXR returned from query or requery. Create immunization list
-			
-			if (queryResponseMessage instanceof VXR_V03) {
-				
-				Set&lt;Patient&gt; chirpPatients = getChirpPatientFromVXR(queryResponseMessage);
-				PatientMatching patientMatching = new PatientMatching();
-				Patient matchPatient = patientMatching.verifyPatientMatch(chicaPatient, \
                chirpPatients);
-				if (matchPatient == null){
-					log.info(&quot;Immunization: VXR Patient is not a match. Encounter id = &quot; \
                + encounterId);
-					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
                Date());
-					return null;
-				}
-				Util.saveObs(chicaPatient, statusConcept, encounterId, MATCHED,
-						new Date());
-				ImmunizationQueryConstructor.saveFile(dir, queryResponse,
-						&quot;vxr&quot;, encounter);
-				createImmunizationList(queryResponse, mrn, encounter
-						.getPatientId());
-				return queryResponse;
-			}
-			
-		}  catch (IOException e) {
-			
-			logError( CHIRP_ERROR, Util.getStackTrace(e),
-					url, encounter.getPatientId());
-			Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
-					, new Date());
-		}
-				
-		return queryResponse;
-	}
-	
-	private static Set&lt;Patient&gt; getChirpPatients(Message message){
-		PatientService patientService = Context.getPatientService();
-		PersonService personService = Context.getPersonService();
-		LocationService locationService = Context.getLocationService();
-	Set&lt;Patient&gt; chirpPatients = new HashSet&lt;Patient&gt;();
-		
-		try {
-			Integer count =  ((VXX_V02) message).getPIDNK1Reps();
-			 for (int i = 0 ; i &lt; count; i++){
-				 
-				 Patient patient = new Patient();
-				 VXX_V02_PIDNK1  pidnk1 = ((VXX_V02) message).getPIDNK1(i);
-				 
-				 if (pidnk1 != null){
-					 XPN[] xpns = pidnk1.getPID().getPatientName();
-					 XPN xpn_alias = pidnk1.getPID().getPatientAlias(0);
-					 for (XPN xpn : xpns){
-						  xpn = pidnk1.getPID().getPatientName(0);
-						 if (xpn != null){
-							 PersonName personName = new PersonName();
-							 String last = xpn.getFamilyLastName().getFamilyName().getValue();
-							 String first = xpn.getGivenName().getValue();
-							 String middle = xpn.getMiddleInitialOrName().getValue();
-							 personName.setFamilyName(last);
-							 personName.setGivenName(first);
-							 personName.setMiddleName(middle);
-							 patient.addName(personName);
-						 }
-						 
-						 CX cx = pidnk1.getPID().getPatientIdentifierList(0);
-						 PatientIdentifier pident = new PatientIdentifier();
-						 if (cx != null){
-							 String id = cx.getID().getValue();
-							PatientIdentifierType type = \
                patientService.getPatientIdentifierTypeByName(IMMUNIZATION_REGISTRY);
-							pident.setIdentifierType(type);
-							 pident.setIdentifier(id);;
-							 pident.setLocation(locationService.getLocation(&quot;Unknown \
                Location&quot;));
-							 patient.addIdentifier(pident);
-						 }
-						 patient.addIdentifier(pident);
-						 
-						XAD xad =  pidnk1.getPID().getPatientAddress(0);
-						PersonAddress address = new PersonAddress();
-						if (xad != null){
-							address.setCityVillage(xad.getCity().getValue());
-							address.setAddress1(xad.getStreetAddress().getValue());
-							address.setPostalCode(xad.getZipOrPostalCode().getValue());
-							patient.addAddress(address);
-						}
-						
-						 
-						 Integer nkReps =  pidnk1.getNK1Reps();
-						 PersonAttributeType patype = \
                personService.getPersonAttributeTypeByName(NEXT_OF_KIN);
-						 for (int j = 0; j &lt; nkReps; j++){
-							 String lastNameString = &quot;&quot;;
-							 String firstNameString = &quot;&quot;;
-							 NK1 nk1 = pidnk1.getNK1(j);
-							 XPN xpname = nk1.getNKName(0);
-							 if (xpname != null){
-								 FN nkfname = xpname.getFamilyLastName();
-								 ST nkfirstName = xpname.getGivenName();
-								 ST lastName = nkfname.getFamilyName();
-								 if (lastName != null){
-									 lastNameString = lastName.getValue();
-								 }
-								if (nkfirstName != null){
-									 firstNameString = nkfirstName.getValue();
-							 	}
-							 }
-							
-							 if (lastNameString != null || firstNameString != null){
-								 String concatNKString = firstNameString + &quot;|&quot; +  lastNameString;
-								 if (!concatNKString.equalsIgnoreCase(&quot;&quot;)) {
-									 PersonAttribute nkpersonAttr = 
-										 new PersonAttribute(patype, concatNKString);
-									 patient.addAttribute(nkpersonAttr);
-								 }
-							 }
-							 
-						 }
-												 
-					 }
-					 //Check the alias name PID-9 (not in the list of names in PID-5)
-					 if (xpn_alias != null){
-						 PersonName personName = new PersonName();
-						 String last = xpn_alias.getFamilyLastName().getFamilyName().getValue();
-						 String first = xpn_alias.getGivenName().getValue();
-						 String middle = xpn_alias.getMiddleInitialOrName().getValue();
-						 personName.setFamilyName(last);
-						 personName.setGivenName(first);
-						 personName.setMiddleName(middle);
-						 patient.addName(personName);
-					 }
-					 
-					 TS dob = pidnk1.getPID().getDateTimeOfBirth();
-					 
-					 if (dob != null &amp;&amp; dob.getTimeOfAnEvent() != null){
-						 String dobString = dob.getTimeOfAnEvent().getValue();    
-						 Date birthDate = new SimpleDateFormat(&quot;yyyyMMdd&quot;, \
                Locale.ENGLISH).parse(dobString);
-						 patient.setBirthdate(birthDate);
-					 }
-				 }
-				 chirpPatients.add(patient);
-			 }
-		} catch (Exception e) {
-			log.error(Util.getStackTrace(e));
-		}
-			
-		return chirpPatients;
-	}
-	
-	private static String removeIllegalCharacter(String queryResponse){
-		
-		if (queryResponse != null) {
-			if (queryResponse.indexOf(&quot;Dose number in series^LN||B&quot;) &gt; 0){
-				log.info(&quot;Immunization: Replaced invalid character in VXR&quot;);
-				queryResponse = queryResponse
-				.replace(&quot;Dose number in series^LN||B&quot;, &quot;Dose number in \
                series^LN||1&quot;);
-			}
-			 
-		}
-		return queryResponse;
-		
-	}
-	
-	private static void logError(String text, String details, String url, Integer \
                patientId){
-		if (details == null){
-			details = &quot;No details&quot;;
-		}
-		if (url == null){
-			url = &quot;No url&quot;;
-		}
-		ChirdlUtilBackportsService chirdlutilbackportsService = \
                Context.getService(ChirdlUtilBackportsService.class);
-		Error error = new Error(&quot;ERROR&quot;, ERROR_CATEGORY, 
-				text , &quot; URL: &quot; + url + &quot; Patient ID: &quot; 
-				+ patientId + &quot;. &quot; + details, new Date(), null);
-		chirdlutilbackportsService.saveError(error);
-		log.error(&quot;Immunization: &quot; + text + &quot;Details:&quot; + details );
-		return;
-	}
-
-	private static Set&lt;Patient&gt; getChirpPatientFromVXR(Message message){
-		//Past errors with CHIRP require that we check the matched patient 
-		// for VXRs also.
-		
-		//VXR only has one PID
-		PatientService patientService = Context.getPatientService();
-		PersonService personService = Context.getPersonService();
-		LocationService locationService = Context.getLocationService();
-		Set&lt;Patient&gt; chirpPatients = new HashSet&lt;Patient&gt;();
-		
-		try {
-			PID pid =  ((VXR_V03) message).getPID();
-			if (pid == null){
-				return null;
-			}
-			Patient patient = new Patient();	 
-			XPN[] xpns = pid.getPatientName();
-			for (XPN xpn : xpns){
-				xpn = pid.getPatientName(0);
-				if (xpn != null){
-					PersonName personName = new PersonName();
-					String last = xpn.getFamilyLastName().getFamilyName().getValue();
-					String first = xpn.getGivenName().getValue();
-					String middle = xpn.getMiddleInitialOrName().getValue();
-					personName.setFamilyName(last);
-					personName.setGivenName(first);
-					personName.setMiddleName(middle);
-					patient.addName(personName);
-				}
-
-				CX cx = pid.getPatientIdentifierList(0);
-				PatientIdentifier pident = new PatientIdentifier();
-				if (cx != null){
-					String id = cx.getID().getValue();
-					PatientIdentifierType type = \
                patientService.getPatientIdentifierTypeByName(IMMUNIZATION_REGISTRY);
-					pident.setIdentifierType(type);
-					pident.setIdentifier(id);;
-					pident.setLocation(locationService.getLocation(&quot;Unknown Location&quot;));
-					patient.addIdentifier(pident);
-				}
-				patient.addIdentifier(pident);
-
-				XAD xad =  pid.getPatientAddress(0);
-				PersonAddress address = new PersonAddress();
-				if (xad != null){
-					address.setCityVillage(xad.getCity().getValue());
-					address.setAddress1(xad.getStreetAddress().getValue());
-					address.setPostalCode(xad.getZipOrPostalCode().getValue());
-					patient.addAddress(address);
-				}
-
-			}
-			
-			TS dob = pid.getDateTimeOfBirth();
-
-			if (dob != null &amp;&amp; dob.getTimeOfAnEvent() != null){
-				String dobString = dob.getTimeOfAnEvent().getValue();    
-				Date birthDate = new SimpleDateFormat(&quot;yyyyMMdd&quot;, \
                Locale.ENGLISH).parse(dobString);
-				patient.setBirthdate(birthDate);
-			}
-
-			chirpPatients.add(patient);
-
-		} catch (Exception e) {
-			log.error(Util.getStackTrace(e));
-		}
-
-		return chirpPatients;
-	}
-	
-}
</del></span></pre></div>
<a id="openmrsmoduleschicatagsRelease1606srcorgopenmrsmodulechicahl7immunizationImmuni \
zationRegistryQueryjavafromrev30900openmrsmoduleschicatrunksrcorgopenmrsmodulechicahl7immunizationImmunizationRegistryQueryjava"></a>
 <div class="copfile"><h4>Copied: openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java \
(from rev 30900, openmrs-modules/chica/trunk/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java) \
(0 => 30901)</h4> <pre class="diff"><span>
<span class="info">--- openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java	  \
                (rev 0)
+++ openmrs-modules/chica/tags/Release \
1.60.6/src/org/openmrs/module/chica/hl7/immunization/ImmunizationRegistryQuery.java	2014-09-10 \
03:48:58 UTC (rev 30901) </span><span class="lines">@@ -0,0 +1,937 @@
</span><ins>+package org.openmrs.module.chica.hl7.immunization;
+
+/**
+ * 
+ */
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Hibernate;
+import org.openmrs.Concept;
+import org.openmrs.ConceptMap;
+import org.openmrs.Encounter;
+import org.openmrs.Patient;
+import org.openmrs.PatientIdentifier;
+import org.openmrs.PatientIdentifierType;
+import org.openmrs.PersonAddress;
+import org.openmrs.PersonAttribute;
+import org.openmrs.PersonAttributeType;
+import org.openmrs.PersonName;
+import org.openmrs.api.AdministrationService;
+import org.openmrs.api.ConceptService;
+import org.openmrs.api.LocationService;
+import org.openmrs.api.PatientService;
+import org.openmrs.api.PersonService;
+import org.openmrs.api.context.Context;
+import org.openmrs.module.chica.ImmunizationForecast;
+import org.openmrs.module.chica.ImmunizationForecastLookup;
+import org.openmrs.module.chica.ImmunizationPrevious;
+import org.openmrs.module.chica.ImmunizationQueryOutput;
+import org.openmrs.module.chica.service.ChicaService;
+import org.openmrs.module.chirdlutil.util.HttpUtil;
+import org.openmrs.module.chirdlutil.util.Util;
+import org.openmrs.module.chirdlutilbackports.hibernateBeans.Error;
+import org.openmrs.module.chirdlutilbackports.service.ChirdlUtilBackportsService;
+
+import ca.uhn.hl7v2.HL7Exception;
+import ca.uhn.hl7v2.model.Message;
+import ca.uhn.hl7v2.model.Type;
+import ca.uhn.hl7v2.model.v231.datatype.CE;
+import ca.uhn.hl7v2.model.v231.datatype.CX;
+import ca.uhn.hl7v2.model.v231.datatype.FN;
+import ca.uhn.hl7v2.model.v231.datatype.NM;
+import ca.uhn.hl7v2.model.v231.datatype.ST;
+import ca.uhn.hl7v2.model.v231.datatype.TS;
+import ca.uhn.hl7v2.model.v231.datatype.XAD;
+import ca.uhn.hl7v2.model.v231.datatype.XPN;
+import ca.uhn.hl7v2.model.v231.group.VXX_V02_PIDNK1;
+import ca.uhn.hl7v2.model.v231.message.VXQ_V01;
+import ca.uhn.hl7v2.model.v231.message.VXR_V03;
+import ca.uhn.hl7v2.model.v231.message.VXU_V04;
+import ca.uhn.hl7v2.model.v231.message.VXX_V02;
+import ca.uhn.hl7v2.model.v231.segment.NK1;
+import ca.uhn.hl7v2.model.v231.segment.OBX;
+import ca.uhn.hl7v2.model.v231.segment.PID;
+import ca.uhn.hl7v2.model.v231.segment.RXA;
+import ca.uhn.hl7v2.parser.PipeParser;
+import ca.uhn.hl7v2.util.Terser;
+import ca.uhn.hl7v2.validation.impl.NoValidation;
+
+/**
+ * @author tmdugan
+ * 
+ */
+public class ImmunizationRegistryQuery
+{
+	private static Log log = LogFactory.getLog(ImmunizationRegistryQuery.class);
+
+	private static org.openmrs.Encounter encounter = null;
+	private static String CHIRP_NOT_AVAILABLE = &quot;CHIRP_not_available&quot;;
+	private static String NOT_IN_CHIRP = &quot;not_in_chirp_registry&quot;;
+	private static String NOT_MATCHED = &quot;CHIRP_match_not_found&quot;;
+	private static String NEXT_OF_KIN = &quot;Next of Kin&quot;;
+	private static String IMMUNIZATION_REGISTRY = &quot;Immunization Registry&quot;;
+	private static String MATCHED = &quot;CHIRP_match_found&quot;;
+	private static String CREATED = &quot;CHIRP_patient_created&quot;;
+	private static  String SOURCE = &quot;CVX&quot;;
+	private static String GENERIC = &quot;CVX unspecified&quot;;
+	private static String ERROR_CATEGORY = &quot;Query Immunization List \
Connection&quot;; +	private static String LOINC_DOSE_NUMBER_CODE = \
&quot;30973-2&quot;; +	private static String LOINC_EARLIEST_TIME_TO_GIVE = \
&quot;30981-5&quot;; +	private static String LOINC_DATE_VACCINE_DUE = \
&quot;30980-7&quot;; +	private static String LOINC_VACCINE_TYPE = \
&quot;30956-7&quot;; +	private static String CHIRP_ERROR = &quot;CHIRP is not \
accessible.&quot;; +	private static String CHIRP_PARSING_ERROR = &quot;CHIRP HL7 \
parsing error.&quot;; +	private static String CHIRP_UPDATE_FAILED = &quot;CHIRP is \
accessible, but the immunization update failed.&quot;; +	private static String \
CHIRP_RESPONSE_INVALID = &quot;CHIRP response was empty or invalid&quot;; +	
+	/**
+	 * 
+	 * Auto generated method comment
+	 * 
+	 * @param messageString
+	 * @param mrn
+	 * @param patientId
+	 */
+	private static void createImmunizationList(String messageString, String mrn,
+			Integer patientId) {
+
+		if (messageString == null) {
+			log.info(&quot;immunization list is null for mrn: &quot; + mrn
+					+ &quot; so immunization list could not be created&quot;);
+			return;
+		}
+
+		try {
+
+			messageString = messageString.trim();
+
+			if (messageString.length() == 0) {
+				return;
+			}
+			String newMessageString = messageString;
+			PipeParser pipeParser = new PipeParser();
+			pipeParser.setValidationContext(new NoValidation());
+			Message message = null;
+			try {
+				message = pipeParser.parse(newMessageString);
+			} catch (Exception e) {
+				
+				logError( CHIRP_PARSING_ERROR, 
+						&quot;HL7 response = &quot; + messageString ,
+						null, patientId);
+				return;
+			}
+			parseImmunizations(message, patientId);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static void parseImmunizations(Message message, Integer patientId)
+			throws Exception {
+		
+		ConceptService conceptService = Context.getConceptService();
+		ChicaService chicaService = \
Context.getService(org.openmrs.module.chica.service.ChicaService.class);	 \
+		ImmunizationForecastLookup.removeImmunizationList(patientId); +		
+		if (message instanceof VXR_V03) {
+			VXR_V03 vxr = (VXR_V03) message;
+			int numReps = vxr.getORCRXARXROBXNTEReps();
+			for (int i = 0; i &lt; numReps; i++) {
+				HashMap&lt;String, ImmunizationPrevious&gt; prevImmunizationList = new \
HashMap&lt;String, ImmunizationPrevious&gt;(); +				HashMap&lt;String, \
ImmunizationForecast&gt; forecastedImmunizationList = new HashMap&lt;String, \
ImmunizationForecast&gt;(); +			
+				RXA rxa = vxr.getORCRXARXROBXNTE(i).getRXA();
+				
+				String vaccineCode = null;
+				String vaccineName = null;
+				String vaccineDate = null;
+				NM doseNM = null;
+				
+				
+				ImmunizationPrevious previousImmunization = null;
+				ImmunizationForecast forecastedImmunization = null;
+
+				// previously given vaccines
+				if (rxa != null) {
+					vaccineCode = rxa.getAdministeredCode().getIdentifier()
+							.getValue();
+					vaccineName = rxa.getAdministeredCode().getText()
+							.getValue();
+					doseNM = rxa.getAdministrationSubIDCounter();
+					
+					
+					//2013-05-08 - Format for forecasted messaegs no longer has 
+					// 0 for the dose number.  Now that same field has 999 just like the 
+					//vaccine history.  The forecasting messages now have 
+					//vaccine code = 998 and name = &quot;no vaccine administered&quot;.
+					if (vaccineCode != null &amp;&amp; \
!vaccineCode.equalsIgnoreCase(&quot;998&quot;)){ +						// This is a previous \
immunization	 +						Integer doseNumber = Integer.valueOf(doseNM.getValue());
+						vaccineDate = rxa.getDateTimeEndOfAdministration()
+						.getTimeOfAnEvent().getValue();
+						
+						System.out.println(&quot;history: &quot; + vaccineCode + &quot; &quot; 
+								+ vaccineName + &quot; &quot; 
+								+ doseNM.getValue() + &quot; &quot; 
+								+ vaccineDate);
+					
+					  	// Use Concept maps vaccine category
+						// Combination vaccines will map to multiple codes
+						Concept cvxVaccineConcept = conceptService.getConceptByMapping(vaccineCode, \
SOURCE ); +						if (cvxVaccineConcept == null ){
+							log.info(&quot;Immunization: CVX vaccine code &quot; + vaccineCode + &quot; \
(&quot; + vaccineName + &quot;) &quot; + &quot;not mapped to a concept&quot; ); \
+							continue; +						}
+						
+						//Get all general (unspecified) mapped vaccine concepts for each RXA vaccine \
code. +						List&lt;ConceptMap&gt; conceptMaps = \
chicaService.getConceptMapsByVaccine(cvxVaccineConcept, GENERIC); +						if \
(conceptMaps == null || conceptMaps.size() == 0){ +							continue;
+						}
+						
+						for (ConceptMap conceptMap: conceptMaps){
+							String unspecifiedVaccineCode = conceptMap.getSourceCode();
+							String unspecifiedVaccineName = &quot;&quot;;
+							Concept unspecifiedVaccineConcept = \
conceptService.getConceptByMapping(unspecifiedVaccineCode, SOURCE ); +							if \
(unspecifiedVaccineConcept != null &amp;&amp; unspecifiedVaccineConcept.getName() != \
null){ +								unspecifiedVaccineName = \
unspecifiedVaccineConcept.getName().getName();	 +							}
+							if (vaccineCode != null) {
+								previousImmunization = new ImmunizationPrevious();
+	
+								previousImmunization.setVaccineName(unspecifiedVaccineName);
+								previousImmunization
+										.setVaccineCode(unspecifiedVaccineCode);
+								previousImmunization.setPatientId(patientId);
+								previousImmunization.setDate(vaccineDate);
+								previousImmunization.setDose(doseNumber);
+								prevImmunizationList.put(unspecifiedVaccineCode,
+										previousImmunization);
+							}
+						} 
+						
+						// add the previous immunizations
+						for (ImmunizationPrevious prevImmunization : prevImmunizationList
+								.values()) {
+
+							Integer immundDoseNumber = prevImmunization.getDose();
+
+							if (immundDoseNumber != null &amp;&amp; immundDoseNumber &gt; 0) {
+								ImmunizationQueryOutput immuneOutput = ImmunizationForecastLookup
+										.getImmunizationList(patientId);
+
+								if (immuneOutput == null) {
+									immuneOutput = new ImmunizationQueryOutput();
+									ImmunizationForecastLookup.addImmunizationList(
+											patientId, immuneOutput);
+								}
+
+								immuneOutput.addImmunizationPrevious(prevImmunization);
+							}
+						}
+						
+					}
+					else {
+					
+						// get the rxa information for forecasting
+							// 2013-05-08 - CHIRP changed - vaccine code and vaccine code are useless.
+							// Get the vaccine name from a value in an OBX.
+							// Now we need to through forecast OBX information for forecasting 
+						forecastedImmunization = new ImmunizationForecast();
+						
+						int numObs = vxr.getORCRXARXROBXNTE(i).getOBXNTEReps();
+						for (int j = 0; j &lt; numObs; j++) {
+							OBX obx = vxr.getORCRXARXROBXNTE(i).getOBXNTE(j).getOBX();
+							if (obx == null){
+								continue;
+							}
+							String obxCode = obx.getObservationIdentifier()
+								.getIdentifier().getValue();
+							if (obxCode == null) {
+								continue;
+							}
+							Type obxValue = obx.getObservationValue(0).getData();
+							if (obxValue == null){
+								continue;
+							}
+							String obsValueType = obxValue.getName();
+							
+						
+							// this code indicates the type of vaccine
+							if (obxCode.equals(LOINC_VACCINE_TYPE)) {
+								if (obsValueType.equals(&quot;CE&quot;)) {
+									CE data = (CE) obxValue;
+									if (data == null || data.getIdentifier() == null
+											||data.getText() == null){
+										//Must have a vaccine type
+										continue;
+									}
+									
+									//Note: newer hl7 has a junky vaccine name
+									String obxVaccineName = data.getText()
+										.getValue();
+									if (obxVaccineName != null &amp;&amp; forecastedImmunization != null) {
+										forecastedImmunization
+											.setVaccineName(obxVaccineName);
+									}	
+									
+									String obxVaccineCode = data.getIdentifier()
+										.getValue();
+									if (obxVaccineCode != null &amp;&amp; forecastedImmunization != null) {
+										forecastedImmunization
+											.setVaccineCode(obxVaccineCode);
+									}	
+								}
+							}
+							// this code indicates the due date of the next
+							// vaccination
+							if (obxCode.equals(LOINC_DATE_VACCINE_DUE)) {
+								if (obsValueType.equals(&quot;TS&quot;)) {
+									TS data = (TS) obxValue;
+									String dateString = data.getTimeOfAnEvent()
+										.getValue();
+									if (dateString != null &amp;&amp; forecastedImmunization != null) {
+										forecastedImmunization
+											.setDateDue(dateString);
+									}	
+								}
+							}
+	
+						// this code indicates the dose of the next vaccination
+						//if (obxCode.equals(&quot;30979-9&amp;30973-2&quot;)) {
+							if (obxCode.equals(LOINC_DOSE_NUMBER_CODE)) {
+								if (obsValueType.equals(&quot;NM&quot;)) {
+									NM data = (NM) obxValue;
+									String dataString = data.getValue();
+									if (dataString != null &amp;&amp; forecastedImmunization != null) {
+										forecastedImmunization.setDose(Integer
+											.parseInt(dataString));
+									}
+								}
+							}
+	
+							// this code indicates the earliest date of the next
+							// vaccination
+							//if (obxCode.equals(&quot;30979-9&amp;30981-5&quot;)) {
+							if (obxCode.equals(LOINC_EARLIEST_TIME_TO_GIVE)) {
+								if (obsValueType.equals(&quot;TS&quot;)) {
+									TS data = (TS) obxValue;
+									String dateString = data.getTimeOfAnEvent()
+											.getValue();
+									if (dateString != null &amp;&amp; forecastedImmunization != null ) {
+										forecastedImmunization
+												.setEarliestDate(dateString);
+									}
+								}
+							}
+							
+							
+						}
+						
+						//Create the forecasted list 
+						
+						String forecastVaccineCode = forecastedImmunization.getVaccineCode();
+						//get the concept for hl7 CVX vaccine code
+						Concept vaccineConcept = \
conceptService.getConceptByMapping(forecastVaccineCode, SOURCE ); +						if \
(vaccineConcept == null){ +							log.error(&quot;ImmunizationForecast: CVX vaccine \
code not mapped to a concept : &quot; + forecastVaccineCode + &quot; (&quot;  + \
forecastedImmunization.getVaccineName() ); +							continue;
+						}
+						
+						//Find the mapped codes for the concept
+						List&lt;ConceptMap&gt; conceptMaps = \
chicaService.getConceptMapsByVaccine(vaccineConcept, GENERIC);  +						if \
(conceptMaps == null || conceptMaps.size() == 0){ \
+							log.info(&quot;ImmunizationForecast: No unspecified CVX code exists for \
concept: &quot;  +									+ vaccineConcept.getName().getName() + &quot;,  CVX: \
&quot; + forecastVaccineCode); +						}
+						
+						//Get the unspecified name and cvx code to add to forecasting list
+						for (ConceptMap conceptMap : conceptMaps) {
+							
+							String unspecfiedCode = conceptMap.getSourceCode();
+							if (unspecfiedCode == null || \
unspecfiedCode.trim().equalsIgnoreCase(&quot;&quot;) ){ \
+								log.info(&quot;ImmunizationForecast: Concept map exists, but no source_code \
defined.  Concept id: &quot;  +										+ conceptMap.getConcept().getConceptId());
+								continue;
+							}
+							Concept unspecifiedConcept = \
conceptService.getConceptByMapping(unspecfiedCode, SOURCE ); +							if \
(unspecifiedConcept == null || unspecifiedConcept.getName() == null ){ \
+								log.info(&quot;ImmunizationForecast: There is no concept for CVX code: \
&quot; +										+ unspecfiedCode);
+								continue;
+							}
+							
+							String unspecifiedVaccineName = unspecifiedConcept.getName().getName();
+
+							forecastedImmunization.setVaccineName(unspecifiedVaccineName);
+							forecastedImmunization
+									.setVaccineCode(unspecfiedCode);
+							forecastedImmunization.setPatientId(patientId);
+							forecastedImmunizationList.put(unspecfiedCode,
+									forecastedImmunization);
+							
+						}
+												
+						//loop through forecast immunization obx
+						// added the forecasted immunizations
+						for (ImmunizationForecast foreImmunization : forecastedImmunizationList
+								.values()) {
+	
+							Integer doseNumber = foreImmunization.getDose();
+	
+							if (doseNumber != null &amp;&amp; doseNumber &gt; 0) {
+								ImmunizationQueryOutput immuneOutput = ImmunizationForecastLookup
+										.getImmunizationList(patientId);
+	
+								if (immuneOutput == null) {
+									immuneOutput = new ImmunizationQueryOutput();
+									ImmunizationForecastLookup.addImmunizationList(
+											patientId, immuneOutput);
+								}
+	
+								immuneOutput.addImmunizationForecast(foreImmunization);
+							}
+						}
+					}// end of forecast parsing
+				}// rxa exists
+			}//end of loop through all rxa's
+		}// is VXR
+	}
+	
+	private static String getData(String message){
+		String data = &quot;&quot;;
+		try {
+			AdministrationService adminService = Context.getAdministrationService();
+			String userId = adminService
+			.getGlobalProperty(&quot;chica.ImmunizationQueryUserId&quot;);
+			String password = adminService
+			.getGlobalProperty(&quot;chica.ImmunizationQueryPassword&quot;);
+
+			data = URLEncoder.encode(&quot;USERID&quot;, &quot;UTF-8&quot;) + &quot;=&quot;
+			+ URLEncoder.encode(userId, &quot;UTF-8&quot;);
+			data += &quot;&amp;&quot; + URLEncoder.encode(&quot;PASSWORD&quot;, \
&quot;UTF-8&quot;) + &quot;=&quot; +			+ URLEncoder.encode(password, \
&quot;UTF-8&quot;); +			
+			if (message != null &amp;&amp; message.contains(&quot;VXU&quot;)){
+				data += &quot;&amp;&quot; + URLEncoder.encode(&quot;debug&quot;, \
&quot;UTF-8&quot;) + &quot;=&quot; +				+ URLEncoder.encode(&quot;debug&quot;, \
&quot;UTF-8&quot;); +				data += &quot;&amp;&quot; + \
URLEncoder.encode(&quot;deduplication&quot;, &quot;UTF-8&quot;) + &quot;=&quot; \
+				+ URLEncoder.encode(&quot;deduplication&quot;, &quot;UTF-8&quot;); +			}
+			data += &quot;&amp;&quot; + URLEncoder.encode(&quot;MESSAGEDATA&quot;, \
&quot;UTF-8&quot;) + &quot;=&quot; +			+ URLEncoder.encode(message, \
&quot;UTF-8&quot;); +		} catch (Exception e) {
+			e.printStackTrace();
+		} 
+		return data;		
+		
+	}
+	
+	public static String queryCHIRP( Encounter encounter){
+		
+		AdministrationService adminService = Context.getAdministrationService();
+		ConceptService conceptService = Context.getConceptService();
+		PatientService patientService = Context.getPatientService();
+		String dir = adminService.getGlobalProperty(&quot;chica.ImmunizationOutputDirectory&quot;);
 +		String url = adminService.getGlobalProperty(&quot;chica.ImmunizationQueryURL&quot;);
 +		Integer timeout = \
Integer.parseInt(adminService.getGlobalProperty(&quot;chica.immunizationListTimeout&quot;));
 +		String activateQuery = \
adminService.getGlobalProperty(&quot;chica.ImmunizationQueryActivated&quot;); \
+		boolean OkToQuery = false; +		if (activateQuery != null &amp;&amp;
+				 (activateQuery.equalsIgnoreCase(&quot;true&quot;) 
+						|| activateQuery.equalsIgnoreCase(&quot;yes&quot;) 
+						|| activateQuery.equalsIgnoreCase(&quot;T&quot;) 
+						|| activateQuery.equalsIgnoreCase(&quot;Y&quot;))){
+			OkToQuery = true;
+
+		}
+		
+		Concept statusConcept = conceptService.getConceptByName(&quot;CHIRP_Status&quot;);
+		timeout = timeout*1000;
+		String queryResponse = null;
+		long queryTime = 0;
+		Integer encounterId = encounter.getEncounterId();;
+		Patient chicaPatient = encounter.getPatient();
+		PipeParser parser = new PipeParser();
+		
+		try {
+			
+			// Get identifier
+			chicaPatient = patientService.getPatient(chicaPatient.getPatientId());
+			Hibernate.initialize(chicaPatient);
+			String mrn = chicaPatient.getPatientIdentifier().getIdentifier();
+			
+			//construct vxq
+		
+			ImmunizationQueryConstructor constructor = new ImmunizationQueryConstructor();
+			VXQ_V01 vxq = new VXQ_V01();
+			String vxqString = ImmunizationQueryConstructor.constructVXQ(vxq, encounter);
+			if (vxqString == null || vxqString.trim().equals(&quot;&quot;)){
+				log.error(&quot;Immunization: VXQ string for &quot; + mrn + &quot; is null or \
empty.&quot;); +				return null;
+			}
+			
+			ImmunizationQueryConstructor.saveFile(dir, vxqString, &quot;vxq_1&quot;, \
encounter); +			String data = getData(vxqString);
+			log.info(&quot;Immunization: vxq = &quot; +  vxqString);
+			if (!OkToQuery){
+				log.info(&quot;Immunization: Activate query: &quot; + OkToQuery);
+				return null;
+			}
+			
+			//post VXQ
+			long queryStartTime = System.currentTimeMillis();
+			
+			
+			try {
+				queryResponse = HttpUtil.post(url, data,timeout,timeout);
+				queryTime = System.currentTimeMillis()-queryStartTime;
+			} catch (Exception e1) {
+				logError(CHIRP_ERROR 
+						, Util.getStackTrace(e1),
+						url, encounter.getPatientId());
+				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+						, new Date());
+				return null;
+			}
+			
+			// log post timing
+			log.info(&quot;Immunization:  Encounter = &quot; + encounter.getEncounterId() + 
+					&quot; CHIRP response time = &quot; + queryTime);
+			log.info(&quot;Immunization:  CHIRP response text = &quot; + queryResponse);
+			
+			//log errors
+			if (queryResponse == null ){
+				logError( CHIRP_ERROR, &quot;&quot;,  url, encounter.getPatientId());
+				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+						, new Date());
+				return null;
+			}
+			
+			if (queryResponse.isEmpty() || queryResponse.trim().equals(&quot;&quot;)) {
+				logError(CHIRP_RESPONSE_INVALID, &quot;&quot;, url, encounter.getPatientId());
+				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+						, new Date());
+				return null;
+			}
+			
+			//CHIRP does not send QCK MSH segment in proper format!! 
+			//FIRST do a string search for &quot;QCK&quot; to avoid parsing errors,
+			//THEN, if not &quot;QCK&quot;, continue parse the response.
+			
+			//patient not found
+			
+			if (queryResponse.indexOf(&quot;|QCK&quot;) &gt; 0){
+				
+				
+				//save the obs and file
+				Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_IN_CHIRP, new \
Date()); +				ImmunizationQueryConstructor.saveFile(dir, queryResponse, \
&quot;qck&quot;, encounter); +				
+				//create the patient in chirp with VXU if VXU is activated.
+					
+				VXU_V04 vxu = new VXU_V04();
+				ImmunizationQueryConstructor.constructVXU(vxu,encounter); 
+				String vxuString = ImmunizationQueryConstructor.getVXUMessageString(vxu);
+				ImmunizationQueryConstructor.saveFile(dir, vxuString, &quot;vxu&quot;, \
encounter); +				data = getData(vxuString);
+				
+				//Only send VXU if VXU update is enabled in global property
+				
+				String activateVXUToCreatePatient = \
adminService.getGlobalProperty(&quot;chica.activateVXUToCreatePatient&quot;); \
+				log.info(&quot; Immunization: Create Patient VXU Activated = &quot; + \
activateVXUToCreatePatient); +				log.info(&quot; Immunization: Create Patient VXU \
String = &quot; + vxuString); +				if (activateVXUToCreatePatient != null &amp;&amp; 
+					(activateVXUToCreatePatient.equalsIgnoreCase(&quot;true&quot;) 
+							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;yes&quot;) 
+							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;T&quot;) 
+							|| activateVXUToCreatePatient.equalsIgnoreCase(&quot;Y&quot;))){
+					try {
+						queryResponse = HttpUtil.post(url, data,timeout,timeout);	
+						log.info(&quot;Immunization: Create patient response = &quot; +  \
queryResponse); +						if (queryResponse != null &amp;&amp; \
queryResponse.contains(&quot;accepted&quot;)){ +							Util.saveObs(chicaPatient, \
statusConcept, encounterId, CREATED, new Date()); +						} else {
+							//Chirp status remains at &quot;not in chirp&quot;
+							logError(CHIRP_UPDATE_FAILED, 
+									 queryResponse, url, encounter.getPatientId());
+						}
+						ImmunizationQueryConstructor.saveFile(dir, queryResponse, \
&quot;vxu_confirm&quot;, encounter); +						
+					} catch (IOException e) {
+						logError(CHIRP_ERROR, 
+								Util.getStackTrace(e),
+								url, encounter.getPatientId());
+						Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+								, new Date());	
+						return null;
+					}
+						
+				}				
+				return null;
+			}
+						
+			
+			//Parse to get MSA for error information.
+			//CHIRP  sends invalid characters!  Remove before parsing.
+			String msaControlId = &quot;&quot;;
+			queryResponse = removeIllegalCharacter(queryResponse);
+			Message queryResponseMessage;
+			try {
+				parser.setValidationContext(new NoValidation());
+				queryResponseMessage = parser.parse(queryResponse);
+				Terser terser = new Terser(queryResponseMessage);
+				msaControlId = terser.get(&quot;/MSA-1-1&quot;);
+				if (msaControlId == null || !msaControlId.equalsIgnoreCase(&quot;AA&quot;) )
+				{
+					logError(CHIRP_ERROR,
+							&quot;HL7 response: &quot; + queryResponse, url, encounter.getPatientId());
+					Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+							, new Date());
+					return null;
+				}
+			} catch (HL7Exception hl7e){
+				logError( CHIRP_PARSING_ERROR, 
+						&quot;HL7 response = &quot; + queryResponse ,
+						null, encounter.getPatientId());
+				Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+						, new Date());
+				return null;
+			}
+		
+			//VXX possible match
+			
+			if (queryResponseMessage instanceof VXX_V02) {
+				
+				ImmunizationQueryConstructor.saveFile(dir, queryResponse, &quot;vxx_1&quot;, \
encounter); +				
+				//match check
+				
+				Set&lt;Patient&gt; chirpPatients = getChirpPatients(queryResponseMessage);
+				PatientMatching patientMatching = new PatientMatching();
+				Patient matchPatient = patientMatching.verifyPatientMatch(chicaPatient, \
chirpPatients); +				if (matchPatient == null){
+					log.info(&quot;Immunization: Patient not matched in CHIRP. Encounter id = \
&quot; + encounterId); +					Util.saveObs(chicaPatient, statusConcept, encounterId, \
NOT_MATCHED, new Date()); +					return null;
+				}
+				
+				//Match found..  Save identifier for patient that matches.
+				//Do not save as preferred
+				try {
+					PatientIdentifier identifier = \
matchPatient.getPatientIdentifier(IMMUNIZATION_REGISTRY); +					if (identifier != \
null){ +						identifier.setPreferred(false);
+						chicaPatient.addIdentifier(identifier);
+						patientService.savePatient(chicaPatient);
+					}
+				} catch (Exception e1) {
+					log.error(Util.getStackTrace(e1));
+					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
Date()); +					return null;
+				}
+				
+				//Construct the 2nd vxq
+				
+				vxqString = constructor.updateVXQ(vxqString, matchPatient);
+				log.info(&quot;Immunization: 2nd Vxq: &quot; +  vxqString);
+				ImmunizationQueryConstructor.saveFile(dir, vxqString, &quot;vxq_2&quot;, \
encounter); +					
+				//requery
+				
+				data = getData(vxqString);
+				queryStartTime = System.currentTimeMillis();
+				queryResponse = HttpUtil.post(url, data, timeout, timeout);	
+				
+				log.info(&quot;Immunization: Requery CHIRP response time = &quot; + \
encounter.getEncounterId() +						+ &quot;: &quot; + \
(System.currentTimeMillis()-queryStartTime) + &quot;msec&quot;); +				
+				if (queryResponse == null || queryResponse.trim().equals(&quot;&quot;)
+						|| !queryResponse.contains(&quot;MSH&quot;)) {
+					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
Date()); +					return null;
+				}
+				
+				//remove possible illegal character from CHIRP
+				try {
+					queryResponse = removeIllegalCharacter(queryResponse);
+					PipeParser pipeParser = new PipeParser();
+					pipeParser.setValidationContext(new NoValidation());
+					queryResponseMessage = pipeParser.parse(queryResponse);
+				} catch (HL7Exception e) {
+					logError( CHIRP_PARSING_ERROR, 
+							&quot;HL7 response = &quot; + queryResponse ,
+							null, encounter.getPatientId());
+					Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+							, new Date());
+					return null;
+				}
+				
+				log.info(&quot;Immunization: CHIRP response after requery = &quot; + \
queryResponse); +				//VXX 2nd time after requery indicates no confirmed match
+				if (queryResponseMessage instanceof VXX_V02) {
+					ImmunizationQueryConstructor.saveFile(dir, queryResponse, &quot;vxx_2&quot;, 
+								encounter);
+					Util.saveObs(chicaPatient, statusConcept, encounterId, NOT_MATCHED, new \
Date()); +					return null;
+						
+				}
+				
+			}
+			
+			//VXR returned from query or requery. Create immunization list
+			
+			if (queryResponseMessage instanceof VXR_V03) {
+				
+				Set&lt;Patient&gt; chirpPatients = getChirpPatientFromVXR(queryResponseMessage);
+				PatientMatching patientMatching = new PatientMatching();
+				Patient matchPatient = patientMatching.verifyPatientMatch(chicaPatient, \
chirpPatients); +				if (matchPatient == null){
+					log.info(&quot;Immunization: VXR Patient is not a match. Encounter id = &quot; \
+ encounterId); +					Util.saveObs(chicaPatient, statusConcept, encounterId, \
NOT_MATCHED, new Date()); +					return null;
+				}
+				Util.saveObs(chicaPatient, statusConcept, encounterId, MATCHED,
+						new Date());
+				ImmunizationQueryConstructor.saveFile(dir, queryResponse,
+						&quot;vxr&quot;, encounter);
+				createImmunizationList(queryResponse, mrn, encounter
+						.getPatientId());
+				return queryResponse;
+			}
+			
+		}  catch (IOException e) {
+			
+			logError( CHIRP_ERROR, Util.getStackTrace(e),
+					url, encounter.getPatientId());
+			Util.saveObs(chicaPatient, statusConcept, encounterId, CHIRP_NOT_AVAILABLE
+					, new Date());
+		}
+				
+		return queryResponse;
+	}
+	
+	private static Set&lt;Patient&gt; getChirpPatients(Message message){
+		PatientService patientService = Context.getPatientService();
+		PersonService personService = Context.getPersonService();
+		LocationService locationService = Context.getLocationService();
+	Set&lt;Patient&gt; chirpPatients = new HashSet&lt;Patient&gt;();
+		
+		try {
+			Integer count =  ((VXX_V02) message).getPIDNK1Reps();
+			 for (int i = 0 ; i &lt; count; i++){
+				 
+				 Patient patient = new Patient();
+				 VXX_V02_PIDNK1  pidnk1 = ((VXX_V02) message).getPIDNK1(i);
+				 
+				 if (pidnk1 != null){
+					 XPN[] xpns = pidnk1.getPID().getPatientName();
+					 XPN xpn_alias = pidnk1.getPID().getPatientAlias(0);
+					 for (XPN xpn : xpns){
+						  xpn = pidnk1.getPID().getPatientName(0);
+						 if (xpn != null){
+							 PersonName personName = new PersonName();
+							 String last = xpn.getFamilyLastName().getFamilyName().getValue();
+							 String first = xpn.getGivenName().getValue();
+							 String middle = xpn.getMiddleInitialOrName().getValue();
+							 personName.setFamilyName(last);
+							 personName.setGivenName(first);
+							 personName.setMiddleName(middle);
+							 patient.addName(personName);
+						 }
+						 
+						 CX cx = pidnk1.getPID().getPatientIdentifierList(0);
+						 PatientIdentifier pident = new PatientIdentifier();
+						 if (cx != null){
+							 String id = cx.getID().getValue();
+							PatientIdentifierType type = \
patientService.getPatientIdentifierTypeByName(IMMUNIZATION_REGISTRY); \
+							pident.setIdentifierType(type); +							 pident.setIdentifier(id);;
+							 pident.setLocation(locationService.getLocation(&quot;Unknown \
Location&quot;)); +							 patient.addIdentifier(pident);
+						 }
+						 patient.addIdentifier(pident);
+						 
+						XAD xad =  pidnk1.getPID().getPatientAddress(0);
+						PersonAddress address = new PersonAddress();
+						if (xad != null){
+							address.setCityVillage(xad.getCity().getValue());
+							address.setAddress1(xad.getStreetAddress().getValue());
+							address.setPostalCode(xad.getZipOrPostalCode().getValue());
+							patient.addAddress(address);
+						}
+						
+						 
+						 Integer nkReps =  pidnk1.getNK1Reps();
+						 PersonAttributeType patype = \
personService.getPersonAttributeTypeByName(NEXT_OF_KIN); +						 for (int j = 0; j \
&lt; nkReps; j++){ +							 String lastNameString = &quot;&quot;;
+							 String firstNameString = &quot;&quot;;
+							 NK1 nk1 = pidnk1.getNK1(j);
+							 XPN xpname = nk1.getNKName(0);
+							 if (xpname != null){
+								 FN nkfname = xpname.getFamilyLastName();
+								 ST nkfirstName = xpname.getGivenName();
+								 ST lastName = nkfname.getFamilyName();
+								 if (lastName != null){
+									 lastNameString = lastName.getValue();
+								 }
+								if (nkfirstName != null){
+									 firstNameString = nkfirstName.getValue();
+							 	}
+							 }
+							
+							 if (lastNameString != null || firstNameString != null){
+								 String concatNKString = firstNameString + &quot;|&quot; +  lastNameString;
+								 if (!concatNKString.equalsIgnoreCase(&quot;&quot;)) {
+									 PersonAttribute nkpersonAttr = 
+										 new PersonAttribute(patype, concatNKString);
+									 patient.addAttribute(nkpersonAttr);
+								 }
+							 }
+							 
+						 }
+												 
+					 }
+					 //Check the alias name PID-9 (not in the list of names in PID-5)
+					 if (xpn_alias != null){
+						 PersonName personName = new PersonName();
+						 String last = xpn_alias.getFamilyLastName().getFamilyName().getValue();
+						 String first = xpn_alias.getGivenName().getValue();
+						 String middle = xpn_alias.getMiddleInitialOrName().getValue();
+						 personName.setFamilyName(last);
+						 personName.setGivenName(first);
+						 personName.setMiddleName(middle);
+						 patient.addName(personName);
+					 }
+					 
+					 TS dob = pidnk1.getPID().getDateTimeOfBirth();
+					 
+					 if (dob != null &amp;&amp; dob.getTimeOfAnEvent() != null){
+						 String dobString = dob.getTimeOfAnEvent().getValue();    
+						 Date birthDate = new SimpleDateFormat(&quot;yyyyMMdd&quot;, \
Locale.ENGLISH).parse(dobString); +						 patient.setBirthdate(birthDate);
+					 }
+				 }
+				 chirpPatients.add(patient);
+			 }
+		} catch (Exception e) {
+			log.error(Util.getStackTrace(e));
+		}
+			
+		return chirpPatients;
+	}
+	
+	private static String removeIllegalCharacter(String queryResponse){
+		
+		if (queryResponse != null) {
+			if (queryResponse.indexOf(&quot;Dose number in series^LN||B&quot;) &gt; 0){
+				log.info(&quot;Immunization: Replaced invalid character in VXR&quot;);
+				queryResponse = queryResponse
+				.replace(&quot;Dose number in series^LN||B&quot;, &quot;Dose number in \
series^LN||1&quot;); +			}
+			 
+		}
+		return queryResponse;
+		
+	}
+	
+	private static void logError(String text, String details, String url, Integer \
patientId){ +		if (details == null){
+			details = &quot;No details&quot;;
+		}
+		if (url == null){
+			url = &quot;No url&quot;;
+		}
+		ChirdlUtilBackportsService chirdlutilbackportsService = \
Context.getService(ChirdlUtilBackportsService.class); +		Error error = new \
Error(&quot;ERROR&quot;, ERROR_CATEGORY,  +				text , &quot; URL: &quot; + url + \
&quot; Patient ID: &quot;  +				+ patientId + &quot;. &quot; + details, new Date(), \
null); +		chirdlutilbackportsService.saveError(error);
+		log.error(&quot;Immunization: &quot; + text + &quot;Details:&quot; + details );
+		return;
+	}
+
+	private static Set&lt;Patient&gt; getChirpPatientFromVXR(Message message){
+		//Past errors with CHIRP require that we check the matched patient 
+		// for VXRs also.
+		
+		//VXR only has one PID
+		PatientService patientService = Context.getPatientService();
+		PersonService personService = Context.getPersonService();
+		LocationService locationService = Context.getLocationService();
+		Set&lt;Patient&gt; chirpPatients = new HashSet&lt;Patient&gt;();
+		
+		try {
+			PID pid =  ((VXR_V03) message).getPID();
+			if (pid == null){
+				return null;
+			}
+			Patient patient = new Patient();	 
+			XPN[] xpns = pid.getPatientName();
+			for (XPN xpn : xpns){
+				xpn = pid.getPatientName(0);
+				if (xpn != null){
+					PersonName personName = new PersonName();
+					String last = xpn.getFamilyLastName().getFamilyName().getValue();
+					String first = xpn.getGivenName().getValue();
+					String middle = xpn.getMiddleInitialOrName().getValue();
+					personName.setFamilyName(last);
+					personName.setGivenName(first);
+					personName.setMiddleName(middle);
+					patient.addName(personName);
+				}
+
+				CX cx = pid.getPatientIdentifierList(0);
+				PatientIdentifier pident = new PatientIdentifier();
+				if (cx != null){
+					String id = cx.getID().getValue();
+					PatientIdentifierType type = \
patientService.getPatientIdentifierTypeByName(IMMUNIZATION_REGISTRY); \
+					pident.setIdentifierType(type); +					pident.setIdentifier(id);;
+					pident.setLocation(locationService.getLocation(&quot;Unknown Location&quot;));
+					patient.addIdentifier(pident);
+				}
+				patient.addIdentifier(pident);
+
+				XAD xad =  pid.getPatientAddress(0);
+				PersonAddress address = new PersonAddress();
+				if (xad != null){
+					address.setCityVillage(xad.getCity().getValue());
+					address.setAddress1(xad.getStreetAddress().getValue());
+					address.setPostalCode(xad.getZipOrPostalCode().getValue());
+					patient.addAddress(address);
+				}
+
+			}
+			
+			TS dob = pid.getDateTimeOfBirth();
+
+			if (dob != null &amp;&amp; dob.getTimeOfAnEvent() != null){
+				String dobString = dob.getTimeOfAnEvent().getValue();    
+				Date birthDate = new SimpleDateFormat(&quot;yyyyMMdd&quot;, \
Locale.ENGLISH).parse(dobString); +				patient.setBirthdate(birthDate);
+			}
+
+			chirpPatients.add(patient);
+
+		} catch (Exception e) {
+			log.error(Util.getStackTrace(e));
+		}
+
+		return chirpPatients;
+	}
+	
+}
</ins></span></pre>
</div>
</div>

</body>
</html>

<p></p>

-- <br />
-- OpenMRS Subversion Commits: <a \
href="http://go.openmrs.org/svn">http://go.openmrs.org/svn</a><br /> Posting is not \
                allowed - please join dev@openmrs.org for discussion.<br />
Unsubscribe: svn+unsubscribe@openmrs.org<br />

<p></p>

To unsubscribe from this group and stop receiving emails from it, send an email to <a \
href="mailto:svn+unsubscribe@openmrs.org">svn+unsubscribe@openmrs.org</a>.<br />


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic