<jupyter_start><jupyter_text>Snapshot ExplainThis notebook shows how to run a Snapshot Explain operation with the minimal steps and a simple query.In this notebook...* [Dependencies and Initialisation](Dependencies-and-Initialisation)* [The Where Statement](The-Where-Statement)* [Load a Saved Query](Load-a-Saved-Query)* [Save the query for other operations](Save-the-query-for-other-operations)* [Running the Explain Operation](Running-the-Explain-Operation)  Dependencies and InitialisationImport statements and environment initialisation using the package `dotenv`. More details in the [Configuration notebook](0.2_configuration.ipynb).<jupyter_code>from factiva.news import Snapshot
from dotenv import load_dotenv
load_dotenv()
print('Done!')<jupyter_output>Done!<jupyter_text>The Where StatementThis notebook uses a simple query for illustration purposes. For more tips about queries, or guidance on how to build complex or large queries, checkout the [Complex and Large Queries](2.1_complex_large_queries.ipynb) notebook.<jupyter_code># Industry i3432 is for Batteries
where_statement = (
    r" publication_datetime >= '2016-01-01 00:00:00' "
    r" AND LOWER(language_code) IN ('en', 'de', 'fr') "
    r" AND REGEXP_CONTAINS(industry_codes, r'(?i)(^|,)(i3432)($|,)') "
)

s = Snapshot(query=where_statement)<jupyter_output><empty_output><jupyter_text>Load a Saved QueryLoads a query that was saved to a JSON file. **To be implemented!**<jupyter_code># Load saved query code<jupyter_output><empty_output><jupyter_text>Save the query for other operations**To be implemented!**<jupyter_code># Save the query to a JSON file<jupyter_output><empty_output><jupyter_text>Running the Explain OperationThis operation returns the number of documents matching the provided query in the Factiva Analytics archive.The goal of this operation is to have a rough idea of the document volume. When used iteratively, helps deciding on the used criteria to add/delete/modify the criteria to verify the impact on the matching items.The `.process_explain()` function directly returns this value. If a more manual process is required (send job, monitor job, get results), please see the [detailed package documentation](https://factiva-news-python.readthedocs.io/).<jupyter_code>%%time
s.process_explain()
print(f'Estimated document volume: {s.last_explain_job.document_volume}')<jupyter_output>Estimated document volume: 143852
CPU times: user 112 ms, sys: 2.28 ms, total: 114 ms
Wall time: 27.3 s
{'fraction_non_alphanumeric': 0.0929951690821256, 'fraction_numerical': 0.017713365539452495, 'mean_word_length': 6.553191489361702, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 1, '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}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '612711', 'license': 'MIT', 'n_tokens_mistral': 755, 'n_tokens_neox': 715, 'n_words': 256, 'path': '1.4_snapshot_explain.ipynb', 'repo_name': 'dowjones/factiva-sample-notebooks', 'size': '2484'}