GithubHelp home page GithubHelp logo

mwater / mwater-visualization Goto Github PK

View Code? Open in Web Editor NEW
3.0 7.0 5.0 20.73 MB

License: GNU Lesser General Public License v3.0

HTML 0.03% JavaScript 49.74% CSS 1.24% TypeScript 48.84% PLpgSQL 0.15%

mwater-visualization's Introduction

mwater-visualization

Requires C3, D3, Bootstrap and Font Awesome

Also requires that server has hexgrid functions (src/maps/Hexgrid Functions.sql)

Expressions

Expressions

Principles

  • In design, things must be valid or null. Design can be incomplete but not invalid
  • After any change design is cleaned before being stored
  • Stored design is always cleaned before being edited or displayed

Quick start

Run npm run watch to start the demo

mwater-visualization's People

Contributors

autio avatar broncha avatar daxfohl avatar grassick avatar jsdelivrbot avatar mbriau avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mwater-visualization's Issues

Finalize schema

  • Include baseTableId in expressions?
  • Use tableId, joinIds, etc. or table, joins?

PHP server for JsonQL

Create a PHP server page that produces SQL from JsonQL. Bonus marks for having it run the resulting SQL on a PostgreSQL connection and return either JSON results or an intelligible error code.

  • Inputs should be the query as JsonQL string + a file on disk that describes the schema. Schema is a list of tables, each with an id and table name. Each also contains a list of columns which are id and sql expression to replace with. This is the whitelist of what to allow queries on. e.g.
[{ id: "table1", sql: "table1", columns: [
  { id: "col1", sql: "{alias}.col1" },
  { id: "col2", sql: "({alias}.col3 + {alias}.col4)" },
  ...
]},
...
]

{alias} is replaced with the current table alias. See SchemaMap.coffee

  • Node code should compile to SQL + parameters, returning both if PHP easily supports parameterized queries, otherwise an SQL string with it all embedded.
  • Check escaping and length limits, so that we don't end up crashing or allowing arbitrary code execution on the server

Add support for count(*)

  • Remove id type

Two problems to solve:

  1. scalar query with joins and aggregate should have no expression (undefined) and aggr set to count. This is to return a scalar of type integer

  2. entire aggregate aesthetic has aggr of count and no expression. This is to do a count(*) as part of a grouping

Can 2) have a type scalar, but with undefined expression? i.e. a) no expression at all (not even a scalar, just undefined) or b) scalar with undefined expr

Investigate printing dashboards and widgets

Printing is done through window.print(). Allow time first for widget to render.

Put widget to render under body in print_xyz div, apply stylesheet:

@media print {
   body {
      visibility: hidden; /* Necessary? */
      margin: 0;
      padding: 0;
    }

   body > * {
    display: none;
   }

   #print_xyz {
     display: block !important;
     visibility: visible;
   }

 }
 #print_xyz {
  display: none;
 }

@page  {
size: 8.5in 11in; 
margin: 0.5in 0.5in 0.5in 0.5in; 
}

Page breaks depend on media. If letter with 0.5in margins, contents are 7.5in by 10in.

So, render with width of minimum 96dpi (7.5*96=720). Page will break at 960px down.

Page break items need to be non-absolute positioned:

.mwater-visualization-page-break {
    width: 100%;
    border-bottom: dashed 1px #AAA;
}

@media print {
    .mwater-visualization-page-break {
        border-bottom: none;
        page-break-after: always;
    }
}

When rendering page breaks in screen, adjust to scale down. If control is 1000px wide, put page break at 1000/7.5*10 px down on screen.

Address react warnings in browser console

libs.js:41864 Warning: Failed propType: Required prop `width` was not specified in `DashboardViewComponent`.
libs.js:41864 Warning: Failed propType: Required prop `width` was not specified in `ChartWidgetComponent`. Check the render method of `DashboardViewComponent`.
libs.js:41864 Warning: Failed propType: Required prop `height` was not specified in `ChartWidgetComponent`. Check the render method of `DashboardViewComponent`.
libs.js:41864 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of DashboardDesignerComponent. See https://fb.me/react-warning-keys for more information.
libs.js:41864 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of DashboardViewComponent. See https://fb.me/react-warning-keys for more information.
libs.js:41864 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of LayeredChartDesignerComponent. See https://fb.me/react-warning-keys for more information.
libs.js:41864 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of LayerDesignerComponent. See https://fb.me/react-warning-keys for more information.
libs.js:41864 Warning: Failed propType: Invalid prop `frame` supplied to `ScalarExprTreeTreeComponent`, expected a ReactElement. Check the render method of `ScalarExprTreeComponent`.
libs.js:41864 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of ScalarExprTreeTreeComponent. See https://fb.me/react-warning-keys for more information.

Test date rendering, adding binning by year and year/month

Is binning something that's done at expression level? i.e. as part of xExpr of design? Or is it a statistical x-form afterwards (xBin with options of year, year/month, year/month/date for dates and # of bins for decimal/integer)?

We need to build in binning as post-xform for decimal anyway. It would be easiest to do in two phases: get max/min/stdev of the x expression, as filtered. Then determine bins and group by case expression and then map then to known strings.

It makes x categorical if binned and right now, categories are not assembled in strict order when multiple layers are present.

In fact, how can binning be done with multiple layers, as each might have their own ranges? I think we could disallow multiple layers with decimal binning in x-axis?

Can't click on unprotected dug well

in:

{"items":{"fc8d82bc-c485-4bc7-bc6d-b6c351f33813":{"layout":{"x":0,"y":0,"w":12,"h":12},"widget":{"type":"LayeredChart","version":"0.0.0","design":{"type":"pie","layers":[{"xExpr":null,"yExpr":{"type":"scalar","table":"entities.water_point","joins":[],"expr":null},"colorExpr":{"type":"scalar","table":"entities.water_point","joins":[],"expr":{"type":"field","table":"entities.water_point","column":"type"}},"filter":null,"table":"entities.water_point","yAggr":"count"}],"titleText":"Water Points by Type"}}},"34e1f95a-30f5-4d63-b90f-bd3d310db850":{"layout":{"x":12,"y":0,"w":12,"h":12},"widget":{"type":"LayeredChart","version":"0.0.0","design":{"type":"bar","layers":[{"xExpr":{"type":"scalar","table":"entities.water_point","joins":["source_notes"],"expr":{"type":"field","table":"source_notes","column":"status"},"aggr":"last"},"yExpr":{"type":"scalar","table":"entities.water_point","joins":[],"expr":null},"colorExpr":null,"filter":null,"table":"entities.water_point","yAggr":"count"}],"titleText":"Water Points by Status","transpose":true}}}}}

Dragging charts is slow

I've been dragging widgets around and notice that if you drag and then move your mouse in circles or whatever real fast for a while, the border can't keep up and just keeps going around that same path, trailing further and further behind. Sometimes takes a good 15 sec before finally settling into wherever you ended up.

This seems to only occur with chart widgets.

Easy filters on LHS

Without popup, choose:

  • Water type
  • Group
  • Latest E.Coli risk
  • Latest Functionality

Tabs on design pane to clean up?

Basics:

Indicator? Important to use the word.
Basic filters
Download as CSV

Advanced tab: filter list
Customize/Appearance: color, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.