measurement per person (1)
measurement per person
{
  "__inputs": [
    {
      "name": "DS_POSTGRESQL-1",
      "label": "PostgreSQL-1",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    },
    {
      "name": "DS_POSTGRESQL",
      "label": "PostgreSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.2"
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL-1}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-BlPu"
          },
          "links": [
            {
              "title": "Details",
              "url": "http://localhost:3000/d/sbhJzpfVk/measurement-per-person-1-copy?orgId=1&var-day=All&var-month=All&var-year=All&var-group=All&var-employee=${__data.fields.fullname}&viewPanel=5"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 18,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "links": [
        {
          "title": "dettagli",
          "url": "http://localhost:3000/d/sbhJzpfVk/measurement-per-person-1-copy?orgId=1&viewPanel=5"
        }
      ],
      "options": {
        "displayMode": "basic",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^count$/",
          "values": true
        },
        "showUnfilled": true,
        "text": {
          "valueSize": 14
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL-1}"
          },
          "decimalSeparator": ".",
          "delimiter": ",",
          "editorMode": "code",
          "format": "table",
          "header": true,
          "ignoreUnknown": false,
          "rawQuery": true,
          "rawSql": "SELECT employee.name || ' ' || employee.surname AS fullname, \r\n       COUNT(DISTINCT timestamp)\r\nFROM measurement, employee, employee_group\r\nWHERE measurement.employeeid = employee.id AND timestamp BETWEEN $__timeFrom() AND $__timeTo()\r\n      AND employee_group.employee_id = employee.id AND employee_group.group_name IN ($group)\r\nGROUP BY employee.name, employee.surname\r\nORDER BY employee.surname \r\n",
          "refId": "A",
          "schema": [
            {
              "name": "",
              "type": "string"
            }
          ],
          "skipRows": 0,
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "measurement per person with date picker",
      "transformations": [
        {
          "disabled": true,
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "field": "count"
              }
            ]
          }
        }
      ],
      "transparent": true,
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL-1}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": true,
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "id": 5,
      "options": {
        "footer": {
          "enablePagination": true,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL-1}"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "select employee.name || ' '|| employee.surname as fullname, date_trunc('minute',measurement.timestamp)as timestamp, CASE WHEN measurement.measurementstatus = 'NOGOOD' then 'HIGH RISK' else 'LOW RISK' END measurementStatus\r\nfrom measurement, employee\r\nwhere measurement.employeeid = employee.id and employee.name ||' '|| employee.surname in ($employee)\r\norder by measurement.timestamp desc",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "raw query",
      "type": "table"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL-1}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-BlPu"
          },
          "links": [
            {
              "title": "Details",
              "url": "http://localhost:3000/d/sbhJzpfVk/measurement-per-person-1-copy?orgId=1&var-day=All&var-month=All&var-year=All&var-group=All&var-employee=${__data.fields.fullname}&viewPanel=5"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 18,
        "w": 24,
        "x": 0,
        "y": 27
      },
      "id": 7,
      "links": [
        {
          "title": "dettagli",
          "url": "http://localhost:3000/d/sbhJzpfVk/measurement-per-person-1-copy?orgId=1&viewPanel=5"
        }
      ],
      "options": {
        "displayMode": "basic",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^count$/",
          "values": true
        },
        "showUnfilled": true,
        "text": {
          "valueSize": 14
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL-1}"
          },
          "decimalSeparator": ".",
          "delimiter": ",",
          "editorMode": "code",
          "format": "table",
          "header": true,
          "ignoreUnknown": false,
          "rawQuery": true,
          "rawSql": "SELECT employee.name || ' ' || employee.surname AS fullname, \r\n       COUNT(DISTINCT timestamp)\r\nFROM measurement, employee, employee_group\r\nWHERE measurement.employeeid = employee.id AND EXTRACT(day from timestamp) in ($day) AND EXTRACT(month from timestamp) in ($month) and EXTRACT(year from timestamp) in ($year)\r\n      AND employee_group.employee_id = employee.id AND employee_group.group_name IN ($group)\r\nGROUP BY employee.name, employee.surname\r\nORDER BY employee.surname \r\n",
          "refId": "A",
          "schema": [
            {
              "name": "",
              "type": "string"
            }
          ],
          "skipRows": 0,
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "measurement per person ",
      "transformations": [
        {
          "disabled": true,
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "field": "count"
              }
            ]
          }
        }
      ],
      "transparent": true,
      "type": "bargauge"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL}"
        },
        "definition": "SELECT \nEXTRACT (day from timestamp) as day\nfrom measurement",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "day",
        "options": [],
        "query": "SELECT \nEXTRACT (day from timestamp) as day\nfrom measurement",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 3,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL}"
        },
        "definition": "SELECT \nEXTRACT (month from timestamp)  as month\nfrom measurement",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "month",
        "options": [],
        "query": "SELECT \nEXTRACT (month from timestamp)  as month\nfrom measurement",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 3,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL}"
        },
        "definition": "SELECT \nEXTRACT(YEAR from timestamp) as year\nfrom measurement",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "year",
        "options": [],
        "query": "SELECT \nEXTRACT(YEAR from timestamp) as year\nfrom measurement",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 3,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL-1}"
        },
        "definition": "SELECT group_of_employees.name\nfrom group_of_employees\n",
        "hide": 0,
        "includeAll": true,
        "multi": false,
        "name": "group",
        "options": [],
        "query": "SELECT group_of_employees.name\nfrom group_of_employees\n",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "postgres",
          "uid": "${DS_POSTGRESQL-1}"
        },
        "definition": "select employee.name || ' ' || employee.surname as fullname\nfrom employee",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "employee",
        "options": [],
        "query": "select employee.name || ' ' || employee.surname as fullname\nfrom employee",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "2019-01-31T22:00:00.000Z",
    "to": "2019-08-31T20:00:00.000Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "measurement per person (1)",
  "uid": "sbhJzpfVk",
  "version": 23,
  "weekStart": "",
  "gnetId": 18789,
  "description": "measurement per person"
}