Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Enrich DB tables with useful fields - Direction, Day of Week #30

Open
schnuerle opened this issue Apr 23, 2018 · 4 comments
Open

Enrich DB tables with useful fields - Direction, Day of Week #30

schnuerle opened this issue Apr 23, 2018 · 4 comments
Assignees
Labels
Help Wanted Good items to start with if you are looking to help with the project In Progress Currently being worked on Phase 1 RDS End to end data processor with hooks and alarms v3.0

Comments

@schnuerle
Copy link
Contributor

Once the RDS is complete in Phase 1, we'd like to enrich the database with more fields that are useful. If you have special fields or views you need for your analysis, you can make a pull request to add support for it with examples to this repo so everyone can benefit. Use this issue as a place to discuss and collaborate.

@schnuerle schnuerle added Help Wanted Good items to start with if you are looking to help with the project Phase 1 RDS End to end data processor with hooks and alarms labels Apr 23, 2018
@schnuerle schnuerle self-assigned this Jul 13, 2018
@schnuerle schnuerle added the In Progress Currently being worked on label Jul 13, 2018
@schnuerle
Copy link
Contributor Author

Looking at adding jam direction. Suggestions for other fields welcome.

@schnuerle schnuerle added the v3.0 label Jul 13, 2018
@schnuerle
Copy link
Contributor Author

schnuerle commented Jan 24, 2019

Add ew_direction and ns_direction fields to the jams table.

SQL to update existing rows with direction data:

update waze.jams set 
ew_direction =  
case  when (line -> 0 ->> 'x')::NUMERIC - (line -> jsonb_array_length(line)-1 ->> 'x')::numeric  > 0 then 
'W' else 'E' end 
where uuid in (select uuid from waze.jams where 
ew_direction is null limit 100);

 update waze.jams set 
 ns_direction =  
 case  when (line -> 0 ->> 'y')::NUMERIC - (line -> jsonb_array_length(line)-1 ->> 'y')::numeric  > 0 then 
 'S' else 'N' end
 where uuid in (select uuid from waze.jams where 
 ns_direction is null limit 100);
 

Remove where clause to update all of them, though this will take a long time.

@schnuerle schnuerle changed the title Enrich DB tables with useful fields Enrich DB tables with useful fields - Direction, Day of Week Jan 24, 2019
@schnuerle
Copy link
Contributor Author

schnuerle commented Jan 24, 2019

Add a "dayofweek" field to Jams and Alerts.

See this commit: 8a47f61

Integer, 1-7. Corresponds to Monday - Sunday.

@schnuerle
Copy link
Contributor Author

This is done in latest code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help Wanted Good items to start with if you are looking to help with the project In Progress Currently being worked on Phase 1 RDS End to end data processor with hooks and alarms v3.0
Projects
None yet
Development

No branches or pull requests

1 participant