<commit_before><channel>
  <id>b72f1a06-1ecc-4836-bb01-616235a27d94</id>
  <name>SA-1a_ValidationChannel</name>
  <description>This channel is the validation channel for Semantic Adapater.&#xd;
&#xd;
It performs the following validations with the CaCISRequest message from the Semantic Adapter service,&#xd;
&#xd;
1) performs xsd validation of the CaCISRequest&#xd;
2) performs the siteid and patientid validation of the ClinicalMetadata&#xd;
3) performs xsd validation of the SourceData element of the CaCISRequest&#xd;
4) performs schematron validation of the SourceData element of the CaCISRequest </description>
  <enabled>true</enabled>
  <version>2.1.1.5490</version>
  <lastModified>
    <time>1318620992001</time>
    <timezone>America/New_York</timezone>
  </lastModified>
  <revision>4</revision>
  <sourceConnector>
    <name>sourceConnector</name>
    <properties>
      <property name="DataType">Channel Reader</property>
      <property name="responseValue">handleResponse</property>
    </properties>
    <transformer>
      <steps>
        <step>
          <sequenceNumber>0</sequenceNumber>
          <name>xsdValidate_CaCISRequest</name>
          <script>//perform schema validation for CaCISRequest
var crXsdValidationMsg = xsdValidateSACaCISRequest(message);
if (crXsdValidationMsg != null) { 
	handleErrorStr(&apos;CaCISRequest Schema Validation:&apos; +crXsdValidationMsg);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>//perform schema validation for CaCISRequest
var crXsdValidationMsg = xsdValidateSACaCISRequest(message);
if (crXsdValidationMsg != null) { 
	handleErrorStr(&apos;CaCISRequest Schema Validation:&apos; +crXsdValidationMsg);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>1</sequenceNumber>
          <name>validateClinicalMetadata</name>
          <script>var cmd = msg[&apos;clinicalMetaData&apos;];

if(cmd.length()==0){
	handleErrorStr(&apos;ClinicalMetadata is not available&apos;);
	return;
}

var siteIdExt = cmd[&apos;@siteIdExtension&apos;];
if(siteIdExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;SiteId Extension is not available&apos;);
	return;
}

var patIDExt= cmd[&apos;@patientIdExtension&apos;];
if(patIDExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;PatientId Extension is not available&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>var cmd = msg[&apos;clinicalMetaData&apos;];

if(cmd.length()==0){
	handleErrorStr(&apos;ClinicalMetadata is not available&apos;);
	return;
}

var siteIdExt = cmd[&apos;@siteIdExtension&apos;];
if(siteIdExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;SiteId Extension is not available&apos;);
	return;
}

var patIDExt= cmd[&apos;@patientIdExtension&apos;];
if(patIDExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;PatientId Extension is not available&apos;);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>2</sequenceNumber>
          <name>getSourceData</name>
          <script>var srcDataEle = msg[&apos;sourceData&apos;];
default xml namespace = &apos;urn:tolven-org:trim:4.0&apos;;

var srcData = srcDataEle[&apos;trim&apos;];

if (srcData.length()==0) {
	handleErrorStr(&apos;SourceData is empty&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>var srcDataEle = msg[&apos;sourceData&apos;];
default xml namespace = &apos;urn:tolven-org:trim:4.0&apos;;

var srcData = srcDataEle[&apos;trim&apos;];

if (srcData.length()==0) {
	handleErrorStr(&apos;SourceData is empty&apos;);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>3</sequenceNumber>
          <name>xsdValidate_SourceData</name>
          <script>//perform schema validation for SourceData
if(globalChannelMap.get(&apos;sa.trim.xsd.validation&apos;) == &apos;true&apos;){
	logger.info(&apos;Performing xsd validation of trim (sourcedata) against trim4.xsd&apos;);
	var sdXsdValidationMsg = xsdValidateSASourceData(srcData.toString());
	if (sdXsdValidationMsg != null) { 
		handleErrorStr(&apos;SourceData Schema Validation:&apos; + sdXsdValidationMsg);
		return;
 	}
}else{
	logger.info(&apos;Skipping xsd validation of trim (sourcedata) against trim4.xsd&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>//perform schema validation for SourceData
if(globalChannelMap.get(&apos;sa.trim.xsd.validation&apos;) == &apos;true&apos;){<commit_msg>ESD-3271 : SA forwarding requests without transformation in cases where TRIM is missing the description field causing failure within CMP  Review : CR-ESD-1499<commit_after><channel>
  <id>b72f1a06-1ecc-4836-bb01-616235a27d94</id>
  <name>SA-1a_ValidationChannel</name>
  <description>This channel is the validation channel for Semantic Adapater.&#xd;
&#xd;
It performs the following validations with the CaCISRequest message from the Semantic Adapter service,&#xd;
&#xd;
1) performs xsd validation of the CaCISRequest&#xd;
2) performs the siteid and patientid validation of the ClinicalMetadata&#xd;
3) performs xsd validation of the SourceData element of the CaCISRequest&#xd;
4) performs schematron validation of the SourceData element of the CaCISRequest </description>
  <enabled>true</enabled>
  <version>2.1.1.5490</version>
  <lastModified>
    <time>1320255307490</time>
    <timezone>America/New_York</timezone>
  </lastModified>
  <revision>1</revision>
  <sourceConnector>
    <name>sourceConnector</name>
    <properties>
      <property name="DataType">Channel Reader</property>
      <property name="responseValue">handleResponse</property>
    </properties>
    <transformer>
      <steps>
        <step>
          <sequenceNumber>0</sequenceNumber>
          <name>xsdValidate_CaCISRequest</name>
          <script>//perform schema validation for CaCISRequest
var crXsdValidationMsg = xsdValidateSACaCISRequest(message);
if (crXsdValidationMsg != null) { 
	handleErrorStr(&apos;CaCISRequest Schema Validation:&apos; +crXsdValidationMsg);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>//perform schema validation for CaCISRequest
var crXsdValidationMsg = xsdValidateSACaCISRequest(message);
if (crXsdValidationMsg != null) { 
	handleErrorStr(&apos;CaCISRequest Schema Validation:&apos; +crXsdValidationMsg);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>1</sequenceNumber>
          <name>validateClinicalMetadata</name>
          <script>var cmd = msg[&apos;clinicalMetaData&apos;];

if(cmd.length()==0){
	handleErrorStr(&apos;ClinicalMetadata is not available&apos;);
	return;
}

var siteIdExt = cmd[&apos;@siteIdExtension&apos;];
if(siteIdExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;SiteId Extension is not available&apos;);
	return;
}

var patIDExt= cmd[&apos;@patientIdExtension&apos;];
if(patIDExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;PatientId Extension is not available&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>var cmd = msg[&apos;clinicalMetaData&apos;];

if(cmd.length()==0){
	handleErrorStr(&apos;ClinicalMetadata is not available&apos;);
	return;
}

var siteIdExt = cmd[&apos;@siteIdExtension&apos;];
if(siteIdExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;SiteId Extension is not available&apos;);
	return;
}

var patIDExt= cmd[&apos;@patientIdExtension&apos;];
if(patIDExt.toString().trim()==&apos;&apos;){
	handleErrorStr(&apos;PatientId Extension is not available&apos;);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>2</sequenceNumber>
          <name>getSourceData</name>
          <script>var srcDataEle = msg[&apos;sourceData&apos;];
default xml namespace = &apos;urn:tolven-org:trim:4.0&apos;;

var srcData = srcDataEle[&apos;trim&apos;];

if (srcData.length()==0) {
	handleErrorStr(&apos;SourceData is empty&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>var srcDataEle = msg[&apos;sourceData&apos;];
default xml namespace = &apos;urn:tolven-org:trim:4.0&apos;;

var srcData = srcDataEle[&apos;trim&apos;];

if (srcData.length()==0) {
	handleErrorStr(&apos;SourceData is empty&apos;);
	return;
}</string>
            </entry>
          </data>
        </step>
        <step>
          <sequenceNumber>3</sequenceNumber>
          <name>xsdValidate_SourceData</name>
          <script>//Perform check to make sure description of the trim is available
var desc = srcData[&apos;description&apos;];

if (desc.length() == 0) {
	handleErrorStr(&apos;description is not available !&apos;);
	return;
}
if (desc.toString().trim()==&apos;&apos;) {
	handleErrorStr(&apos;description is empty !&apos;);
	return;
}


//perform schema validation for SourceData
if(globalChannelMap.get(&apos;sa.trim.xsd.validation&apos;) == &apos;true&apos;){
	logger.info(&apos;Performing xsd validation of trim (sourcedata) against trim4.xsd&apos;);
	var sdXsdValidationMsg = xsdValidateSASourceData(srcData.toString());
	if (sdXsdValidationMsg != null) { 
		handleErrorStr(&apos;SourceData Schema Validation:&apos; + sdXsdValidationMsg);
		return;
 	}
}else{
	logger.info(&apos;Skipping xsd validation of trim (sourcedata) against trim4.xsd&apos;);
	return;
}</script>
          <type>JavaScript</type>
          <data class="map">
            <entry>
              <string>Script</string>
              <string>//Perform check to make sure description of the trim is available
var desc = srcData[&apos;description&apos;];

if (desc.length() == 0) {
	handleErrorStr(&apos;description is not available !&apos;);
	return;
}
if (desc.toString().trim()==&apos;&apos;) {
	handleErrorStr(&apos;description is empty !&apos;);
	return;
}


//perform schema validation for SourceData
if(globalChannelMap.get(&apos;sa.trim.xsd.validation&apos;) == &apos;true&apos;){
{'fraction_non_alphanumeric': 0.14226765450623652, 'fraction_numerical': 0.012566819844321486, 'mean_word_length': 3.9995311767463666, 'pattern_counts': {'":': 0, '<': 199, '<?xml version=': 0, '>': 199, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5011748', 'n_tokens_mistral': 3471, 'n_tokens_neox': 3498, 'n_words': 677}