Skip to content

Commit

Permalink
updated htmlparser2
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Aug 31, 2021
1 parent d7b3329 commit 7bd6f68
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 231 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ test
.gitignore
.npmignore
appveyor.yml
cli.d.ts
cli.js
cli.ts
tsconfig.json
1 change: 1 addition & 0 deletions cli.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
9 changes: 9 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getClearanceByAccountNumber } from "./index.js";
const cli = async () => {
const accountNumbers = process.argv[2].split(",");
for (const accountNumber of accountNumbers) {
const results = await getClearanceByAccountNumber(accountNumber);
console.log(results);
}
};
cli();
12 changes: 12 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getClearanceByAccountNumber } from "./index.js";

const cli = async () => {
const accountNumbers = process.argv[2].split(",");

for (const accountNumber of accountNumbers) {
const results = await getClearanceByAccountNumber(accountNumber);
console.log(results);
}
};

cli();
314 changes: 166 additions & 148 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityssm/wsib-clearance-check",
"version": "2.0.0",
"version": "2.0.1",
"description": "A tool to scrape the clearance certificate status from the WSIB Online Services website.",
"keywords": [
"wsib",
Expand Down Expand Up @@ -28,16 +28,16 @@
"coverage": "c8 --reporter=lcov --reporter=text --reporter=text-summary mocha --timeout 20000"
},
"dependencies": {
"htmlparser2": "^6.1.0",
"htmlparser2": "^7.1.1",
"puppeteer": "^10.2.0"
},
"devDependencies": {
"@types/mocha": "^9.0.0",
"@types/puppeteer": "^5.4.4",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-unicorn": "^35.0.0"
Expand Down
74 changes: 35 additions & 39 deletions wsib-classifications.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
const wsibClasses_A = {
className: "AGRICULTURE",
naicsPrefixes: ["11"]
naicsPrefixes: ["11", "001010"]
};
const wsibClasses_B = {
className: "MINING, QUARRYING AND OIL AND GAS EXTRACTION",
naicsPrefixes: ["21"]
naicsPrefixes: ["21", "001020"]
};
const wsibClasses_C = {
className: "UTILITIES",
naicsPrefixes: ["22"]
naicsPrefixes: ["22", "001030"]
};
const wsibClasses_D = {
className: "GOVERNMENTAL AND RELATED SERVICES",
subclasses: {
1: {
subclassName: "Educational services",
naicsPrefixes: ["61"]
naicsPrefixes: ["61", "001040"]
},
2: {
subclassName: "Public administration",
naicsPrefixes: ["91"]
naicsPrefixes: ["91", "001050"]
},
3: {
subclassName: "Hospitals",
naicsPrefixes: ["622"]
naicsPrefixes: ["622", "001060"]
}
}
};
Expand All @@ -32,27 +32,27 @@ const wsibClasses_E = {
subclasses: {
1: {
subclassName: "Food, textiles and related manufacturing",
naicsPrefixes: ["31"]
naicsPrefixes: ["31", "001070"]
},
2: {
subclassName: "Non-metallic and mineral manufacturing",
naicsPrefixes: ["321", "322", "326", "327"]
naicsPrefixes: ["321", "322", "326", "327", "001080"]
},
3: {
subclassName: "Printing, petroleum and chemical manufacturing",
naicsPrefixes: ["323", "324", "325"]
naicsPrefixes: ["323", "324", "325", "001090"]
},
4: {
subclassName: "Metal transportation equipment and furniture manufacturing",
naicsPrefixes: ["331", "332", "336", "337"]
naicsPrefixes: ["331", "332", "336", "337", "001100"]
},
5: {
subclassName: "Machinery, electrical equipment and miscellaneous manufacturing",
naicsPrefixes: ["333", "335", "339"]
naicsPrefixes: ["333", "335", "339", "001110"]
},
6: {
subclassName: "Computer and electronic manufacturing",
naicsPrefixes: ["334"]
naicsPrefixes: ["334", "001120"]
}
}
};
Expand All @@ -61,40 +61,36 @@ const wsibClasses_F = {
subclasses: {
1: {
subclassName: "Rail, water, truck transportation and postal service",
naicsPrefixes: ["482", "483", "484", "491"]
naicsPrefixes: ["482", "483", "484", "491", "001130"]
},
2: {
subclassName: "Air, transit, ground passenger, recreational and pipeline transportation, courier services and warehousing",
naicsPrefixes: ["481", "485", "486", "487", "488", "492", "493"]
naicsPrefixes: ["481", "485", "486", "487", "488", "492", "493", "001140"]
}
}
};
const wsibClasses_G = {
className: "CONSTRUCTION",
subclasses: {
1: {
subclassName: "Residential building construction",
naicsPrefixes: ["2361"]
subclassName: "Building construction",
naicsPrefixes: ["2361", "2362", "001150", "007010"]
},
2: {
subclassName: "Infrastructure construction",
naicsPrefixes: ["237"]
naicsPrefixes: ["237", "001160", "007020"]
},
3: {
subclassName: "Foundation, structure and building exterior construction",
naicsPrefixes: ["2381"]
naicsPrefixes: ["2381", "001170", "007030"]
},
4: {
subclassName: "Building equipment construction",
naicsPrefixes: ["2382"]
naicsPrefixes: ["2382", "001180", "007040"]
},
5: {
subclassName: "Specialty trades construction",
naicsPrefixes: ["2383", "2389"]
},
6: {
subclassName: "Non-residential building construction",
naicsPrefixes: ["2362"]
naicsPrefixes: ["2383", "2389", "001190", "007050"]
}
}
};
Expand All @@ -103,11 +99,11 @@ const wsibClasses_H = {
subclasses: {
1: {
subclassName: "Petroleum, food, motor vehicle and miscellaneous wholesale",
naicsPrefixes: ["411, 412", "413", "415", "418"]
naicsPrefixes: ["411, 412", "413", "415", "418", "001200"]
},
2: {
subclassName: "Personal and household goods, building materials and machinery wholesale",
naicsPrefixes: ["414", "416", "417", "419"]
naicsPrefixes: ["414", "416", "417", "419", "001210"]
}
}
};
Expand All @@ -116,62 +112,62 @@ const wsibClasses_I = {
subclasses: {
1: {
subclassName: "Motor vehicles, building materials and food and beverage retail",
naicsPrefixes: ["441", "444", "445", "447"]
naicsPrefixes: ["441", "444", "445", "447", "001220"]
},
2: {
subclassName: "Furniture, home furnishings, clothing and clothing accessories retail",
naicsPrefixes: ["442", "448"]
naicsPrefixes: ["442", "448", "001230"]
},
3: {
subclassName: "Electronics, appliances, health and personal care retail",
naicsPrefixes: ["443", "446"]
naicsPrefixes: ["443", "446", "001240"]
},
4: {
subclassName: "Specialized retail and department stores",
naicsPrefixes: ["45"]
naicsPrefixes: ["45", "001250"]
}
}
};
const wsibClasses_J = {
className: "INFORMATION AND CULTURE",
naicsPrefixes: ["51"]
naicsPrefixes: ["51", "001260"]
};
const wsibClasses_K = {
className: "FINANCE, MANAGEMENT AND LEASING",
naicsPrefixes: ["52", "53", "55"]
naicsPrefixes: ["52", "53", "55", "001270"]
};
const wsibClasses_L = {
className: "PROFESSIONAL, SCIENTIFIC AND TECHNICAL",
naicsPrefixes: ["54"]
naicsPrefixes: ["54", "001280"]
};
const wsibClasses_M = {
className: "ADMINISTRATION, SERVICES TO BUILDINGS, DWELLINGS AND OPEN SPACES",
naicsPrefixes: ["56"]
naicsPrefixes: ["56", "001290"]
};
const wsibClasses_N = {
className: "NON-HOSPITAL HEALTH CARE AND SOCIAL ASSISTANCE",
subclasses: {
1: {
subclassName: "Ambulatory health care",
naicsPrefixes: ["621"]
naicsPrefixes: ["621", "001300"]
},
2: {
subclassName: "Nursing and residential care facilities",
naicsPrefixes: ["623"]
naicsPrefixes: ["623", "001310"]
},
3: {
subclassName: "Social assistance",
naicsPrefixes: ["624"]
naicsPrefixes: ["624", "001320"]
}
}
};
const wsibClasses_O = {
className: "LEISURE AND HOSPITALITY",
naicsPrefixes: ["71", "72"]
naicsPrefixes: ["71", "72", "001330"]
};
const wsibClasses_P = {
className: "OTHER SERVICES",
naicsPrefixes: ["81"]
naicsPrefixes: ["81", "001340"]
};
const wsibClasses = {
A: wsibClasses_A,
Expand Down
Loading

0 comments on commit 7bd6f68

Please sign in to comment.