@@ -64,10 +64,10 @@ def load_json_file(filename: str) -> dict:
6464 "instrument" ,
6565 "procedures" ,
6666 "processing" ,
67+ "quality_control" ,
6768 "rig" ,
6869 "session" ,
6970 "subject" ,
70- "mri_session" ,
7171 ]
7272 cls .example_core_files = example_core_files
7373 example_pages = load_json_file ("example_pages_response.json" )
@@ -187,7 +187,7 @@ def test__log_message_false(self, mock_log: MagicMock):
187187 def test_compute_md5_hash (self ):
188188 """Tests compute_md5_hash method"""
189189 md5_hash = compute_md5_hash (json .dumps (self .example_metadata_nd ))
190- self .assertEqual ("e6dd2b7ab819f7a0fc21dba512a4071b " , md5_hash )
190+ self .assertEqual ("275d922d2a1e547f2e0f35b5cc54f493 " , md5_hash )
191191
192192 def test_is_dict_corrupt (self ):
193193 """Tests is_dict_corrupt method"""
@@ -746,6 +746,7 @@ def test_build_metadata_record_from_prefix(
746746 "e_tag" : '"f4827f025e79bafeb6947e14c4e3b51a"' ,
747747 "version_id" : "jWWT0Xrb8_nE9t5C.nTlLElpYJoURbv_" ,
748748 },
749+ "ecephys_642478_2023-01-17_13-56-29/quality_control.json" : None ,
749750 "ecephys_642478_2023-01-17_13-56-29/rig.json" : None ,
750751 "ecephys_642478_2023-01-17_13-56-29/session.json" : None ,
751752 "ecephys_642478_2023-01-17_13-56-29/subject.json" : {
@@ -755,7 +756,6 @@ def test_build_metadata_record_from_prefix(
755756 "e_tag" : '"92734946c64fc87408ef79e5e92937bc"' ,
756757 "version_id" : "XS0p7m6wWNTHG_F3P76D7AUXtE23BakR" ,
757758 },
758- "ecephys_642478_2023-01-17_13-56-29/mri_session.json" : None ,
759759 }
760760 mock_download_json_file .side_effect = [
761761 self .example_processing ,
@@ -811,10 +811,10 @@ def test_build_metadata_record_from_prefix_with_optional_fields(
811811 "ecephys_642478_2023-01-17_13-56-29/instrument.json" : None ,
812812 "ecephys_642478_2023-01-17_13-56-29/procedures.json" : None ,
813813 "ecephys_642478_2023-01-17_13-56-29/processing.json" : None ,
814+ "ecephys_642478_2023-01-17_13-56-29/quality_control.json" : None ,
814815 "ecephys_642478_2023-01-17_13-56-29/rig.json" : None ,
815816 "ecephys_642478_2023-01-17_13-56-29/session.json" : None ,
816817 "ecephys_642478_2023-01-17_13-56-29/subject.json" : None ,
817- "ecephys_642478_2023-01-17_13-56-29/mri_session.json" : None ,
818818 }
819819 # noinspection PyTypeChecker
820820 md = json .loads (
@@ -824,15 +824,15 @@ def test_build_metadata_record_from_prefix_with_optional_fields(
824824 s3_client = mock_s3_client ,
825825 optional_name = "ecephys_642478_2023-01-17_13-56-29" ,
826826 optional_created = datetime (2020 , 1 , 2 , 3 , 4 , 5 ),
827- optional_external_links = [ {"Code Ocean" : "123-456" }] ,
827+ optional_external_links = {"Code Ocean" : [ "123-456" ]} ,
828828 )
829829 )
830830 mock_get_dict_of_file_info .assert_called_once ()
831831 mock_download_json_file .assert_not_called ()
832832 self .assertEqual ("s3://code-ocean-bucket/abc-123" , md ["location" ])
833833 self .assertEqual ("ecephys_642478_2023-01-17_13-56-29" , md ["name" ])
834834 self .assertEqual ("2020-01-02T03:04:05" , md ["created" ])
835- self .assertEqual ([ {"Code Ocean" : "123-456" }] , md ["external_links" ])
835+ self .assertEqual ({"Code Ocean" : [ "123-456" ]} , md ["external_links" ])
836836
837837 @patch ("aind_data_asset_indexer.utils.Metadata.model_construct" )
838838 @patch ("boto3.client" )
@@ -859,6 +859,7 @@ def test_build_metadata_record_from_prefix_error(
859859 "e_tag" : '"f4827f025e79bafeb6947e14c4e3b51a"' ,
860860 "version_id" : "jWWT0Xrb8_nE9t5C.nTlLElpYJoURbv_" ,
861861 },
862+ "ecephys_642478_2023-01-17_13-56-29/quality_control.json" : None ,
862863 "ecephys_642478_2023-01-17_13-56-29/rig.json" : None ,
863864 "ecephys_642478_2023-01-17_13-56-29/session.json" : None ,
864865 "ecephys_642478_2023-01-17_13-56-29/subject.json" : {
@@ -868,7 +869,6 @@ def test_build_metadata_record_from_prefix_error(
868869 "e_tag" : '"92734946c64fc87408ef79e5e92937bc"' ,
869870 "version_id" : "XS0p7m6wWNTHG_F3P76D7AUXtE23BakR" ,
870871 },
871- "ecephys_642478_2023-01-17_13-56-29/mri_session.json" : None ,
872872 }
873873 mock_download_json_file .side_effect = [
874874 self .example_processing ,
@@ -949,6 +949,7 @@ def test_sync_core_json_files(
949949 "e_tag" : f'"{ md5_hash_processing_unchanged } "' ,
950950 "version_id" : "jWWT0Xrb8_nE9t5C.nTlLElpYJoURbv_" ,
951951 },
952+ f"{ pfx } /quality_control.json" : None ,
952953 f"{ pfx } /rig.json" : {
953954 "last_modified" : datetime (
954955 2023 , 11 , 4 , 1 , 13 , 41 , tzinfo = timezone .utc
@@ -964,7 +965,6 @@ def test_sync_core_json_files(
964965 "e_tag" : f'"{ md5_hash_subject_unchanged } "' ,
965966 "version_id" : "XS0p7m6wWNTHG_F3P76D7AUXtE23BakR" ,
966967 },
967- f"{ pfx } /mri_session.json" : None ,
968968 }
969969 mock_upload_core_record .return_value = "mock_upload_response"
970970 mock_s3_client .delete_object .return_value = "mock_delete_response"
@@ -1020,6 +1020,10 @@ def test_sync_core_json_files(
10201020 f"processing is up-to-date in { s3_loc } /processing.json. "
10211021 "Skipping."
10221022 ),
1023+ (
1024+ f"quality_control not found in metadata.nd.json for { pfx } nor "
1025+ f"in { s3_loc } /quality_control.json! Skipping."
1026+ ),
10231027 (
10241028 f"rig not found in metadata.nd.json for { pfx } but { s3_loc } /"
10251029 "rig.json exists! Deleting."
@@ -1030,10 +1034,6 @@ def test_sync_core_json_files(
10301034 f"{ s3_loc } /session.json! Skipping."
10311035 ),
10321036 f"subject is up-to-date in { s3_loc } /subject.json. Skipping." ,
1033- (
1034- f"mri_session not found in metadata.nd.json for { pfx } nor in "
1035- f"{ s3_loc } /mri_session.json! Skipping."
1036- ),
10371037 ]
10381038 actual_log_messages = [
10391039 c [1 ]["message" ] for c in mock_log_message .call_args_list
@@ -1072,6 +1072,7 @@ def test_cond_copy_then_sync_core_json_files(
10721072 "e_tag" : '"7ebb961de9e9b00accfd1358e4561ec1"' ,
10731073 "version_id" : "jWWT0Xrb8_nE9t5C.nTlLElpYJoURbv_" ,
10741074 },
1075+ f"{ pfx } /quality_control.json" : None ,
10751076 f"{ pfx } /rig.json" : None ,
10761077 f"{ pfx } /session.json" : None ,
10771078 f"{ pfx } /subject.json" : {
@@ -1081,7 +1082,6 @@ def test_cond_copy_then_sync_core_json_files(
10811082 "e_tag" : '"8b8cd50a6cf1f3f667be98a69db2ad89"' ,
10821083 "version_id" : "XS0p7m6wWNTHG_F3P76D7AUXtE23BakR" ,
10831084 },
1084- f"{ pfx } /mri_session.json" : None ,
10851085 }
10861086 cond_copy_then_sync_core_json_files (
10871087 metadata_json = json .dumps (self .example_metadata_nd ),
@@ -1164,6 +1164,7 @@ def test_cond_copy_then_sync_core_json_files_mismatch(
11641164 "e_tag" : '"7ebb961de9e9b00accfd1358e4561ec1"' ,
11651165 "version_id" : "jWWT0Xrb8_nE9t5C.nTlLElpYJoURbv_" ,
11661166 },
1167+ f"{ pfx } /quality_control.json" : None ,
11671168 f"{ pfx } /rig.json" : {
11681169 "last_modified" : datetime (
11691170 2022 , 5 , 5 , 1 , 13 , 41 , tzinfo = timezone .utc
@@ -1179,7 +1180,6 @@ def test_cond_copy_then_sync_core_json_files_mismatch(
11791180 "e_tag" : '"8b8cd50a6cf1f3f667be98a69db2ad89"' ,
11801181 "version_id" : "XS0p7m6wWNTHG_F3P76D7AUXtE23BakR" ,
11811182 },
1182- f"{ pfx } /mri_session.json" : None ,
11831183 }
11841184
11851185 cond_copy_then_sync_core_json_files (
@@ -1436,7 +1436,7 @@ def test_get_all_processed_codeocean_asset_records(
14361436 2024 , 6 , 12 , 21 , 21 , 28 , tzinfo = timezone .utc
14371437 ),
14381438 "external_links" : {
1439- "Code Ocean" : "11ee1e1e-11e1-1111-1111-e11eeeee1e11"
1439+ "Code Ocean" : [ "11ee1e1e-11e1-1111-1111-e11eeeee1e11" ]
14401440 },
14411441 },
14421442 "s3://some_co_bucket/666666cc-66cc-6c66-666c-6c66c6666666" : {
@@ -1451,7 +1451,7 @@ def test_get_all_processed_codeocean_asset_records(
14511451 2024 , 6 , 12 , 19 , 45 , 59 , tzinfo = timezone .utc
14521452 ),
14531453 "external_links" : {
1454- "Code Ocean" : "666666cc-66cc-6c66-666c-6c66c6666666"
1454+ "Code Ocean" : [ "666666cc-66cc-6c66-666c-6c66c6666666" ]
14551455 },
14561456 },
14571457 }
0 commit comments