Total serology test numbers

API

Dataset does not exist, or view access to it is not allowed.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "url": "https://datagraphics.dckube.scilifelab.se/api/dataset/d2a2477324314e8783edaf40622b911c.csv"
  },
  "transform": [
    {
      "calculate": "if(datum.class === 'R&D', 'R&D*', datum.class)",
      "as": "classUpdated"
    },
    {
      "calculate": "if(datum.class === 'positive', datum.count, 0)",
      "as": "onlyPositive"
    },
    {
      "calculate": "if(datum.class === 'negative', datum.count, 0)",
      "as": "onlyNegative"
    },
    {
      "joinaggregate": [
        {
          "op": "sum",
          "field": "onlyPositive",
          "as": "onlyPositiveSum"
        },
        {
          "op": "sum",
          "field": "onlyNegative",
          "as": "onlyNegativeSum"
        }
      ]
    },
    {
      "calculate": "datum.onlyPositiveSum/((datum.onlyPositiveSum+datum.onlyNegativeSum)/100)",
      "as": "frPos"
    }
  ],
  "hconcat": [
    {
      "width": 500,
      "height": 60,
      "title": "Total number of tests",
      "encoding": {
        "y": {
          "field": "classUpdated",
          "axis": {
            "title": null
          },
          "type": "nominal",
          "sort": [
            "positive",
            "negative",
            "R&D*"
          ]
        },
        "x": {
          "field": "count",
          "aggregate": "sum",
          "type": "quantitative",
          "title": null,
          "scale": {
            "padding": 10
          }
        },
        "color": {
          "field": "classUpdated",
          "legend": null,
          "type": "nominal",
          "scale": {
            "domain": [
              "negative",
              "positive",
              "R&D*"
            ],
            "range": [
              "#8fd7f9",
              "#ef9292",
              "#c7c7c7"
            ]
          }
        }
      },
      "layer": [
        {
          "mark": {
            "type": "bar"
          }
        },
        {
          "mark": {
            "type": "text",
            "align": "left",
            "baseline": "middle",
            "dx": 3,
            "fill": "black"
          },
          "encoding": {
            "text": {
              "field": "count",
              "aggregate": "sum",
              "type": "quantitative"
            }
          }
        }
      ]
    },
    {
      "title": "Sum total",
      "width": 100,
      "height": 60,
      "mark": {
        "type": "text",
        "baseline": "middle",
        "fontSize": 14,
        "fill": "black"
      },
      "encoding": {
        "text": {
          "field": "count",
          "aggregate": "sum",
          "type": "quantitative"
        }
      }
    },
    {
      "title": "Proportion positive**",
      "width": 100,
      "height": 60,
      "mark": {
        "type": "text",
        "baseline": "middle",
        "fontSize": 14,
        "fill": "black"
      },
      "encoding": {
        "text": {
          "field": "frPos",
          "aggregate": "mean",
          "type": "quantitative",
          "format": ".2f"
        }
      }
    }
  ]
}
Owner: arnold
Modified 2020-11-13T14:49:18.111Z
Created 2020-10-14T14:44:27.056Z

DataGraphics version 0.7.8