All the relevant data model code is placed in writeDataCSV.
git clone https://github.com/w3f/polkadot-watcher-csv-exporter.git
cd polkadot-watcher-csv-exporter
cp config/main.sample.yaml config/main.yaml
#just the first time
yarn
yarn build
yarn start
The default configuration will create a ./data-csv folder that will be populated with the chain data