<commit_before><entry>
  <substanceAdministration classCode="SBADM" moodCode="EVN" <%== negation_indicator(entry) %>>
    <!-- Medication Activity (consolidation) template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.16" <% if !r2_compatibility %>extension="2014-06-09"<%end%>/>
    <!-- Medication, Active template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.41" <% if !r2_compatibility %>extension="2014-12-01"<%end%>/>
    
    <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
    <text><%= entry.description %></text>
    <statusCode code="active"/> 
    <effectiveTime xsi:type="IVL_TS">
        <low <%= value_or_null_flavor(entry.start_time) %>/>
        <high <%= value_or_null_flavor(entry.end_time) %>/>
    </effectiveTime>

    <% if entry.administrationTiming.present?
      period = entry.administrationTiming['period'] %>
      <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
        <period value="<%= period['value']%>" unit="<%= period['unit']%>"/>
      </effectiveTime>
    <% end %>
    
    <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>

    <% if entry.product_form.present? -%>
    <administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
    <% end -%>

    <consumable>
      <manufacturedProduct classCode="MANU">
        <!-- Medication Information (consolidation) template --> 
        <templateId root="2.16.840.1.113883.10.20.22.4.23" <% if !r2_compatibility %>extension="2014-06-09"<%end%>/>
        <id root="<%= UUID.generate %>"/>
        <manufacturedMaterial>
          <%== code_display(entry, 'value_set_map' => value_set_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'RxNorm'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
        </manufacturedMaterial>
        <manufacturerOrganization>
          <name>Medication Factory Inc.</name>
        </manufacturerOrganization>
      </manufacturedProduct>
    </consumable>
    <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"], :r2_compatibility => r2_compatibility}) %>

    <%== render(:partial => 'medication_dispense', :collection => entry.fulfillmentHistory, :locals => {:entry => entry, :value_set_map => value_set_map, :value_set_oid => value_set_oid}, :r2_compatibility => r2_compatibility}) %>

  </substanceAdministration>

</entry><commit_msg>Removed extraneous bracket from the Medication, Active template, at the suggestion of <NAME><commit_after><entry>
  <substanceAdministration classCode="SBADM" moodCode="EVN" <%== negation_indicator(entry) %>>
    <!-- Medication Activity (consolidation) template -->
    <templateId root="2.16.840.1.113883.10.20.22.4.16" <% if !r2_compatibility %>extension="2014-06-09"<%end%>/>
    <!-- Medication, Active template -->
    <templateId root="2.16.840.1.113883.10.20.24.3.41" <% if !r2_compatibility %>extension="2014-12-01"<%end%>/>

    <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
    <text><%= entry.description %></text>
    <statusCode code="active"/>
    <effectiveTime xsi:type="IVL_TS">
        <low <%= value_or_null_flavor(entry.start_time) %>/>
        <high <%= value_or_null_flavor(entry.end_time) %>/>
    </effectiveTime>

    <% if entry.administrationTiming.present?
      period = entry.administrationTiming['period'] %>
      <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
        <period value="<%= period['value']%>" unit="<%= period['unit']%>"/>
      </effectiveTime>
    <% end %>

    <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>

    <% if entry.product_form.present? -%>
    <administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
    <% end -%>

    <consumable>
      <manufacturedProduct classCode="MANU">
        <!-- Medication Information (consolidation) template -->
        <templateId root="2.16.840.1.113883.10.20.22.4.23" <% if !r2_compatibility %>extension="2014-06-09"<%end%>/>
        <id root="<%= UUID.generate %>"/>
        <manufacturedMaterial>
          <%== code_display(entry, 'value_set_map' => value_set_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'RxNorm'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
        </manufacturedMaterial>
        <manufacturerOrganization>
          <name>Medication Factory Inc.</name>
        </manufacturerOrganization>
      </manufacturedProduct>
    </consumable>
    <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"], :r2_compatibility => r2_compatibility}) %>

    <%== render(:partial => 'medication_dispense', :collection => entry.fulfillmentHistory, :locals => {:entry => entry, :value_set_map => value_set_map, :value_set_oid => value_set_oid, :r2_compatibility => r2_compatibility}) %>

  </substanceAdministration>

</entry>
{'fraction_non_alphanumeric': 0.2000391083300743, 'fraction_numerical': 0.04262807978099335, 'mean_word_length': 4.1098901098901095, 'pattern_counts': {'":': 0, '<': 118, '<?xml version=': 0, '>': 156, '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': '2400428', 'n_tokens_mistral': 1913, 'n_tokens_neox': 1703, 'n_words': 261}