Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: datathon-api first pass #104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: datathon-api first pass #104

wants to merge 1 commit into from

Conversation

lgarofalo
Copy link
Member

A first pass of this, there are a couple major todo's

  1. Add the google search console top 50 results data in, that will require that google API client setup

  2. The DB queries are coded around a hardcoded list of category names, I want to clean that up.

@@ -162,3 +162,29 @@ SELECT sd.id, sd.day, sd.opens_at, sd.closes_at, sd.open_time, sd.open_day, sd.c
FROM public.schedule_days sd
WHERE sd.schedule_id = $1
`

const contentCurationData = `
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll refactor these

WHERE (s.id in (select distinct a.service_id from categories_services a
left join services b
on a.service_id = b.id
where a.category_id in (select id from categories where name in ('Food pantries', 'Daily free meals for all', 'Food for children', 'Home-delivered groceries and home-delivered meals','Congregate meals for seniors and people with disabilities', 'Food benefits', 'Emergency Food','Coronavirus (COVID-19) Testing', 'Coronavirus-Related Urgent Care', 'Other Medical Services', 'Mental Health Urgent Care', 'Other Mental Health Services','Showers', 'Laundry', 'Clothing', 'Diaper Bank', 'Hygiene kits', 'Portable Toilets and Hand-Washing Stations', 'I am under 18 years old.', 'I am between 18 and 24 years old.', 'I am over 24 years old without children.', 'We are a family with children under 18 years old.', 'I am experiencing homelessness and I need immediate help finding shelter.', 'I am experiencing homelessness (on the street, couchsurfing, or other) and I need long-term housing assistance.', 'I am not currently experiencing homelessness, but I am looking for a long-term affordable housing unit.', 'My landlord gave me an eviction notice and I need legal help', 'My landlord told me I would get evicted and I need advice', 'I have not been able to pay my rent and I do not know what to do', 'I am not getting along with my neighbor(s) and /or my landlord and I need advice', 'Emergency Financial Assistance', 'Financial assistance for living expenses', 'Unemployment Insurance-based Benefit Payments', 'Job Placement Support', 'Vocational Training Programs', 'Job Board', 'Housing Assistance', 'Legal Assistance', 'Youth Services', 'Counseling Assistance', 'General Help', 'Temporary Shelter for Women', 'Transitional Housing for Women', 'Domestic Violence Counseling', 'Residential Treatment', 'Healthier Habits/Safer Use', 'Pregnancy Wraparound Services', 'Meetings/Support', 'Safe place to sober up', 'Reward Program', 'Medication Treatment', 'Computer or Internet Access', 'Covid-internet', 'Smartphones', 'Help Pay for Internet or Phone', 'Technology'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you wrote that you wanted to refactor this query, but I was wondering what approach we want to take for all these category names. Hardcoding the names isn't great, since we sometimes tweak the names, as they're user-facing. However, replacing them with their primary key IDs would make this query basically unreadable, not to mention I don't think we have stable and consistent IDs between prod and development environments.

In the short term, could we at least add a sanity check that this hardcoded list of category names exactly matches the DB, that is, check that every single one of these matches exactly one category in the DB? I think that could be done by performing a query to fetch all categories matching a name in this list and asserting that the length of the search result matches the length of this list.

Longer-term, perhaps all this data should actually be captured in the DB, and we could build a UI so that the content curation team could manage which categories should be used in these queries?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I need to see how we decided what this list is and see if we can make it dynamic and represented by some database state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants