Progres will sometimes send us up to 6 locationlevel fields that when combined, complete a full address_current. However, sometimes all 6 location fields are not available... we therefore need to check if each locationlevel (address1, address2, etc) exist... and if yes, concatenate them with a space.
Request
Progres will sometimes send us up to 6
locationlevel
fields that when combined, complete a fulladdress_current
. However, sometimes all 6 location fields are not available... we therefore need to check if eachlocationlevel
(address1, address2, etc) exist... and if yes, concatenate them with a space.I implemented this change so far... but it returns too many extra spaces when one of these addresses is not defined. https://github.com/OpenFn/primero-progres/blob/ddbba293135151a1c130036aaa598fe68f963a0e/jobs/1.upsertExtracts.js#L410
See this run for example L30 has lots of extra spaces.
Ideally it will output as:
address_current: 'Garissa Block A LOCATION LEVEL 6',
where there is only 1 space between each available address.state
See LP for Dadaab
open_function
user. Feel free to re-run this on prod: https://www.openfn.org/projects/p5am6e/messages/mqp9zdegexpression
https://github.com/OpenFn/primero-progres/blob/master/jobs/1.upsertExtracts.js