<jupyter_start><jupyter_text>by setting values of `host`, `username` and `password` in `.env`, we can use `os.environ` as the config for `get_recent_data()`<jupyter_code>df = get_recent_data(config=os.environ, n=100, index="metrics-conversion-prod")
df.head()<jupyter_output><empty_output><jupyter_text>Which anonymousIds viewed page.query.id:fuc864rh?<jupyter_code>viewed = df.loc[(df["page.query.workId"] == "fuc864rh")]

unique_viewers = viewed["anonymousId"].unique()
unique_viewers<jupyter_output><empty_output><jupyter_text>Grab the searches by the anonymousIds that viewed page.query.id:fuc864rh.<jupyter_code>searches = df.loc[
    (df["page.name"].isin(["images", "works"]))
    & (df["page.query.query"].notnull())
    & (df["properties.totalResults"].notnull())
    & ((df["page.query.page"].isnull()) | (df["page.query.page"] == 1))
]

result = searches[searches.anonymousId.isin(unique_viewers)]<jupyter_output><empty_output><jupyter_text>What did people query and how many times?<jupyter_code>count = result.groupby("page.query.query").count()[["anonymousId"]]
count<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17477477477477477, 'fraction_numerical': 0.011711711711711712, 'mean_word_length': 8.032520325203253, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '553705', 'license': 'MIT', 'n_tokens_mistral': 419, 'n_tokens_neox': 403, 'n_words': 58, 'path': 'notebooks/analysis/notebooks/art_of_science_query.ipynb', 'repo_name': 'wellcomecollection/data-science', 'size': '1110'}