CityOfLosAngeles / hcid-lookup-tool

A lookup tool for data from LAHD. Repository has been archived 2022-10-13.
Apache License 2.0
0 stars 3 forks source link

implemented function to clean parsed data #29

Closed andreyorlov33 closed 7 years ago

andreyorlov33 commented 7 years ago

Implemented a "cleanUpLine" function. The function runs inside the parser.

let cleanUpLine = (data)=> {
                let dirty = data.toString();
                let replace = dirty
                    .replace(/, /g, ' ')
                    .replace(/","/g, ',')
                    .replace(/"/g, '')
                    .split(',')
               return replace
        }

the output of the runRawData function now looks like this :

RawData {
    StatementNum: '7415384',
    StatementDate: 'December 31 2016',
    APN: '6032026012',
    Property_Address: '8008 S HOOVER ST ',
    Property_City_State_Zip: 'LOS ANGELES CA 90044',
    RSO_Exemptions: '0',
    SCEP_Exmpetions: '0',
    IS_RSO: 'YES',
    IS_SCEP: 'YES',
    RSO_Invoice_Num: '3344757',
    SCEP_Invoice_Num: '3344756',
    Total_Units: '4',
    RSO_Units_Billed: '4',
    SCEP_Units_Billed: '4' }

The AddressMaster function is now ready to be implemented

oshalygin commented 7 years ago

Squash commits guys. There's too much going on in the commit history.

rhouse00 commented 7 years ago

Do you need the 'replace' variable? Could it look like this:

let cleanUpLine = (data)=> {
                let dirty = data.toString();
                dirty
                    .replace(/, /g, ' ')
                    .replace(/","/g, ',')
                    .replace(/"/g, '')
                    .split(',')
               return dirty
        }

If that doesn't work, perhaps change the variable name from 'replace' to 'cleaned', as it's a bit clearer whats going on, and it won't be confused with a built in function name