CompuCrawl: Full database and code
Creators: name: Haans, Richard
name: Mertens, Marc
Publisher: name: Erasmus University Rotterdam (EUR)
Year: 2024
Subjects: classificationCode: 389999
subject: Other economics not elsewhere classified
classificationCode: 380204
subject: Panel data analysis
classificationCode: 441006
subject: Sociological methodology and research methods

description: <br>This folder contains the full set of code and data for the CompuCrawl database. The database contains the archived websites of publicly traded North American firms listed in the Compustat database between 1996 and 2020—representing 11,277 firms with 86,303 firm/year observations and 1,617,675 webpages in the final cleaned and selected set.The files are ordered by moment of use in the work flow. For example, the first file in the list is the input file for code files 01 and 02, which create and update the two tracking files "scrapedURLs.csv" and "URLs_1_deeper.csv" and which write HTML files to its folder. "HTML.zip" is the resultant folder, converted to .zip for ease of sharing. Code file 03 then reads this .zip file and is therefore below it in the ordering.The full set of files, in order of use, is as follows:<i>Compustat_2021.xlsx</i>: The input file containing the URLs to be scraped and their date range.<i>01 Collect frontpages.py</i>: Python script scraping the front pages of the list of URLs and generating a list of URLs one page deeper in the domains.<i>URLs_1_deeper.csv</i>: List of URLs one page deeper on the main domains.<i>02 Collect further pages.py</i>: Python script scraping the list of URLs one page deeper in the domains.<i>scrapedURLs.csv</i>: Tracking file containing all URLs that were accessed and their scraping status.<i>HTML.zip</i>: Archived version of the set of individual HTML files.<i>03 Convert HTML to plaintext.py</i>: Python script converting the individual HTML pages to plaintext.<i>TXT_uncleaned.zip</i>: Archived version of the converted yet uncleaned plaintext files.<i>input_categorization_allpages.csv</i>: Input file for classification of pages using GPT according to their HTML title and URL.<i>04 GPT application.py</i>: Python script using OpenAI’s API to classify selected pages according to their HTML title and URL.<i>categorization_applied.csv</i>: Output file containing classification of selected pages.<i>exclusion_list.xlsx</i>: File containing three sheets: 'gvkeys' containing the GVKEYs of duplicate observations (that need to be excluded), 'pages' containing page IDs for pages that should be removed, and 'sentences' containing (sub-)sentences to be removed.<i>05 Clean and select.py</i>: Python script applying data selection and cleaning (including selection based on page category), with setting and decisions described at the top of the script. This script also combined individual pages into one combined observation per GVKEY/year.<i>metadata.csv</i>: Metadata containing information on all processed HTML pages, including those not selected.<i>TXT_cleaned.zip</i>: Archived version of the selected and cleaned plaintext page files. This file serves as input for the word embeddings application.<i>TXT_combined.zip</i>: Archived version of the combined plaintext files at the GVKEY/year level. This file serves as input for the data description using topic modeling.<i>06 Topic model.R</i>: R script that loads up the combined text data from the folder stored in "TXT_combined.zip", applies further cleaning, and estimates a 125-topic model.<br><i>TM_125.RData:</i> RData file containing the results of the 125-topic model.<i>loadings125.csv</i>: CSV file containing the loadings for all 125 topics for all GVKEY/year observations that were included in the topic model.<i>125_topprob.xlsx</i>: Overview of top-loading terms for the 125 topic model.<i>07 Word2Vec train and align.py</i>: Python script that loads the plaintext files in the "TXT_cleaned.zip" archive to train a series of Word2Vec models and subsequently align them in order to compare word embeddings across time periods.<i>Word2Vec_models.zip</i>: Archived version of the saved Word2Vec models, both unaligned and aligned.<i>08 Word2Vec work with aligned models.py</i>: Python script which loads the trained Word2Vec models to trace the development of the embeddings for the terms “sustainability” and “profitability” over time.<i>99 Scrape further levels down.py</i>: Python script that can be used to generate a list of unscraped URLs from the pages that themselves were one level deeper than the front page.<i>URLs_2_deeper.csv</i>: CSV file containing unscraped URLs from the pages that themselves were one level deeper than the front page.<b>For those only interested in downloading the final database of texts, the files "HTML.zip", "TXT_uncleaned.zip", "TXT_cleaned.zip", and "TXT_combined.zip" contain the full set of HTML pages, the processed but uncleaned texts, the selected and cleaned texts, and combined and cleaned texts at the GVKEY/year level, respectively.</b>The following webpage contains answers to frequently asked questions: https://haans-mertens.github.io/faq/. More information on the database and the underlying project can be found here: https://haans-mertens.github.io/ and the following article: “<i>The Internet Never Forgets: A Four-Step Scraping Tutorial, Codebase, and Database for Longitudinal Organizational Website Data</i>”, by Richard F.J. Haans and Marc J. Mertens in <i>Organizational Research Methods</i>. The full paper can be accessed here.<br>