Skip to content

Commit

Permalink
simplify serializer changes?
Browse files Browse the repository at this point in the history
  • Loading branch information
shapiromatron committed Sep 21, 2023
1 parent f57868e commit b52535d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 8 deletions.
2 changes: 0 additions & 2 deletions client/hawc_client/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def create_datapivot(self, data: dict) -> dict:
presented. This setting may used for comparing
percent-response, where dose-units are not needed, or for
creating one plot similar, but not identical, dose-units.
- published_only (bool): Only present data from studies marked as "published" in HAWC.
- published (bool): datapivot is published for public view
- settings (str): JSON of object settings
- assessment (int): assessment ID
Expand Down Expand Up @@ -138,7 +137,6 @@ def update_datapivot(self, datapivot_id: int, data: dict) -> dict:
presented. This setting may used for comparing
percent-response, where dose-units are not needed, or for
creating one plot similar, but not identical, dose-units.
- published_only (bool): Only present data from studies marked as "published" in HAWC.
- published (bool): datapivot is published for public view
- settings (str): JSON of object settings
- assessment (int): assessment ID
Expand Down
6 changes: 0 additions & 6 deletions hawc/apps/summary/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class DataPivotSerializer(serializers.ModelSerializer):
url = serializers.CharField(source="get_absolute_url", read_only=True)
data_url = serializers.CharField(source="get_data_url", read_only=True)
download_url = serializers.CharField(source="get_download_url", read_only=True)
settings = serializers.JSONField()

def to_representation(self, instance):
ret = super().to_representation(instance)
Expand Down Expand Up @@ -56,11 +55,6 @@ class Meta:


class VisualSerializer(serializers.ModelSerializer):
url = serializers.CharField(source="get_absolute_url", read_only=True)
data_url = serializers.CharField(source="get_data_url", read_only=True)
slug = serializers.CharField(write_only=True)
prefilters = serializers.JSONField(write_only=True)

def validate(self, data):
try:
data["prefilters"] = (
Expand Down
2 changes: 2 additions & 0 deletions tests/data/api/api-visual-bioassay-aggregation.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@
],
"id": 10,
"last_updated": "2020-11-25T13:35:00.094667-05:00",
"prefilters": {},
"published": true,
"settings": {},
"slug": "bioassay-aggregation",
"sort_order": "short_citation",
"studies": [],
"title": "bioassay-aggregation",
Expand Down
4 changes: 4 additions & 0 deletions tests/data/api/api-visual-crossview.json
Original file line number Diff line number Diff line change
Expand Up @@ -3247,6 +3247,9 @@
],
"id": 4,
"last_updated": "2020-05-08T15:37:19.255730-04:00",
"prefilters": {
"published_only": true
},
"published": true,
"settings": {
"colorBase": "#cccccc",
Expand Down Expand Up @@ -3328,6 +3331,7 @@
"ylabel_x": 0,
"ylabel_y": 0
},
"slug": "crossview",
"sort_order": "short_citation",
"studies": [],
"title": "crossview",
Expand Down
2 changes: 2 additions & 0 deletions tests/data/api/api-visual-embedded-tableau.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"endpoints": [],
"id": 7,
"last_updated": "2020-05-08T15:45:29.985848-04:00",
"prefilters": {},
"published": true,
"settings": {
"external_url": "https://public.tableau.com/views/Iris_15675445278420/Iris-Actual",
Expand All @@ -20,6 +21,7 @@
],
"filters": []
},
"slug": "embedded-tableau",
"sort_order": "short_citation",
"studies": [],
"title": "embedded-tableau",
Expand Down
2 changes: 2 additions & 0 deletions tests/data/api/api-visual-exploratory-heatmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"endpoints": [],
"id": 8,
"last_updated": "2020-11-25T09:29:33.991892-05:00",
"prefilters": {},
"published": true,
"settings": {
"autorotate_tick_labels": true,
Expand Down Expand Up @@ -118,6 +119,7 @@
},
"y_tick_rotate": -90
},
"slug": "exploratory-heatmap",
"sort_order": "short_citation",
"studies": [],
"title": "exploratory-heatmap",
Expand Down
6 changes: 6 additions & 0 deletions tests/data/api/api-visual-rob-barchart.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"endpoints": [],
"id": 5,
"last_updated": "2020-05-08T15:38:48.445082-04:00",
"prefilters": {
"studies": [
7
]
},
"published": true,
"rob_settings": {
"assessment_id": 2,
Expand Down Expand Up @@ -189,6 +194,7 @@
"xAxisLabel": "Percent of studies",
"yAxisLabel": ""
},
"slug": "rob-barchart",
"sort_order": "short_citation",
"studies": [
{
Expand Down
6 changes: 6 additions & 0 deletions tests/data/api/api-visual-rob-heatmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"endpoints": [],
"id": 3,
"last_updated": "2020-05-08T15:36:41.324440-04:00",
"prefilters": {
"studies": [
7
]
},
"published": true,
"rob_settings": {
"assessment_id": 2,
Expand Down Expand Up @@ -191,6 +196,7 @@
"x_field": "study",
"yAxisLabel": ""
},
"slug": "rob-heatmap",
"sort_order": "short_citation",
"studies": [
{
Expand Down
2 changes: 2 additions & 0 deletions tests/data/api/api-visual-tagtree.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"endpoints": [],
"id": 6,
"last_updated": "2020-05-08T15:43:09.448621-04:00",
"prefilters": {},
"published": true,
"settings": {
"height": 500,
Expand All @@ -20,6 +21,7 @@
"show_legend": true,
"width": 1280
},
"slug": "tagtree",
"sort_order": "short_citation",
"studies": [],
"title": "tagtree",
Expand Down

0 comments on commit b52535d

Please sign in to comment.