tulip / ppe-logistics

Issue Tracking for PPELogistics.org
2 stars 1 forks source link

Handle Invalid Addresses in Shipment Manager #223

Open ianslai opened 3 years ago

ianslai commented 3 years ago

MasksOn has a lot of orders with invalid addresses, so while they are preparing shipments they often get pages with invalid addresses that they have to sift through in order to get to ones that are ready for shipping.

One possible way to handle this would be to add a checkbox that would somehow filter out invalid addresses in the Shipment Manager. (But what would be a robust way for doing so?)

We might also investigate why the Google geolocation API rejects some of the addresses that seem to be valid (see #218).

ianslai commented 3 years ago

Having played around with the data a bit, it seems this captures close to 99% percent of what appear to be good addresses:

HAVING coalesce(dem.alt_address,wcto.address) ~ '(.+,)?\d.+,.+,.+\d{5},.+'

Foreign addresses are potentially another case that one might want to home in on, although I don't know if in this case MasksOn needs to manually generate a shipping label anyways?

coalesce(dem.alt_address,wcto.address) !~ '(USA|United States)$'

There are a handful of good addresses that do not follow the format above, but those are all from the start of the effort where it appears we weren't validating addresses through Google.

ianslai commented 3 years ago

I snapshotted my changes, which now add a new dropdown box in both Shipment Manager and Shipment Manager (SN).

Since I don't have GoShippo I can't do a full test to make sure that the filter stays in place going through the MasksOn workflow, but I did experiment using Print Label to confirm that going from step to step doesn't throw that data away.

There are several buttons that do reset all filters, because they actually Complete the step:

There are a lot of variables shown in UI elements so I opted not to try and change the way those buttons work so that the filters are retained. My sense right now is that MasksOn hardly ever uses Couriers (only twice in July) so for now this isn't a huge issue.

contextref commented 3 years ago

Is this done and deployed now @ianslai ?