Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ciolt committed Sep 3, 2019
1 parent 8dcccb0 commit fe4658a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const getResolutions = (combinedRecords, vote = true) => combinedRecords.map(a =

const getVotingRecord = async officeHolder => {
const url = genURL(officeHolder)
console.log(url)
console.log(`Fetching for ${officeHolders[officeHolder]} via ${url}`)
let hdata
try {
const { data } = await axios.get(url, {
Expand All @@ -76,6 +76,7 @@ const getVotingRecord = async officeHolder => {
} catch (err) {
throw err
}
console.log(`Finished fetching records for ${officeHolders[officeHolder]}`)
return hdata
}

Expand All @@ -95,7 +96,7 @@ const loopy = async () => {
const headers = [
'_id', 'File Number', 'File Name', 'File Type', 'Title', 'Date', 'Control', 'Status', 'Voted'
].map(a => `"${a}"`).join(',')
const sanitizedName = officeHolders[a].replace(/[^A-Za-z0-9]/gm, '')
const sanitizedName = officeHolders[a].replace(/[^A-Za-z0-9\s]/gm, '')
const ws = fs.createWriteStream(`csv/${sanitizedName}.csv`)
console.log(`Writing for ${officeHolders[a]}`)
ws.write(headers + '\n')
Expand All @@ -104,7 +105,7 @@ const loopy = async () => {
let line = []
origHeaders.forEach(h => line.push(`"${data[i][h]}"`))
ws.write(line.join(',') + '\n')
console.log(`${(i / tot * 100).toFixed(2)}%\t${officeHolders[a]}`)
console.log(`${((i + 1) / tot * 100).toFixed(2)}%\t${officeHolders[a]}`)
}
ws.end()
})
Expand Down
12 changes: 6 additions & 6 deletions office-holders.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const officeHolders = {
54: 'Betty T. Ferguson',
55: 'James Burke',
56: 'Arthur E. Teele, Jr.',
57: 'Gwen Margolis',
58: 'Bruce C. Kaplan',
59: 'Pedro Reboredo',
// 54: 'Betty T. Ferguson',
// 55: 'James Burke',
// 56: 'Arthur E. Teele, Jr.',
// 57: 'Gwen Margolis',
// 58: 'Bruce C. Kaplan',
// 59: 'Pedro Reboredo',
60: 'Maurice A. Ferre',
61: 'Katy Sorenson',
62: 'Dennis C. Moss',
Expand Down

0 comments on commit fe4658a

Please sign in to comment.