← All procedures

generators.tupleCoverage

This function gives the coverage of some rows over named dimensions, with the strength `t` (the default is 2). A row holds a combination when it has each of its values. The function compares the values as text with `String`, and it ignores the fields of a row that are not dimensions. With fewer dimensions than `t`, the combinations are those of all the dimensions. Thus no dimensions give one empty combination, with the key `""`.

CLI
Package
@procedures/generators · README
Path
["generators","tupleCoverage"]
CLI
mark generators tupleCoverage --rows <object[]> --dimensions <object>
As data
{"$proc":["generators","tupleCoverage"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/generators/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["generators","tupleCoverage"], { rows: [], dimensions: {} });
console.log(JSON.stringify(result));

From the command line

$ mark generators tupleCoverage --rows <object[]> --dimensions <object>

As data, in a program

{
  "$proc": ["generators", "tupleCoverage"],
  "input": { "rows": [], "dimensions": {} }
}

Input

FieldTypeRequiredDefaultDescription
rowsobject[]yes
dimensionsobjectyes
strengthnumberno

Output

FieldTypeRequiredDefaultDescription
tuplesnumberyesThe count of the combinations of `t` values of `t` different dimensions.
coverednumberyesThe count of the combinations that one row or more holds.
sharenumberyes`covered` divided by `tuples`. Dimensions with no combination give 1.
missingstring[]yesThe combinations that no row holds, as `<dimension>=<value>&<dimension>=<value>`, in the order of the dimensions.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "rows": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {},
          "additionalProperties": {}
        }
      },
      "dimensions": {
        "type": "object",
        "properties": {},
        "additionalProperties": {
          "type": "array",
          "items": {}
        }
      },
      "strength": {
        "type": "number"
      }
    },
    "required": [
      "rows",
      "dimensions"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "tuples": {
        "type": "number",
        "description": "The count of the combinations of `t` values of `t` different dimensions."
      },
      "covered": {
        "type": "number",
        "description": "The count of the combinations that one row or more holds."
      },
      "share": {
        "type": "number",
        "description": "`covered` divided by `tuples`. Dimensions with no combination give 1."
      },
      "missing": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The combinations that no row holds, as `<dimension>=<value>&<dimension>=<value>`, in the order of the dimensions."
      }
    },
    "required": [
      "tuples",
      "covered",
      "share",
      "missing"
    ],
    "additionalProperties": {}
  }
}