All the relevant data model code is placed in writeDataCSV.
At the moment, that code is mainly based on https://github.com/mariopino/substrate-data-csv/blob/master/utils.js and I'd recommend to refactor it.
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 fist time
yarn
yarn startThe default configuration will create a ./data-csv folder that will be populated with the chain data