@@ -37,7 +37,7 @@ async def create_artifact_subdirectory(data: CreateArtifactSubdirectoryInput) ->
3737async def search (data : SearchInput ) -> list [str ]:
3838 """
3939 Activity to perform NOMAD search based on the provided input data. The search
40- results are written to a file in the specified format (Parquet or CSV ) in the
40+ results are written to a file in the specified format (Parquet, CSV, or JSON ) in the
4141 artifacts directory.
4242
4343 Args:
@@ -46,24 +46,30 @@ async def search(data: SearchInput) -> list[str]:
4646 Returns:
4747 list[str]: List of the generated output file paths.
4848 """
49- from nomad .search import search
49+ from nomad .search import search as nomad_search
5050
51- from nomad_actions .actions .entries .utils import write_csv_file , write_parquet_file
51+ from nomad_actions .actions .entries .utils import (
52+ write_csv_file ,
53+ write_json_file ,
54+ write_parquet_file ,
55+ )
5256
5357 logger = activity .logger
5458
5559 if data .output_file_type == 'parquet' :
5660 write_dataset_file = write_parquet_file
5761 elif data .output_file_type == 'csv' :
5862 write_dataset_file = write_csv_file
63+ elif data .output_file_type == 'json' :
64+ write_dataset_file = write_json_file
5965 else :
60- raise ValueError ('Unsupported file format. Please use parquet or csv .' )
66+ raise ValueError ('Unsupported file format. Please use parquet, csv, or json .' )
6167
6268 generated_file_paths = []
6369
6470 # first query
6571 search_counter = 1
66- response = search (
72+ response = nomad_search (
6773 user_id = data .user_id ,
6874 owner = data .owner ,
6975 query = data .query ,
@@ -86,7 +92,7 @@ async def search(data: SearchInput) -> list[str]:
8692 # create a copy to preserve the original pagination settings
8793 pagination = data .pagination .model_copy ()
8894 pagination .page_after_value = response .pagination .next_page_after_value
89- response = search (
95+ response = nomad_search (
9096 user_id = data .user_id ,
9197 owner = data .owner ,
9298 query = data .query ,
@@ -111,7 +117,7 @@ async def search(data: SearchInput) -> list[str]:
111117@activity .defn
112118async def consolidate_output_files (data : ConsolidateOutputFilesInput ) -> str :
113119 """
114- Activity to consolidate multiple Parquet or CSV files into a single file.
120+ Activity to consolidate multiple Parquet, CSV, or JSON files into a single file.
115121
116122 Args:
117123 data (ConsolidateOutputFilesInput): Input data for consolidating files.
0 commit comments