Note
Go to the end to download the full example code.
Tutorial 07: MetaData¶
Exploring metadata collected and saved during data collections.
from lisc.io import SCDB, load_object
Metadata¶
Whenever you collect data with LISC, meta data is collected about the API requests and databases accessed.
Here we will explore the metadata collected during our previous investigations.
# Reload the counts object
counts = load_object('tutorial_counts', SCDB('lisc_db'))
Metadata Object¶
Metadata information is collected into a custom MetaData
object.
If you are collecting data using the LISC object, such as the Counts
or Words
object, this collection information is attached and saved
to the object as the meta_data attribute.
# Check the date on which the collection happened
print(counts.meta_data.date)
2025-03-06_23:39:07
# Check the information about the database from which data was collected
counts.meta_data.db_info
{'dbname': 'pubmed', 'menuname': 'PubMed', 'description': 'PubMed bibliographic record', 'dbbuild': 'Build-2025.03.05.19.16', 'count': '38493853', 'lastupdate': '2025/03/05 19:16'}
For the next part, we’ll reload the Words
object, which also has stored meta data.
# Reload the words object
words = load_object('tutorial_words', SCDB('lisc_db'))
Requester MetaData¶
The collected metadata also includes information from the Requester
object, which is used to launch URL requests.
The Requester object tracks information including when URL requests were launched and the number of requests made.
# Check meta data from the requester object
words.meta_data.requester
{'n_requests': 9, 'wait_time': 0.3333333333333333, 'start_time': '23:37:47 Thursday 06 March 2025', 'end_time': '23:37:52 Thursday 06 March 2025', 'logging': None}
Total running time of the script: (0 minutes 0.003 seconds)