<commit_before><component>
  <!--Diagnostic Results-->
  <section>
    <templateId root="2.16.840.1.113883.10.20.22.2.3.1"/>
    <!--Diagnostic Results section template-->
    <code code="30954-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Results"/>
    <title>Diagnostic Results</title>
    <%== render :partial => 'narrative_block', :locals => {:entries => entries, :section => 'results', :value=>true} %>
    <entry typeCode="DRIV">
      <organizer classCode="BATTERY" moodCode="EVN">
        <templateId root="2.16.840.1.113883.10.20.22.4.1"/>
        <!--Result organizer template -->
        <id root="<%= UUID.generate %>"/>
        <code nullFlavor="NA"/>
        <statusCode code="completed"/>
        <effectiveTime value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
          <component>
           <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
              <id root="<%= UUID.generate %>"/>
              <code nullFlavor="UNK">
                <originalText><reference value="Unknown"/></originalText>
              </code>
              <text>
                <reference value="Unknown"/>
              </text>
              <statusCode code="completed"/>
              <effectiveTime nullFlavor="UNK"/>
            </procedure>
          </component>
        <% entries.each_with_index do |entry, i| -%>
        <component>
          <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
            <!-- Result observation template -->
            <id root="<%= UUID.generate %>"/>
            <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT']) %>
            <text>
              <reference value="#results-desc-<%= i %>"/>
            </text>
            <statusCode code="completed"/>
            <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
       		 <% if entry.value -%>
			   <% if is_num?(entry.value['scalar']) -%>
                <value xsi:type="PQ" value="<%= entry.value["scalar"] %>" <% if entry.value["units"]-%>unit="<%= entry.value["units"] %>"<% end -%>/>
	           <% elsif is_bool?(entry.value['scalar'])%>
				 <value xsi:type="BL" value="<%= entry.value["scalar"] %>" />
	         <% else -%><commit_msg>Fixing small bug in CCDA results template<commit_after><component>
  <!--Diagnostic Results-->
  <section>
    <templateId root="2.16.840.1.113883.10.20.22.2.3.1"/>
    <!--Diagnostic Results section template-->
    <code code="30954-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Results"/>
    <title>Diagnostic Results</title>
    <%== render :partial => 'narrative_block', :locals => {:entries => entries, :section => 'results', :value=>true} %>
    <entry typeCode="DRIV">
      <organizer classCode="BATTERY" moodCode="EVN">
        <templateId root="2.16.840.1.113883.10.20.22.4.1"/>
        <!--Result organizer template -->
        <id root="<%= UUID.generate %>"/>
        <code nullFlavor="NA"/>
        <statusCode code="completed"/>
        <effectiveTime value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
          <component>
           <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
              <id root="<%= UUID.generate %>"/>
              <code nullFlavor="UNK">
                <originalText><reference value="Unknown"/></originalText>
              </code>
              <text>
                <reference value="Unknown"/>
              </text>
              <statusCode code="completed"/>
              <effectiveTime nullFlavor="UNK"/>
            </observation>
          </component>
        <% entries.each_with_index do |entry, i| -%>
        <component>
          <observation classCode="OBS" moodCode="EVN">
            <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
            <!-- Result observation template -->
            <id root="<%= UUID.generate %>"/>
            <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT']) %>
            <text>
              <reference value="#results-desc-<%= i %>"/>
            </text>
            <statusCode code="completed"/>
            <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
       		 <% if entry.value -%>
			   <% if is_num?(entry.value['scalar']) -%>
                <value xsi:type="PQ" value="<%= entry.value["scalar"] %>" <% if entry.value["units"]-%>unit="<%= entry.value["units"] %>"<% end -%>/>
	           <% elsif is_bool?(entry.value['scalar'])%>
				 <value xsi:type="BL" value="<%= entry.value["scalar"] %>" />
	         <% else -%>
{'fraction_non_alphanumeric': 0.19889737065309585, 'fraction_numerical': 0.04495335029686175, 'mean_word_length': 2.2419243986254296, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 139, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '6323240', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1478, 'n_words': 242}