{"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388588998", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388588998, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODU4ODk5OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-12T22:57:30Z", "updated_at": "2018-05-12T23:00:24Z", "author_association": "OWNER", "body": "A few demos:\r\n\r\n* https://datasette-facets-demo.now.sh/fivethirtyeight-2628db9/college-majors%2Fall-ages?_facet=Major_category\r\n* https://datasette-facets-demo.now.sh/fivethirtyeight-2628db9/congress-age%2Fcongress-terms?_facet=chamber&_facet=state&_facet=party&_facet=incumbent\r\n* https://datasette-facets-demo.now.sh/fivethirtyeight-2628db9/bechdel%2Fmovies?_facet=binary&_facet=test", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389145872", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389145872, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTE0NTg3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-15T12:17:52Z", "updated_at": "2018-05-15T12:17:52Z", "author_association": "OWNER", "body": "Activity has now moved to this branch: https://github.com/simonw/datasette/commits/suggested-facets", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388587855", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388587855, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODU4Nzg1NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-12T22:30:23Z", "updated_at": "2018-05-12T22:30:23Z", "author_association": "OWNER", "body": "Adding some TODOs to the original description (so they show up as a todo progress bar)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388784063", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388784063, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODc4NDA2Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-14T11:25:00Z", "updated_at": "2018-05-14T11:25:15Z", "author_association": "OWNER", "body": "Can I get facets working across many2many relationships?\r\n\r\nThis would be fiendishly useful, but the querystring and `metadata.json` syntax is non-obvious.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388525357", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388525357, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODUyNTM1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-12T03:01:14Z", "updated_at": "2018-05-12T03:01:14Z", "author_association": "OWNER", "body": "Facet counts will be generated by extra SQL queries with their own aggressive time limit.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388645828", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388645828, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODY0NTgyOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-13T18:18:56Z", "updated_at": "2018-05-13T18:20:02Z", "author_association": "OWNER", "body": "I may be able to run the SQL for all of the facet counts in one go using a WITH CTE query - will have to microbenchmark this to make sure it is worthwhile: https://datasette-facets-demo.now.sh/fivethirtyeight-2628db9?sql=with+blah+as+%28select+*+from+%5Bcollege-majors%2Fall-ages%5D%29%0D%0Aselect+*+from+%28select+%22Major_category%22%2C+Major_category%2C+count%28*%29+as+n+from%0D%0Ablah+group+by+Major_category+order+by+n+desc+limit+10%29%0D%0Aunion+all%0D%0Aselect+*+from+%28select+%22Major_category2%22%2C+Major_category%2C+count%28*%29+as+n+from%0D%0Ablah+group+by+Major_category+order+by+n+desc+limit+10%29", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388589072", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388589072, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODU4OTA3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-12T22:59:07Z", "updated_at": "2018-05-12T22:59:07Z", "author_association": "OWNER", "body": "I need to decide how to display these. They currently look like this:\r\n\r\nhttps://datasette-facets-demo.now.sh/fivethirtyeight-2628db9/congress-age%2Fcongress-terms?_facet=chamber&_facet=state&_facet=party&_facet=incumbent&state=MO\r\n\r\n![2018-05-12 at 7 58 pm](https://user-images.githubusercontent.com/9599/39962230-e7bf9e10-561e-11e8-80a7-0941b8991318.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389386919", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389386919, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTM4NjkxOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-16T03:57:47Z", "updated_at": "2018-05-16T03:58:30Z", "author_association": "OWNER", "body": "I updated that demo to demonstrate the new foreign key label expansions: https://datasette-suggested-facets-demo.now.sh/sf-trees-02c8ef1/Street_Tree_List?_facet=qLegalStatus\r\n\r\n![2018-05-15 at 8 58 pm](https://user-images.githubusercontent.com/9599/40095806-b645026a-5882-11e8-8100-76136df50212.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388588011", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388588011, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODU4ODAxMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-12T22:33:39Z", "updated_at": "2018-05-12T22:33:39Z", "author_association": "OWNER", "body": "Initial documentation: http://datasette.readthedocs.io/en/latest/facets.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388686463", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388686463, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODY4NjQ2Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-14T03:23:44Z", "updated_at": "2018-05-14T03:25:22Z", "author_association": "OWNER", "body": "It would be neat if there was a mechanism for calculating aggregates per facet - e.g. calculating the sum() of specific columns against each facet result on https://datasette-facets-demo.now.sh/fivethirtyeight-2628db9/nba-elo%2Fnbaallelo?_facet=lg_id&_facet=fran_id&lg_id=ABA&_facet=team_id", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389546040", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389546040, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTU0NjA0MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-16T14:47:34Z", "updated_at": "2018-05-16T14:47:34Z", "author_association": "OWNER", "body": "Latest demo - now with multiple columns: https://datasette-suggested-facets-demo.now.sh/sf-trees-02c8ef1/Street_Tree_List?_facet=qCaretaker&_facet=qCareAssistant&_facet=qLegalStatus\r\n\r\n![2018-05-16 at 7 47 am](https://user-images.githubusercontent.com/9599/40124418-63e680ba-58dd-11e8-8063-9686826abb8e.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389397457", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389397457, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTM5NzQ1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-16T05:20:04Z", "updated_at": "2018-05-16T05:20:04Z", "author_association": "OWNER", "body": "Maybe `suggested_facets` should only be calculated for the HTML view.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389147608", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389147608, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTE0NzYwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-15T12:24:46Z", "updated_at": "2018-05-15T12:24:46Z", "author_association": "OWNER", "body": "New demo (published with `datasette publish now --branch=suggested-facets fivethirtyeight.db sf-trees.db --name=datastte-suggested-facets-demo`): https://datasette-suggested-facets-demo.now.sh/fivethirtyeight-2628db9/comic-characters%2Fmarvel-wikia-data\r\n\r\nAfter turning on a couple of suggested facets... https://datasette-suggested-facets-demo.now.sh/fivethirtyeight-2628db9/comic-characters%2Fmarvel-wikia-data?_facet=SEX&_facet=ID\r\n\r\n![2018-05-15 at 7 24 am](https://user-images.githubusercontent.com/9599/40056411-fa265d16-5810-11e8-89ec-e38fe29ffb2c.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-389562708", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 389562708, "node_id": "MDEyOklzc3VlQ29tbWVudDM4OTU2MjcwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-16T15:32:12Z", "updated_at": "2018-05-16T15:32:12Z", "author_association": "OWNER", "body": "This is now landed in master, ready for the next release.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-390999055", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 390999055, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MDk5OTA1NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-22T13:54:55Z", "updated_at": "2018-05-22T13:54:55Z", "author_association": "OWNER", "body": "This shipped in Datasette 0.22. Here's my blog post about it: https://simonwillison.net/2018/May/20/datasette-facets/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/255#issuecomment-388784787", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/255", "id": 388784787, "node_id": "MDEyOklzc3VlQ29tbWVudDM4ODc4NDc4Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-14T11:28:05Z", "updated_at": "2018-05-14T11:28:05Z", "author_association": "OWNER", "body": "To decide which facets to suggest: for each column, is the unique value count less than the number of rows matching the current query or is it less than 20 (if we are showing more than 20 rows)?\r\n\r\nMaybe only do this if there are less than ten non-float columns. Or always try for foreign keys and booleans, then if there are none of those try indexed text and integer fields, then finally try non-indexed text and integer fields but only if there are less than ten.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 322477187, "label": "Facets"}, "performed_via_github_app": null}