Skip to content

Commit

Permalink
Add json schema for releases (#847)
Browse files Browse the repository at this point in the history
* In process for #812

* for #812

* #812 schema
  • Loading branch information
raprasad authored Sep 7, 2023
1 parent 5e90877 commit 09daeb2
Show file tree
Hide file tree
Showing 28 changed files with 2,064 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ server/release-files/*
server/scripts_dev/dv_test_creds.py
.env
!server/opendp_apps/banner_messages/fixtures/*.json
!server/opendp_apps/banner_messages/fixtures/*.json
!server/opendp_apps/release_schemas/fixtures/*.json
!server/opendp_apps/release_schemas/schemas/*.json
!server/opendp_apps/release_schemas/testing/schema_examples/*.json
!server/opendp_apps/dataverses/fixtures/*.json
!server/opendp_apps/profiler/fixtures/*.json
!server/opendp_apps/profiler/testing/test_files/*
Expand Down
1 change: 1 addition & 0 deletions server/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ python /code/server/manage.py loaddata opendp_apps/dataverses/fixtures/terms.jso
python /code/server/manage.py loaddata opendp_apps/dataverses/fixtures/test_dataverses_01.json
# python /code/server/manage.py loaddata opendp_apps/dataverses/fixtures/test_user_emailaddress.json
python /code/server/manage.py loaddata opendp_apps/banner_messages/fixtures/*.json
python /code/server/manage.py loaddata opendp_apps/release_schemas/fixtures/*.json
# opendp_apps/banner_messages/fixtures/*.json
# opendp_apps/dataset/fixtures/*.json
exec "$@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ def setUp(self):
epsilon=0.25,
expiration_date=self.expiration_date_str)
# print(json.dumps(self.working_plan_info, indent=4))

Large diffs are not rendered by default.

Empty file.
38 changes: 38 additions & 0 deletions server/opendp_apps/release_schemas/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Register your models here.
from django.contrib import admin

from opendp_apps.release_schemas.forms import ReleaseInfoSchemaForm
from opendp_apps.release_schemas.models import ReleaseInfoSchema


class ReleaseInfoSchemaAdmin(admin.ModelAdmin):
form = ReleaseInfoSchemaForm
save_on_top = True
search_fields = ('title',)
list_filter = ('is_published',)
list_display = ('version',
'title',
'is_published',
'description',
'updated',
'created',)
readonly_fields = ('title',
'sortable_version',
'schema_link',
'id_link',
'schema_display',
'created',
'updated',)
fields = ['version',
'title',
'is_published',
'schema',
'description',
'schema_link',
'id_link',
'schema_display',
'created',
'updated', ]


admin.site.register(ReleaseInfoSchema, ReleaseInfoSchemaAdmin)
6 changes: 6 additions & 0 deletions server/opendp_apps/release_schemas/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ReleaseSchemasConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'opendp_apps.release_schemas'
317 changes: 317 additions & 0 deletions server/opendp_apps/release_schemas/fixtures/schema_fixture_v0-2-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
[
{
"model": "release_schemas.releaseinfoschema",
"pk": 2,
"fields": {
"created": "2023-09-05T17:40:56.186Z",
"updated": "2023-09-06T18:25:39.620Z",
"object_id": "6e8c338a-00a9-4d68-9cad-ab55f4cb20c6",
"version": "0.2.0",
"title": "OpenDP - DP Creator Schema 0.2.0",
"description": "",
"is_published": true,
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://localhost:8000/api/schema/0.2.0/",
"version": "0.2.0",
"title": "OpenDP - DP Creator Schema 0.2.0",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"created": {
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"human_readable": {
"type": "string"
},
"human_readable_date_only": {
"type": "string"
}
},
"required": [
"iso",
"human_readable",
"human_readable_date_only"
]
},
"application": {
"type": "string"
},
"application_url": {
"type": "string"
},
"differentially_private_library": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"name",
"url",
"version"
]
},
"dataset": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"fileFormat": {
"type": "string"
},
"creator": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"email": {
"type": "string"
}
},
"required": [
"first_name",
"last_name",
"email"
]
},
"upload_date": {
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"human_readable": {
"type": "string"
},
"human_readable_date_only": {
"type": "string"
}
},
"required": [
"iso",
"human_readable",
"human_readable_date_only"
]
}
},
"required": [
"type",
"name",
"fileFormat",
"creator",
"upload_date"
]
},
"setup_questions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"question_num": {
"type": "number"
},
"text": {
"type": "string"
},
"attribute": {
"type": "string"
},
"answer": {
"type": "string"
},
"context": {
"type": "string"
},
"longAnswer": {
"type": "string"
},
"privacy_params": {
"type": "object",
"properties": {
"epsilon": {
"type": "number"
},
"delta": {
"type": "number"
}
},
"required": [
"epsilon",
"delta"
]
}
},
"required": [
"question_num",
"text",
"attribute",
"answer",
"context"
]
}
},
"statistics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"statistic": {
"type": "string"
},
"variable": {
"type": "string"
},
"variable_type": {
"type": "string"
},
"result": {
"type": "object",
"properties": {
"value": {}
},
"required": [
"value"
]
},
"noise_mechanism": {
"type": "string"
},
"epsilon": {
"type": "number"
},
"delta": {},
"boolean_values": {
"type": "object",
"properties": {
"true_value": {
"type": "number"
},
"false_value": {
"type": "number"
}
},
"required": [
"true_value",
"false_value"
]
},
"missing_value_handling": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"fixed_value": {}
},
"required": [
"type",
"fixed_value"
]
},
"confidence_level": {
"type": "number"
},
"confidence_level_alpha": {
"type": "number"
},
"accuracy": {
"type": "object",
"properties": {
"value": {
"type": "number"
},
"message": {
"type": "string"
}
},
"required": [
"value",
"message"
]
},
"description": {
"type": "object",
"properties": {
"html": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"html",
"text"
]
},
"bounds": {
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
}
},
"required": [
"min",
"max"
]
}
},
"required": [
"statistic",
"variable",
"variable_type",
"result",
"noise_mechanism",
"epsilon",
"delta",
"missing_value_handling",
"confidence_level",
"confidence_level_alpha",
"accuracy",
"description"
]
}
}
},
"required": [
"name",
"created",
"application",
"application_url",
"differentially_private_library",
"dataset",
"setup_questions",
"statistics"
]
},
"schema_link": "https://json-schema.org/draft/2020-12/schema",
"id_link": "http://localhost:8000/api/schema/0.2.0/",
"sortable_version": "v-0000-0002-0000"
}
}
]
Loading

0 comments on commit 09daeb2

Please sign in to comment.