Parse geographies to json
parse_tojson_geographies.Rd
Create a json query sub-string based on location constraints
Examples
parse_tojson_geographies(c("NAT", "REG")) |>
cat()
#> {
#> "or": [
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "NAT"
#> }
#> }
#> ]
#> },
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "REG"
#> }
#> }
#> ]
#> }
#> ]
#> }
parse_tojson_geographies(c("NAT|id|dP0Zw", "REG|id|rg3Nj")) |>
cat()
#> {
#> "or": [
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "NAT"
#> }
#> },
#> {
#> "locations": {
#> "in": [
#> {
#> "level": "NAT",
#> "id": "dP0Zw"
#> }
#> ]
#> }
#> }
#> ]
#> },
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "REG"
#> }
#> },
#> {
#> "locations": {
#> "in": [
#> {
#> "level": "REG",
#> "id": "rg3Nj"
#> }
#> ]
#> }
#> }
#> ]
#> }
#> ]
#> }
parse_tojson_geographies(c("NAT|id|dP0Zw", "REG")) |>
cat()
#> {
#> "or": [
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "NAT"
#> }
#> },
#> {
#> "locations": {
#> "in": [
#> {
#> "level": "NAT",
#> "id": "dP0Zw"
#> }
#> ]
#> }
#> }
#> ]
#> },
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "REG"
#> }
#> }
#> ]
#> }
#> ]
#> }
parse_tojson_geographies(c("NAT|id|dP0Zw", "REG")) |>
cat()
#> {
#> "or": [
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "NAT"
#> }
#> },
#> {
#> "locations": {
#> "in": [
#> {
#> "level": "NAT",
#> "id": "dP0Zw"
#> }
#> ]
#> }
#> }
#> ]
#> },
#> {
#> "and": [
#> {
#> "geographicLevels": {
#> "eq": "REG"
#> }
#> }
#> ]
#> }
#> ]
#> }