Skip to content

Latest commit

 

History

History
403 lines (352 loc) · 9.3 KB

File metadata and controls

403 lines (352 loc) · 9.3 KB

Control Flow 📌🚩👀🦴🦷👁️✨🔔📀💡🔦🔖🏷️✂️⏳📍

Load facet

  1. Reconstitute facets config (IReconstituteConfigService JSON => FacetsConfig).
  2. Load facet content (IFacetLoadService: FacetsConfig => FacetContent)
    1. Remove bogus picks (BogusPickService: FacetsConfig => FacetsConfig)
    2. 📍Locate load content service (TargetFacet.FacetType => IFacetContentService)
    3. Load facet content (IFacetContentService: FacetsConfig => Core.FacetContent)
      1. Compile interval query
        1. Discrete facet:
          1. querySetup = QuerySetupBuilder.Build(facetsConfig, facetsConfig.TargetFacet, null, null);
          2. Interval query = IDiscreteContentSqlCompiler.Compile(querySetup, facetsConfig.TargetFacet, facetsConfig.GetTargetTextFilter())
              SELECT cast({facet.CategoryIdExpr} AS varchar) AS category, {facet.CategoryNameExpr} AS name
              FROM {query.Facet.TargetTable.ResolvedSqlJoinName}
               {query.Joins.Combine("")}
              WHERE 1 = 1
            {"AND ".GlueTo(CategoryNameLike(facet, categoryNameFilter)) }
            {"AND ".GlueTo(query.Criterias.Combine(" AND "))}"
              GROUP BY 1, 2
              {SortBy(facet)}";
        2. Range facet:
              SELECT n::text || ' => ' || (n + {interval})::text, n, n + {interval}
              FROM generate_series({min}, {max}, {interval}) as a(n)
              WHERE n < {max}
      2. Fetch category counts
      3. Fetch outer category counts
      4. Collect user selections/picks
      5. Compile facet content result

FIXME: IIntervalSqlCompiler saknas (olika interface) 📍logic split based on facet type

Category counts: results of compiled interval query Outer category counts: results of compiled interval query (no grouping or additional fields)

Terminology

Concept Description
Filter facet A filter specification.
Target facet A requests main target facet
Aggregate facet
View type
Result specification A specification of result fields.

The request's result configuration data

Item(s) Description Default Impacts Entity
Result facet code Specifies aggregate facet result_facet facet
Result view type Specifies if result is tabular or map map or tabular result_view_type
Specification keys A specification of result fields. (null) result_specification

Notes:

  • Fi
  1. The request specifies the result facet (most often result_facet). 1.
  2. The request contains a view type (e.g. map or tabular) specifying the format of the resulting data.
    1. The view type specifies if the client wabt
  3. The request also contains an optional set of specification keys 1.

URI general format

  • [domain-facet://]target-facet[@trigger-facet]:(facet-code[@picks])(/facet-code[@picks])*

country (no picks)

Trigger: country add

{
  "requestId": 1,
  "requestType": "populate",
  "targetCode": "country",
  "domainCode": "",
  "facetConfigs": [
    { "facetCode": "country", "position": 1, "picks": [] }
  ]
}

country@205

Trigger: country pick value

{
  "facetsConfig": {
    "requestId": 10,
    "requestType": "populate",
    "domainCode": "",
    "targetCode": "country",
    "triggerCode": "country",
    "facetConfigs": [
      {
        "facetCode": "country",
        "position": 1,
        "picks": [{ "pickValue": 205, "text": 205 }]
      }
    ]
  },
  "resultConfig": {
    "requestId": 10,
    "sessionId": "1",
    "viewTypeId": "map",
    "aggregateKeys": ["site_level"]
  }
}

country@205 + sites

Trigger: site add

{
  "requestId": 1,
  "requestType": "populate",
  "targetCode": "sites",
  "triggerCode": "country",
  "domainCode": "",
  "facetConfigs": [
    {
      "facetCode": "country",
      "position": 1,
      "picks": [{ "pickValue": 205, "text": 205 }],
    },
    { "facetCode": "sites", "position": 2, "picks": [] }
  ]
}

country@205 + sites@3826

Trigger: site pick value

{
  "facetsConfig": {
    "requestId": 11,
    "requestType": "populate",
    "domainCode": "",
    "targetCode": "sites",
    "triggerCode": "sites",
    "facetConfigs": [
      {
        "facetCode": "country",
        "position": 1,
        "picks": [{ "pickValue": 205, "text": 205 }],
      },
      {
        "facetCode": "sites",
        "position": 2,
        "picks": [{ "pickValue": 3826, "text": 3826 }],
      }
    ]
  },
  "resultConfig": {
    "requestId": 11,
    "sessionId": "1",
    "viewTypeId": "map",
    "aggregateKeys": ["site_level"]
  }
}

country@205,224 + sites@3826

Trigger (chain): country pick value 224

Facet load [sites]

Should triggerCode actually be country in this case??? TODO: Check usage of triggerCode

{
  "requestId": 2,
  "requestType": "populate",
  "targetCode": "sites",
  "triggerCode": "sites",
  "domainCode": "",
  "facetConfigs": [
    {
      "facetCode": "country",
      "position": 1,
      "picks": [
        { "pickValue": 205, "text": 205 },
        { "pickValue": 224, "text": 224 }
      ]
    },
    {
      "facetCode": "sites",
      "position": 2,
      "picks": [{ "pickValue": 3826, "text": 3826 }]
    }
  ]
}

Result load

{
  "facetsConfig": {
    "requestId": 12,
    "requestType": "populate",
    "domainCode": "",
    "targetCode": "sites",
    "triggerCode": "sites",
    "facetConfigs": [
      {
        "facetCode": "country",
        "position": 1,
        "picks": [
          { "pickValue": 205, "text": 205 },
          { "pickValue": 224, "text": 224 }
        ]
      },
      {
        "facetCode": "sites",
        "position": 2,
        "picks": [{ "pickValue": 3826, "text": 3826 }]
      }
    ]
  },
  "resultConfig": {
    "requestId": 12,
    "sessionId": "1",
    "viewTypeId": "map",
    "aggregateKeys": ["site_level"]
  }
}

country@205,224 + sites@3826,3830

Trigger: site@pick 3830

Facet load [sites]

{
  "facetsConfig": {
    "requestId": 13,
    "requestType": "populate",
    "domainCode": "",
    "targetCode": "sites",
    "triggerCode": "sites",
    "facetConfigs": [
      {
        "facetCode": "country",
        "position": 1,
        "picks": [
          { "pickValue": 205, "text": 205 },
          { "pickValue": 224, "text": 224 }
        ]
      },
      {
        "facetCode": "sites",
        "position": 2,
        "picks": [
          { "pickValue": 3826, "text": 3826 },
          { "pickValue": 3830, "text": 3830 }
        ]
      }
    ]
  },
  "resultConfig": {
    "requestId": 13,
    "sessionId": "1",
    "viewTypeId": "map",
    "aggregateKeys": ["site_level"]
  }
}

country@205,224 + genus@12974,12793,12932 + sites

Trigger: country@pick 224

Facet load #1 [sites]

{
  "requestId": 8,
  "requestType": "populate",
  "targetCode": "sites",
  "triggerCode": "genus",
  "domainCode": "",
  "facetConfigs": [
    {
      "facetCode": "country",
      "position": 1,
      "picks": [
        { "pickValue": 205, "text": 205 },
        { "pickValue": 224, "text": 224 }
      ]
    },
    {
      "facetCode": "genus",
      "position": 2,
      "picks": [
        { "pickValue": 12974, "text": 12974 },
        { "pickValue": 12793, "text": 12793 },
        { "pickValue": 12932, "text": 12932 }
      ]
    },
    { "facetCode": "sites", "position": 3, "picks": [] }
  ]
}

Facet load #2 [genus]

{
  "requestId": 4,
  "requestType": "populate",
  "targetCode": "genus",
  "triggerCode": "genus",
  "domainCode": "",
  "facetConfigs": [
    {
      "facetCode": "country",
      "position": 1,
      "picks": [
        { "pickValue": 205, "text": 205 },
        { "pickValue": 224, "text": 224 }
      ]
    },
    {
      "facetCode": "genus",
      "position": 2,
      "picks": [
        { "pickValue": 12974, "text": 12974 },
        { "pickValue": 12793, "text": 12793 },
        { "pickValue": 12932, "text": 12932 }
      ]
    },
    { "facetCode": "sites", "position": 3, "picks": [] }
  ]
}

Result load

{
  "facetsConfig": {
    "requestId": 23,
    "requestType": "populate",
    "domainCode": "",
    "targetCode": "sites",
    "triggerCode": "sites",
    "facetConfigs": [
      {
        "facetCode": "country",
        "position": 1,
        "picks": [
          { "pickValue": 205, "text": 205 },
          { "pickValue": 224, "text": 224 }
        ]
      },
      {
        "facetCode": "genus",
        "position": 2,
        "picks": [
          { "pickValue": 12974, "text": 12974 },
          { "pickValue": 12793, "text": 12793 },
          { "pickValue": 12932, "text": 12932 }
        ]
      },
      { "facetCode": "sites", "position": 3, "picks": [] }
    ]
  },
  "resultConfig": {
    "requestId": 23,
    "sessionId": "1",
    "viewTypeId": "map",
    "aggregateKeys": ["site_level"]
  }
}

xyz

Trigger: site