From 850047b2ac7c1500ccca638c61405f4b0318d209 Mon Sep 17 00:00:00 2001 From: tramyn Date: Mon, 26 Oct 2020 09:32:25 -0700 Subject: [PATCH 1/3] fix control table to correctly return list when parsing timepoints --- intent_parser/table/controls_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intent_parser/table/controls_table.py b/intent_parser/table/controls_table.py index 74805cbb..257c3dd7 100644 --- a/intent_parser/table/controls_table.py +++ b/intent_parser/table/controls_table.py @@ -132,7 +132,7 @@ def _process_timepoint(self, cell, control): timepoint = {dc_constants.VALUE: float(value_unit[dc_constants.VALUE]), dc_constants.UNIT: value_unit[dc_constants.UNIT]} result.append(timepoint) - control.add_field(dc_constants.TIMEPOINTS, timepoint) + control.add_field(dc_constants.TIMEPOINTS, result) except TableException as err: message = 'Controls table has invalid %s value: %s' % (intent_parser_constants.HEADER_CONTROL_TYPE_VALUE, err.get_message()) self._validation_errors.append(message) From d788144ddab73c336b4ec159dc2d70b845befdc9 Mon Sep 17 00:00:00 2001 From: tramyn Date: Mon, 26 Oct 2020 10:23:00 -0700 Subject: [PATCH 2/3] update golden files --- .../mock_data/YeastSTATES 1.0 Growth Curves Request.json | 2 +- .../mock_data/YeastSTATES 1.0 Time Series Round 1.json | 8 +++++++- intent_parser/tests/test_golden_files.py | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json index 6af81e1f..fdfaddf3 100644 --- a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json +++ b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json @@ -446,4 +446,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json index e0df56f4..032c0f22 100644 --- a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json +++ b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json @@ -7,6 +7,10 @@ "experiment_version": 1, "lab": "Transcriptic", "name": "YeastSTATES 1.0 Time Series Round 1", + "overnight_growth": { + "unit": "hour", + "value": 16.0 + }, "parameters": [ { "incubation_info.shaking": "high_speed", @@ -28,6 +32,8 @@ } ], "parent_git_path": "https://gitlab.sd2e.org/sd2program/cp-request/blob/master/input/structured_requests/YeastSTATES 1.0 Time Series Round 1.json", + "protocol": "TimeSeriesHTP", + "recovery_loops": [], "runs": [ { "measurements": [ @@ -1237,4 +1243,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/intent_parser/tests/test_golden_files.py b/intent_parser/tests/test_golden_files.py index f1f88778..74b8a922 100644 --- a/intent_parser/tests/test_golden_files.py +++ b/intent_parser/tests/test_golden_files.py @@ -4,6 +4,7 @@ from datetime import datetime from unittest.mock import patch import intent_parser.constants.intent_parser_constants as intent_parser_constants +import intent_parser.constants.google_api_constants as google_constants import intent_parser.utils.intent_parser_utils as intent_parser_utils import os import json @@ -61,8 +62,8 @@ def _compare_structured_requests(self, document): doc_revision_id = golden_structured_request['doc_revision_id'] - upload_mimetype = intent_parser_constants.GOOGLE_DOC_MIMETYPE - download_mimetype = intent_parser_constants.WORD_DOC_MIMETYPE + upload_mimetype = google_constants.GOOGLE_DOC_MIMETYPE + download_mimetype = google_constants.WORD_DOC_MIMETYPE response = self.drive_accessor.get_file_with_revision(doc_id, doc_revision_id, download_mimetype) From 90b8ef4d4a4b2e57e6f06ba893874e5dd4d0d974 Mon Sep 17 00:00:00 2001 From: tramyn Date: Mon, 26 Oct 2020 14:28:38 -0700 Subject: [PATCH 3/3] update golden files --- ...YeastSTATES 1.0 Growth Curves Request.json | 2 +- .../YeastSTATES 1.0 Time Series Round 1.json | 146 +++++++++++++++--- intent_parser/tests/test_controls_table.py | 2 +- 3 files changed, 123 insertions(+), 27 deletions(-) diff --git a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json index fdfaddf3..aff16afe 100644 --- a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json +++ b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Growth Curves Request.json @@ -1,6 +1,6 @@ { "challenge_problem": "YEAST_STATES", - "doc_revision_id": "357", + "doc_revision_id": "570", "experiment_id": "experiment.transcriptic.2020-05-04-YeastSTATES-1-0-Growth-Curves", "experiment_reference": "YeastSTATES-1-0-Growth-Curves", "experiment_reference_url": "https://docs.google.com/document/d/1fFcxyJyheMrzSsVoSsO6v7qHJKFf_0heIFtqEur02cg", diff --git a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json index 032c0f22..e9aeb0d3 100644 --- a/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json +++ b/intent_parser/tests/data/mock_data/YeastSTATES 1.0 Time Series Round 1.json @@ -1,6 +1,6 @@ { "challenge_problem": "YEAST_STATES", - "doc_revision_id": "442", + "doc_revision_id": "975", "experiment_id": "experiment.transcriptic.2020-07-10-YeastSTATES-1-0-Time-Series-Round-1", "experiment_reference": "YeastSTATES-1-0-Time-Series-Round-1", "experiment_reference_url": "https://docs.google.com/document/d/1Mba6kqDila4W32Z46NEqXZFx868A3O36I9GIVOvMQ70", @@ -81,7 +81,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -101,7 +105,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -121,7 +129,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -141,7 +153,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -162,7 +178,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -183,7 +203,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -204,7 +228,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -225,7 +253,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -326,7 +358,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -346,7 +382,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -366,7 +406,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -386,7 +430,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -407,7 +455,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -428,7 +480,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -449,7 +505,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -470,7 +530,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -931,7 +995,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -951,7 +1019,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -971,7 +1043,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -991,7 +1067,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/W303/1" + { + "lab_id": "name.transcriptic.W303", + "label": "W303", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/W303/1" + } ], "timepoints": [ { @@ -1012,7 +1092,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -1033,7 +1117,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -1054,7 +1142,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { @@ -1075,7 +1167,11 @@ } ], "strains": [ - "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + { + "lab_id": "name.transcriptic.UWBF_6390", + "label": "UWBF_6390", + "sbh_uri": "https://hub.sd2e.org/user/sd2e/design/UWBF_6390/1" + } ], "timepoints": [ { diff --git a/intent_parser/tests/test_controls_table.py b/intent_parser/tests/test_controls_table.py index 486a6e98..b2c33a4c 100644 --- a/intent_parser/tests/test_controls_table.py +++ b/intent_parser/tests/test_controls_table.py @@ -91,7 +91,7 @@ def test_table_with_1_timepoint(self): self.assertEqual(1, len(control_result)) timepoint = control_result[0][dc_constants.TIMEPOINTS] expected_timepoint = {dc_constants.VALUE: 8.0, dc_constants.UNIT: 'hour'} - self.assertEqual(timepoint, expected_timepoint) + self.assertEqual(expected_timepoint, timepoint[0]) def test_strains_with_uris(self): ip_table = test_utils.create_fake_controls_table()