Skip to content

Commit

Permalink
First QRIS metric, schema and digest builder
Browse files Browse the repository at this point in the history
  • Loading branch information
MattReimer committed Jun 13, 2024
1 parent fb48761 commit 64ef30b
Show file tree
Hide file tree
Showing 4 changed files with 593 additions and 113 deletions.
54 changes: 54 additions & 0 deletions QRiS/metrics/dam_density.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "../qris_metrics.schema.json",
"name": "Dam Density",
"machine_name": "dam_density",
"calculation_name": "count",
"default_level": "METRIC",
"units": "meters",
"description": "The number of dams per square kilometer.",
"definition_url": "https://whatever.com",
"metadata": {},
"metric_params": {
"layers": [
{
"layer_name": "structural_elements_points",
"count_field": "Structure Count",
"layer_type": "point",
"attribute_filter": {
"field_name": "Type",
"values": [
"Dam",
"Dam Complex"
]
}
},
{
"layer_name": "structural_elements_lines",
"attribute_filter": {
"field_name": "Type",
"values": [
"Dam",
"Dam Complex"
]
}
},
{
"layer_name": "structural_elements_areas",
"attribute_filter": {
"field_name": "Type",
"values": [
"Dam",
"Dam Complex"
]
}
}
],
"normalization": "CENTERLINE",
"surfaces": [
{
"surface_name": "dem",
"surface_type": "raster"
}
]
}
}
127 changes: 127 additions & 0 deletions QRiS/qris_metrics.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"name": {
"type": "string"
},
"machine_name": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]{3,}$"
},
"calculation_name": {
"type": "string"
},
"default_level": {
"type": "string",
"enum": ["METRIC", "INDICATOR"]
},
"units": {
"type": "string"
},
"description": {
"type": "string"
},
"definition_url": {
"type": "string",
"format": "uri"
},
"metadata": {
"type": "object"
},
"metric_params": {
"type": "object",
"properties": {
"layers": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"layer_name": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]{3,}$"
},
"usage": {
"type": "string"
},
"count_field": {
"type": "string"
},
"layer_type": {
"type": "string",
"enum": ["point", "line", "polygon"]
},
"attribute_filter": {
"type": "object",
"properties": {
"field_name": {
"type": "string"
},
"values": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"field_name",
"values"
],
"additionalProperties": false
}
},
"required": [
"layer_name"
],
"additionalProperties": false
}
]
},
"surfaces": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"surface_name": {
"type": "string"
},
"surface_type": {
"type": "string",
"enum": ["raster", "vector"]
}
},
"required": [
"surface_name"
],
"additionalProperties": false
}
]
},
"normalization": {
"type": "string",
"enum": ["CENTERLINE"]
}
},
"required": [
"layers"
],
"additionalProperties": false
},
"surfaces": {

}
},
"required": [
"name",
"machine_name",
"calculation_name",
"metric_params"
],
"additionalProperties": false
}
Loading

0 comments on commit 64ef30b

Please sign in to comment.