Grafana dashboard: Dashboard Promiedos
Description: Dashboard descriptivo de base de datos de partidos obtenidos de la página Promiedos


{
  "__inputs": [
    {
      "name": "DS_PROMIEDOS-DATABASE",
      "label": "promiedos-database",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "panel",
      "id": "barchart",
      "name": "Bar chart",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.5.2"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "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"
      }
    ]
  },
  "description": "Dashboard descriptivo de base de datos de partidos obtenidos de la página Promiedos",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": true,
  "panels": [
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_PROMIEDOS-DATABASE}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_PROMIEDOS-DATABASE}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select count(*) from \"ochoajuanm/promiedos-database\".partidos",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Partidos almacenados",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_PROMIEDOS-DATABASE}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-BlPu"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMax": -1,
            "axisWidth": -1,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "stepAfter",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 7,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 0,
          "displayName": "Cantidad de partidos",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 13,
        "x": 5,
        "y": 0
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_PROMIEDOS-DATABASE}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select TO_DATE(fecha_partido,'DD-MM-YYYY'), count(*) as cantidad from \"ochoajuanm/promiedos-database\".partidos\ngroup by fecha_partido\norder by fecha_partido",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Partidos por fecha",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_PROMIEDOS-DATABASE}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "torneo"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 211
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "cantidad"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 74
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 5,
        "x": 18,
        "y": 0
      },
      "id": 6,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_PROMIEDOS-DATABASE}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select torneo, count(*) as cantidad from \"ochoajuanm/promiedos-database\".partidos\r\ngroup by torneo\r\norder by cantidad desc",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Partidos por torneo",
      "type": "table"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_PROMIEDOS-DATABASE}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 6,
        "x": 0,
        "y": 6
      },
      "id": 8,
      "options": {
        "displayLabels": [
          "percent",
          "value",
          "name"
        ],
        "legend": {
          "displayMode": "hidden",
          "placement": "right"
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_PROMIEDOS-DATABASE}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "-- Ganadores\nselect case \n\twhen goles_local > goles_visitante then 'Ganó Local'\n\twhen goles_local < goles_visitante then 'Ganó Visitante'\n\twhen goles_local = goles_visitante then 'Empate'\nend as ganador, count(*)\nfrom \"ochoajuanm/promiedos-database\".partidos\ngroup by ganador\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Local o visitante",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_PROMIEDOS-DATABASE}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "custom": {
            "axisGridShow": true,
            "axisLabel": "",
            "axisPlacement": "left",
            "axisSoftMin": 0,
            "fillOpacity": 80,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            }
          },
          "decimals": 0,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 6,
        "y": 6
      },
      "id": 2,
      "options": {
        "barRadius": 0,
        "barWidth": 0.31,
        "colorByField": "torneo",
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "hidden",
          "placement": "bottom"
        },
        "orientation": "horizontal",
        "showValue": "auto",
        "stacking": "none",
        "text": {
          "valueSize": 3
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        },
        "xField": "ganador",
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "8.5.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_PROMIEDOS-DATABASE}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "--Máximo ganador por liga\nselect h.ganador, h.torneo, h.partidos_ganados from (\n\tselect row_number() over(partition by t.torneo order by t.partidos_ganados desc) as max_ganadores,\n\t\t\tt.torneo,\n\t\t\tt.ganador,\n\t\t\tt.partidos_ganados from (\n\t\t\tselect * from \n\t\t\t\t(select g.torneo, case\n\t\t\t\t\t\twhen g.goles_local > g.goles_visitante then g.equipo_local\n\t\t\t\t\t\twhen g.goles_local < g.goles_visitante then g.equipo_visitante\n\t\t\t\t\t\twhen g.goles_local = g.goles_visitante then 'Empate'\n\t\t\t\t\tend as ganador,\n\t\t\t\t\t\tcount(*) as partidos_ganados\n\t\t\t\t\tfrom \"ochoajuanm/promiedos-database\".partidos g\n\t\t\t\t\tgroup by g.torneo, ganador\n\t\t\t\t\torder by partidos_ganados, g.torneo desc) lg\n\t\t\twhere lg.ganador <> 'Empate') t) h\nwhere h.max_ganadores = 1\norder by h.torneo\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Máximos ganadores por torneo",
      "type": "barchart"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2022-05-09T00:00:00.000Z",
    "to": "2022-05-26T00:00:00.000Z"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Dashboard Promiedos",
  "uid": "OWjDW3unk",
  "version": 5,
  "weekStart": "",
  "gnetId": 16344
}