ucd-library / sloan-datafest-markup-tool

Page markup tool for datafest
MIT License
0 stars 0 forks source link

Update app to use the next_page function #2

Open qjhart opened 4 years ago

qjhart commented 4 years ago

The current database has a datafest.next_page function. Need up to update the app to use this. Called like:

http --print=hHbB POST https://datafest201912.library.ucdavis.edu/pgr/rpc/next_page Content-Type:application/json <<<'{"user_id":"quinn"}'
jrmerz commented 4 years ago

@qjhart 03_functions.sql has issues, won't load for me locally.

jrmerz commented 4 years ago

@qjhart still failing

postgres=# create materialized view datafest.page_price_p as
postgres-# with a as (
postgres(#  select t.page_ark
postgres(#  from rtesseract.page t
postgres(#  join datafest.page p on (t.page_ark=p.page_ark)
postgres(# ),
postgres-# b as (
postgres(#  select page_ark,count(*)
postgres(#  from wine_search.price
postgres(#  join a using (page_ark)
postgres(#  group by page_ark
postgres(# ),
postgres-# c as (
postgres(#  select sum(count)
postgres(#  from b
postgres(# ),
postgres-# d as (
postgres(#  select
postgres(#  page_ark,
postgres(#  case when (b is null) then 1000.0/c.sum else b.count*1000.0/c.sum end as prob
postgres(#  from a
postgres(#  left join b using (page_ark),c
postgres(# )
postgres-# select
postgres-#  page_ark,
postgres-#  prob,
postgres-#  sum(prob) OVER (order by page_ark RANGE UNBOUNDED PRECEDING) as cum
postgres-#  from d;
ERROR:  relation "rtesseract.page" does not exist
LINE 4:  from rtesseract.page t
              ^
jrmerz commented 4 years ago

@qjhart ready for deployment