<jupyter_start><jupyter_text>Download sampleDownload **PDF articles** for all articles obtained through a PubMed query.----We download a sample of data from PubMed by running a query- *pubmed_result.xml*```("2010"[Date - Publication] : "3000"[Date - Publication]) AND "Drug Combinations"[MeSH Terms] ```- *amino_acid_substitution.xml*```("2010"[Date - Publication] : "3000"[Date - Publication]) AND "Amino Acid Substitution"[MAJR]```and saving all results in XML and CSV formats.  Imports<jupyter_code>%run _imports.ipynb
NOTEBOOK_NAME = 'download_sample'
os.makedirs(NOTEBOOK_NAME, exist_ok=True)

INPUT_FILE_NAME = 'amino_acid_substitution.xml'

OUTPUT_DIR = '{NOTEBOOK_NAME}/pdfs_0'
os.makedirs(OUTPUT_DIR, exist_ok=True)<jupyter_output><empty_output><jupyter_text>Load PubMed query results<jupyter_code>INPUT_FILE_NAME
data = pmc_tables.xml_parser.parse_pubmed_xml_file(f"{NOTEBOOK_NAME}/{INPUT_FILE_NAME}")
df = pd.DataFrame(data)
df_pmc = df[df['pmc'].notnull()]
df_pmc.head(2)<jupyter_output><empty_output><jupyter_text>Save**Note**:- `pubmed_url` can be converted to an actual URL by prepending .- `doi` can be converted to a URL by prepending<jupyter_code>os.makedirs('output', exist_ok=True)
output_df = (
    df
    .loc[df['doi'].notnull(), :]
)
output_df.head(2)
output_df.to_csv(f'output/{op.splitext(INPUT_FILE_NAME)[0]}.tsv', sep='\t', index=False)
download_results = []
for doi in output_df['doi'].values[100:120]:
    download_results.append(download_pdf(doi, OUTPUT_DIR))
    time.sleep(0.1)
output_df['doi'].values[100:110]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14748887476160202, 'fraction_numerical': 0.02161474888747616, 'mean_word_length': 7.462365591397849, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '492314', 'license': 'MIT', 'n_tokens_mistral': 626, 'n_tokens_neox': 571, 'n_words': 105, 'path': 'notebooks/xx-download_sample.ipynb', 'repo_name': 'pmc-tables/pmc-tables', 'size': '1573'}