Skip to content

Commit 635b619

Browse files
committed
update with final fixes
1 parent 29fe8eb commit 635b619

File tree

12 files changed

+121
-129
lines changed

12 files changed

+121
-129
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ logs
55
*.log
66
npm-debug.log*
77

8-
#kyle
9-
.DS_Store
10-
*.csv
11-
128
# Runtime data
139
pids
1410
*.pid

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dataset_url": "https://www.data.va.gov/data.json",
33
"logLevel": "info",
44
"dbConfig": {
5-
"db_url": "postgres://user:pass@localhost:5432/va"
5+
"db_url": "postgres://postgres:pass@localhost:5432/va"
66
},
77
"downloadPath": "downloads"
88
}

csvCounts.txt

Lines changed: 0 additions & 55 deletions
This file was deleted.

models/Branch.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
* Branch model definition
99
*/
1010
module.exports = (sequelize, DataTypes) => sequelize.define('Branch', {
11+
id: {
12+
type: DataTypes.INTEGER,
13+
allowNull: false,
14+
primaryKey: true,
15+
autoIncrement: true
16+
},
1117
value: {
1218
type: DataTypes.STRING,
13-
allowNull: null,
14-
primaryKey: true,
15-
unique: true
19+
allowNull: false
1620
}
1721
}, {
1822
timestamps: false

models/Rank.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
* Rank model definition
99
*/
1010
module.exports = (sequelize, DataTypes) => sequelize.define('Rank', {
11+
id: {
12+
type: DataTypes.INTEGER,
13+
allowNull: false,
14+
primaryKey: true,
15+
autoIncrement: true
16+
},
1117
value: {
1218
type: DataTypes.STRING,
13-
allowNull: null,
14-
primaryKey: true,
15-
unique: true
19+
allowNull: false
1620
}
1721
}, {
1822
timestamps: false

models/Veteran.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module.exports = (sequelize, DataTypes) => sequelize.define('Veteran', {
1717
d_first_name: { type: DataTypes.STRING, allowNull: false },
1818
d_mid_name: DataTypes.STRING,
1919
d_last_name: { type: DataTypes.STRING, allowNull: false },
20-
d_birth_date: { type: DataTypes.DATE, allowNull: false },
21-
d_death_date: { type: DataTypes.DATE, allowNull: false },
20+
d_birth_date: { type: DataTypes.DATEONLY, allowNull: false },
21+
d_death_date: { type: DataTypes.DATEONLY, allowNull: false },
2222
d_suffix: DataTypes.STRING
2323
}, {
2424
timestamps: false

models/War.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
* War model definition
99
*/
1010
module.exports = (sequelize, DataTypes) => sequelize.define('War', {
11+
id: {
12+
type: DataTypes.INTEGER,
13+
allowNull: false,
14+
primaryKey: true,
15+
autoIncrement: true
16+
},
1117
value: {
1218
type: DataTypes.STRING,
13-
allowNull: null,
14-
primaryKey: true,
15-
unique: true
19+
allowNull: false
1620
}
1721
}, {
1822
timestamps: false

package-lock.json

Lines changed: 52 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
},
1515
"license": "ISC",
1616
"dependencies": {
17+
"ascii-progress": "^1.0.5",
1718
"chalk": "^2.3.0",
1819
"co": "^4.6.0",
1920
"config": "^1.27.0",
2021
"csv-parse": "^2.0.0",
2122
"dotenv": "^4.0.0",
2223
"lodash": "^4.17.4",
23-
"moment": "^2.19.4",
24+
"moment": "^2.20.0",
2425
"pg": "^7.4.0",
2526
"request": "^2.83.0",
2627
"request-promise": "^4.2.2",

scripts/import-data.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@ const datasetService = require('../services/dataset');
1616
const dataService = require('../services/data');
1717
const { syncDB } = require('../models');
1818

19-
const downloadPath = `${__dirname}/../${config.downloadPath}/`;
20-
2119
co(function* () {
2220
yield syncDB();
23-
const files = datasetService.getFilenames(downloadPath);
21+
const files = datasetService.getFilenames(config.downloadPath);
2422

2523
/**
2624
* Read each dataset recursively.
2725
* @param {integer} index - The dataset index
2826
*/
2927
function* readfile(index) {
3028
logger.info(`Processing file: ${files[index]}`);
31-
yield dataService.processFile(yield datasetService.readCSV(`${downloadPath}/${files[index]}`));
29+
yield dataService.processFile(yield datasetService.readCSV(`${config.downloadPath}/${files[index]}`));
3230
return index < files.length - 1 ? yield readfile(index + 1) : true;
3331
}
3432

0 commit comments

Comments
 (0)