CodeForPittsburgh / food-access-map-data

Data for the food access map
MIT License
8 stars 18 forks source link

Filtering bug: match any vs match all #194

Closed hellonewman closed 2 years ago

hellonewman commented 2 years ago

The filtering for "services" appears to be match all instead of match any. So if you select only "fresh produce", it eliminates sites that have SNAP and fresh produce instead of showing any site that has fresh produce regardless of whatever else they have.

maxachis commented 2 years ago

Giovanni will look into this!

hellonewman commented 2 years ago

I think I misunderstood what is going on. It actually appears that what should happen is our supermarkets should always have fresh produce "checked", because supermarkets by definition have fresh produce. But instead many have NAs.

hellonewman commented 2 years ago

In prep_SNAP.R we specify that any site with a type of farmers market or supermarket should be fresh produce: fresh_produce = ifelse(type %in% c("farmer's market", "supermarket"), 1, NA),

However, we don't actually set the site type in this script. All sites are type=NA and I believe type must be set later in a different script. We should find that script and modify the Fresh Produce rule there.

maxachis commented 2 years ago

Looking into this!

maxachis commented 2 years ago

Right now, types are set in the prep scripts, with each prep script doing separate type-setting. I'm looking into making a script that sets flags later in the workflow, just to keep that type-setting in the same area and save us some code.

maxachis commented 2 years ago

Because this issue appears to be relegated to fresh_produce solely, I'm closing this issue and redirecting the discussion solely to the issue related to setting a new fresh_produce script. https://github.com/CodeForPittsburgh/food-access-map-data/issues/198