Skip to content

Commit

Permalink
Alc csv importer (#1096)
Browse files Browse the repository at this point in the history
* Updated logic in ALC importer to remove personal data from all entries not ending in business abbreviations
  • Loading branch information
Christopher-walsh22 authored Sep 8, 2023
1 parent 712bee5 commit 4ed3b85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class RecordsTableRowComponent extends TableRowComponent implements OnIni
if (this.rowData.legislation && this.rowData.legislation[0] && this.rowData.legislation[0].offence) {
this.description = this.rowData.legislation[0].offence || '-';
}

} else {
if (this.rowData.legislation &&
this.rowData.legislation[0] &&
Expand Down
18 changes: 16 additions & 2 deletions api/src/importers/alc/utils/csv-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,25 @@ exports.getOutcomeDescription = function(csvRow) {
* @returns {string} the entity type.
*/
exports.getEntityType = function(csvRow) {
let options = ["Ltd.", "Ltd", "Inc.", "Inc", "Corp.", "Corp"];

function endsWithBusinessType(value, endings){
for (const ending of endings) {
const pattern = new RegExp(`${ending}$`, 'i');
if (pattern.test(value)) {
return true;
}
}
return false
}


if (!csvRow) {
return null;
}

if (csvRow['inspection property owner']) return MiscConstants.IssuedToEntityTypes.Company;
if (endsWithBusinessType(csvRow['inspection property owner'], options)){
return MiscConstants.IssuedToEntityTypes.Company;
}

return MiscConstants.IssuedToEntityTypes.Individual;
};

0 comments on commit 4ed3b85

Please sign in to comment.