-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from bento-platform/features/katsu-config
feat: project and dataset scoped discovery config
- Loading branch information
Showing
38 changed files
with
1,251 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.2.11 on 2024-04-24 14:10 | ||
|
||
import chord_metadata_service.restapi.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('chord', '0007_v7_0_0'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='dataset', | ||
name='discovery', | ||
field=models.JSONField(blank=True, help_text='Discovery configuration', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': '/chord_metadata_service/discovery/discovery', 'additionalProperties': False, 'description': 'Discovery configuration for public fields/search', 'properties': {'fields': {'$id': '/chord_metadata_service/discovery/discovery_named_fields', 'additionalProperties': False, 'description': 'Intermediate schema, enforces field schema with flexible names.', 'patternProperties': {'^.*$': {'$id': '/chord_metadata_service/discovery/discovery_field', 'additionalProperties': False, 'description': 'Field configuration', 'properties': {'config': {'properties': {'bin_size': {'type': 'number'}, 'bins': {'items': {'type': 'number'}, 'type': 'array'}, 'enum': {'oneOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}]}, 'maximum': {'type': 'number'}, 'minimum': {'type': 'number'}, 'taper_left': {'type': 'number'}, 'taper_right': {'type': 'number'}, 'units': {'type': 'string'}}, 'type': 'object'}, 'datatype': {'enum': ['number', 'string', 'date'], 'type': 'string'}, 'description': {'type': 'string'}, 'group_by': {'type': 'string'}, 'group_by_value': {'type': 'string'}, 'mapping': {'type': 'string'}, 'mapping_for_search_filter': {'type': 'string'}, 'title': {'type': 'string'}, 'value_mapping': {'type': 'string'}}, 'type': 'object'}}, 'type': 'object'}, 'overview': {'description': 'List of overview sections', 'items': {'$id': '/chord_metadata_service/discovery/discovery_overview', 'additionalProperties': False, 'description': 'An overview section containing charts', 'properties': {'charts': {'items': {'$id': '/chord_metadata_service/discovery/discovery_overview_chart', 'additionalProperties': False, 'description': 'Associates a field name with a chart type for overview display', 'properties': {'chart_type': {'enum': ['bar', 'pie'], 'type': 'string'}, 'field': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}, 'section_title': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}, 'rules': {'properties': {'count_threshold': {'type': 'integer'}, 'max_query_parameters': {'type': 'integer'}}, 'type': 'object'}, 'search': {'items': {'$id': '/chord_metadata_service/discovery/discovery_search', 'additionalProperties': False, 'description': 'Groups search fields by section.', 'properties': {'fields': {'items': {'type': 'string'}, 'type': 'array'}, 'section_title': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}}, 'type': 'object'}, formats=None)]), | ||
), | ||
migrations.AddField( | ||
model_name='project', | ||
name='discovery', | ||
field=models.JSONField(blank=True, help_text='Discovery configuration', null=True, validators=[chord_metadata_service.restapi.validators.JsonSchemaValidator({'$id': '/chord_metadata_service/discovery/discovery', 'additionalProperties': False, 'description': 'Discovery configuration for public fields/search', 'properties': {'fields': {'$id': '/chord_metadata_service/discovery/discovery_named_fields', 'additionalProperties': False, 'description': 'Intermediate schema, enforces field schema with flexible names.', 'patternProperties': {'^.*$': {'$id': '/chord_metadata_service/discovery/discovery_field', 'additionalProperties': False, 'description': 'Field configuration', 'properties': {'config': {'properties': {'bin_size': {'type': 'number'}, 'bins': {'items': {'type': 'number'}, 'type': 'array'}, 'enum': {'oneOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}]}, 'maximum': {'type': 'number'}, 'minimum': {'type': 'number'}, 'taper_left': {'type': 'number'}, 'taper_right': {'type': 'number'}, 'units': {'type': 'string'}}, 'type': 'object'}, 'datatype': {'enum': ['number', 'string', 'date'], 'type': 'string'}, 'description': {'type': 'string'}, 'group_by': {'type': 'string'}, 'group_by_value': {'type': 'string'}, 'mapping': {'type': 'string'}, 'mapping_for_search_filter': {'type': 'string'}, 'title': {'type': 'string'}, 'value_mapping': {'type': 'string'}}, 'type': 'object'}}, 'type': 'object'}, 'overview': {'description': 'List of overview sections', 'items': {'$id': '/chord_metadata_service/discovery/discovery_overview', 'additionalProperties': False, 'description': 'An overview section containing charts', 'properties': {'charts': {'items': {'$id': '/chord_metadata_service/discovery/discovery_overview_chart', 'additionalProperties': False, 'description': 'Associates a field name with a chart type for overview display', 'properties': {'chart_type': {'enum': ['bar', 'pie'], 'type': 'string'}, 'field': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}, 'section_title': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}, 'rules': {'properties': {'count_threshold': {'type': 'integer'}, 'max_query_parameters': {'type': 'integer'}}, 'type': 'object'}, 'search': {'items': {'$id': '/chord_metadata_service/discovery/discovery_search', 'additionalProperties': False, 'description': 'Groups search fields by section.', 'properties': {'fields': {'items': {'type': 'string'}, 'type': 'array'}, 'section_title': {'type': 'string'}}, 'type': 'object'}, 'type': 'array'}}, 'type': 'object'}, formats=None)]), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
__all__ = [ | ||
"DiscoveryConfigException" | ||
] | ||
|
||
|
||
class DiscoveryConfigException(Exception): | ||
|
||
def __init__(self, dataset_id: str | None = None, project_id: str | None = None, *args: object) -> None: | ||
self.dataset_id = dataset_id | ||
self.project_id = project_id | ||
|
||
message = "Error retrieving {0} scoped discovery config: {0} {1} does not exist." | ||
if dataset_id and project_id: | ||
message = message.format("project-dataset", f"({project_id}, {dataset_id}) pair") | ||
elif dataset_id: | ||
message = message.format("dataset", dataset_id) | ||
elif project_id: | ||
message = message.format("project", project_id) | ||
self.message = {"message": message} | ||
|
||
super().__init__(*args) |
Oops, something went wrong.