docs: def _fetch_disambiguating_assoc(self):
          """
          For any of the items in the chemical-disease association file that have
          ambiguous association types we fetch the disambiguated associations
          using the batch query API, and store these in a file. Elsewhere, we can
          loop through the file and create the appropriate associations.
  
          :return:
  
          """
  
          disambig_file = '/'.join(
              (self.rawdir, self.static_files['publications']['file']))
          assoc_file = '/'.join(
              (self.rawdir, self.files['chemical_disease_interactions']['file']))
  
          # check if there is a local association file,
          # and download if it's dated later than the original intxn file
          if os.path.exists(disambig_file):
              dfile_dt = os.stat(disambig_file)
              afile_dt = os.stat(assoc_file)
              if dfile_dt < afile_dt:
                  LOG.info(
                      "Local file date before chem-disease assoc file. "
                      " Downloading...")
              else:
                  LOG.info(
                      "Local file date after chem-disease assoc file. "
                      " Skipping download.")
                  return
  
          all_pubs = set()
          dual_evidence = re.compile(r'^marker\/mechanism\|therapeutic$')
          # first get all the unique publications
          with gzip.open(assoc_file, 'rt') as tsvfile:
              reader = csv.reader(tsvfile, delimiter="\t")
              for row in reader:
                  if re.match(r'^#', ' '.join(row)):
                      continue
                  self._check_list_len(row, 10)
                  (chem_name, chem_id, cas_rn, disease_name, disease_id,
                   direct_evidence, inferred_gene_symbol, inference_score,
                   omim_ids, pubmed_ids) = row
                  if direct_evidence == '' or not \
                          re.match(dual_evidence, direct_evidence):
                      continue
                  if pubmed_ids is not None and pubmed_ids != '':
                      all_pubs.update(set(re.split(r'\|', pubmed_ids)))
          sorted_pubs = sorted(list(all_pubs))
  
          # now in batches of 4000, we fetch the chemical-disease associations
          batch_size = 4000
          params = {
              'inputType': 'reference',
              'report': 'diseases_curated',
              'format': 'tsv',
              'action': 'Download'
          }
  
          url = 'http://ctdbase.org/tools/batchQuery.go?q'
          start = 0
          end = min((batch_size, len(all_pubs)))  # get them in batches of 4000
  
          with open(disambig_file, 'wb') as dmbf:
              while start < len(sorted_pubs):
                  params['inputTerms'] = '|'.join(sorted_pubs[start:end])
                  # fetch the data from url
                  LOG.info(
                      'fetching %d (%d-%d) refs: %s',
                      len(re.split(r'\|', params['inputTerms'])),
                      start, end, params['inputTerms'])
                  data = urllib.parse.urlencode(params)
                  encoding = 'utf-8'
                  binary_data = data.encode(encoding)
                  req = urllib.request.Request(url, binary_data)
                  resp = urllib.request.urlopen(req)
                  dmbf.write(resp.read())
                  start = end
                  end = min((start + batch_size, len(sorted_pubs)))
  
          return