<commit_before>const getClinics = () => $.get('/clinics', (data, status) => {
  if (status === 'success') {
    $.when(data);
  }
}, 'json');

const filterClinicsByNAF = () => {
  const checked = $('#naf_filter').prop('checked');
  $('#patient_clinic_id > option').each((_index, element) => {
    if ($(element).attr('data-naf') === 'false') {
      $(element).attr('disabled', checked);
    }
  });
};

const mapNAFtoClinic = (clinics) => {
  clinics.forEach((clinic) => {
    // eslint-disable-next-line no-underscore-dangle
    const id = clinic._id.$oid;
    const acceptsNAF = clinic.accepts_naf;
    $(`#patient_clinic_id > option[value='${id}']`).attr('data-naf', acceptsNAF);
  });
};

const filterClinicsByMedicaid = () => {
  const checked = $('#medicaid_filter').prop('checked');
  $('#patient_clinic_id > option').each((_index, element) => {
    if ($(element).attr('data-medicaid') === 'false') {
      $(element).attr('disabled', checked);
    }
  });
};

const mapMedicaidToClinic = (clinics) => {
  clinics.forEach((clinic) => {
    // eslint-disable-next-line no-underscore-dangle
    const id = clinic._id.$oid;
    const acceptsMedicaid = clinic.accepts_medicaid;
    $(`#patient_clinic_id > option[value='${id}']`).attr('data-medicaid', acceptsMedicaid);
  });
};

const ready = () => {
  $(document).on(
    'show.bs.collapse',
    '.collapsible-clinic-details',
    event => $(event.target).siblings('.clinic-detail-toggle').text('Fewer Details')
  );

  $(document).on(
    'hide.bs.collapse',
    '.collapsible-clinic-details',
    event => $(event.target).siblings('.clinic-detail-toggle').text('More Details')
  );

  $(document).on('click', '#naf_filter', () => {
    const attr = $('#patient_clinic_id > option').last().attr('data-naf');
    if (typeof attr === 'undefined') {
      return getClinics().then(mapNAFtoClinic).then(filterClinicsByNAF);
    }
    return filterClinicsByNAF();
  });

  $(document).on('click', '#medicaid_filter', () => {
    const attr = $('#patient_clinic_id > option').last().attr('data-medicaid');
    if (typeof attr === 'undefined') {
      return getClinics().then(mapMedicaidToClinic).then(filterClinicsByMedicaid);
    }<commit_msg>Prune some old code<commit_after>const getClinics = () => $.get('/clinics', (data, status) => {
  if (status === 'success') {
    $.when(data);
  }
}, 'json');

const filterClinicsByNAF = () => {
  const checked = $('#naf_filter').prop('checked');
  $('#patient_clinic_id > option').each((_index, element) => {
    if ($(element).attr('data-naf') === 'false') {
      $(element).attr('disabled', checked);
    }
  });
};

const mapNAFtoClinic = (clinics) => {
  clinics.forEach((clinic) => {
    // eslint-disable-next-line no-underscore-dangle
    const id = clinic._id.$oid;
    const acceptsNAF = clinic.accepts_naf;
    $(`#patient_clinic_id > option[value='${id}']`).attr('data-naf', acceptsNAF);
  });
};

const filterClinicsByMedicaid = () => {
  const checked = $('#medicaid_filter').prop('checked');
  $('#patient_clinic_id > option').each((_index, element) => {
    if ($(element).attr('data-medicaid') === 'false') {
      $(element).attr('disabled', checked);
    }
  });
};

const mapMedicaidToClinic = (clinics) => {
  clinics.forEach((clinic) => {
    // eslint-disable-next-line no-underscore-dangle
    const id = clinic._id.$oid;
    const acceptsMedicaid = clinic.accepts_medicaid;
    $(`#patient_clinic_id > option[value='${id}']`).attr('data-medicaid', acceptsMedicaid);
  });
};

const ready = () => {
  $(document).on('click', '#naf_filter', () => {
    const attr = $('#patient_clinic_id > option').last().attr('data-naf');
    if (typeof attr === 'undefined') {
      return getClinics().then(mapNAFtoClinic).then(filterClinicsByNAF);
    }
    return filterClinicsByNAF();
  });

  $(document).on('click', '#medicaid_filter', () => {
    const attr = $('#patient_clinic_id > option').last().attr('data-medicaid');
    if (typeof attr === 'undefined') {
      return getClinics().then(mapMedicaidToClinic).then(filterClinicsByMedicaid);
    }
{'fraction_non_alphanumeric': 0.21746617466174661, 'fraction_numerical': 0.0, 'mean_word_length': 4.069825436408977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '3490242', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1392, 'n_words': 203}