Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2b575b5
get_files_bulk.m api
Xinyu-Cheng May 22, 2024
03cdfcb
edit the upload_to_NDI_cloud to upload zip files.
Xinyu-Cheng May 29, 2024
528a39b
new test code for upload/download
stevevanhooser May 30, 2024
8672ee1
upload_download
stevevanhooser May 30, 2024
421b9cc
with more debugging
stevevanhooser May 31, 2024
181470a
made sure temporary zip file has a unique name
stevevanhooser May 31, 2024
8eba9c9
adding routine to upload a dataset that includes getting the dataset_id
stevevanhooser May 31, 2024
2c034d1
created the readExistingMetadata
Xinyu-Cheng May 22, 2024
f16bc07
Did not finish converting the subjects.
Xinyu-Cheng May 28, 2024
c063ead
basic strain converting.
Xinyu-Cheng Jun 4, 2024
72707c5
readExistingMetadata can read from dataset.
Xinyu-Cheng Jun 7, 2024
7e489d3
Update StrainForm.mlapp
ehennestad Jun 17, 2024
9bca036
Update StrainForm.mlapp
ehennestad Jun 17, 2024
9263a31
Remove prototypes for metadata editor
ehennestad Jun 17, 2024
65a4b55
finish Metadata app data long-term storage
Xinyu-Cheng Jun 20, 2024
55649fa
Merge pull request #279 from VH-Lab/metadata_storage
stevevanhooser Jun 23, 2024
dd9b18d
Merge pull request #277 from VH-Lab/fix-strain-form
stevevanhooser Jun 23, 2024
c30d16c
Merge pull request #278 from VH-Lab/remove-app-folder
stevevanhooser Jun 23, 2024
cc936d9
fixed bugs in metadata long-term storage.
Xinyu-Cheng Jun 28, 2024
6d5380e
reorganization...new categories MetadataEditorApp, metadata_ds_core, …
stevevanhooser Jul 1, 2024
71ca5d7
reorganization more..cleaning up ndi.cloud folder
stevevanhooser Jul 1, 2024
1b0b821
working on uploading now
stevevanhooser Jul 7, 2024
a023916
Merge branch 'main_june23' into api_work
stevevanhooser Jul 7, 2024
5b6cf10
merge api_work
stevevanhooser Jul 7, 2024
8a5703e
Merge pull request #286 from VH-Lab/api_work
stevevanhooser Jul 7, 2024
47ff798
uploading/downloading works, small bug fixes in metadata app
stevevanhooser Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions +ndi/+cloud/+api/+datasets/get_files_bulk.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function [status, response, url] = get_files_bulk(dataset_id)
%GET_FILES_BULK - get an upload URL for all file that will be published to the NDI Cloud
%
% [STATUS,RESPONSE,URL] = ndi.cloud.api.datasets.GET_FILES_BULK(DATASET_ID)
%
% Inputs:
% DATASET_ID - a string representing the id of the dataset
%
% Outputs:
% STATUS - did get request work? 1 for no, 0 for yes
% RESPONSE - the get request summary
% URL - the upload URL to PUT the file to
%
[auth_token, ~] = ndi.cloud.uilogin();

url = matlab.net.URI(ndi.cloud.api.url('get_files_bulk', 'dataset_id', dataset_id));

method = matlab.net.http.RequestMethod.GET;

acceptField = matlab.net.http.HeaderField('accept','application/json');
authorizationField = matlab.net.http.HeaderField('Authorization', ['Bearer ' auth_token]);
headers = [acceptField authorizationField];

request = matlab.net.http.RequestMessage(method, headers);
response = send(request, url);
status = 1;
if (response.StatusCode == 200)
status = 0;
url = response.Body.Data.url;
else
error('Failed to run command. %s', response.StatusLine.ReasonPhrase);
end
end

File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions +ndi/+cloud/+api/url.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@
url = strcat(site, 'datasets/', dataset_id, '/documents/', document_id);
elseif (strcmp(type, 'get_dataset_details'))
url = strcat(site, 'datasets/', dataset_id, '/files/', uid, '/detail');
elseif (strcmp(type, 'get_files_bulk'))
url = strcat(site, 'datasets/', dataset_id, '/files/bulk');
end

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
fclose(fid);
end

D = ndi.cloud.fun.make_dataset_from_docs_files(output_path, [output_path filesep '.ndi' filesep 'reference.txt'],...
D = ndi.cloud.down.make_dataset_from_docs_files(output_path, [output_path filesep '.ndi' filesep 'reference.txt'],...
[output_path filesep 'download' filesep 'json'],[output_path filesep 'download' filesep 'files'] );

end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%
% DATASET_PATH is the full path of the dataset to be made.
%
% DATASET_REFERENCE is the full path of the dataset.
% DATASET_REFERENCE is the dataset's reference.
%
% DOC_PATH is the full path of a directory with .json files of ndi.documents.
%
Expand Down
30 changes: 0 additions & 30 deletions +ndi/+cloud/+fun/create_new_dataset.m

This file was deleted.

73 changes: 0 additions & 73 deletions +ndi/+cloud/+fun/load_author_from_cloud.m

This file was deleted.

13 changes: 0 additions & 13 deletions +ndi/+cloud/+fun/load_dataType_from_cloud.m

This file was deleted.

130 changes: 0 additions & 130 deletions +ndi/+cloud/+fun/load_metadata_from_cloud.m

This file was deleted.

11 changes: 0 additions & 11 deletions +ndi/+cloud/+fun/search_id.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
%
% [STATUS, DATASET] = ndi.cloud.CREATE_CLOUD_METADATA_STRUCT(S)
%
% Applies the MetaDataEditorApp data structure to
% a) create a new dataset
% b) add metadata for the dataset to the cloud API
%
% Note: This function does not create any ndi.document representations
% of the metadata, but only edits the metadata in the cloud API.
%
% Inputs:
% S - a struct with the metadata to create
%
Expand Down
26 changes: 26 additions & 0 deletions +ndi/+cloud/+up/new_dataset.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function datasetId = new_dataset(D)
% NEW_DATASET - upload a new dataset to NDI cloud
%
% DATASETID = NEW_DATASET(D)
%
% Upload an ndi.dataset object to NDI Cloud. The DATASETID on
% NDI Cloud is returned.
%

arguments
D (1,1) {mustBeA(D,'ndi.dataset')}
end

% Step 1: Create the dataset record on NDI Cloud and insert the metadata
% Step 1a: Create metadata from the dataset

metadata_structure = ndi.database.metadata_ds_core.ndidataset2metadataeditorstruct(D);

% Step 1b: Create the dataset record on NDI cloud
[status,response,datasetId] = ndi.cloud.up.create_cloud_metadata_struct(metadata_structure);

% Step 2: upload

[b,msg] = ndi.cloud.up.upload_to_NDI_cloud(D,datasetId);


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
[auth_token, organization_id] = ndi.cloud.uilogin();
d = struct('name',test_name);
[status, response, dataset_id] = ndi.cloud.api.datasets.post_organization(d);
[b, msg] = ndi.database.fun.upload_to_NDI_cloud(S, dataset_id);
[b, msg] = ndi.cloud.up.upload_to_NDI_cloud(S, dataset_id);
end

Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@

%%

[B,MSG] = ndi.database.fun.upload_to_NDI_cloud(S, email, password, dataset_id);
[B,MSG] = ndi.cloud.up.upload_to_NDI_cloud(S, email, password, dataset_id);
%%
prefix = [filesep 'Users' filesep 'cxy' filesep 'Documents' filesep 'MATLAB' filesep 'data' filesep '2021-04-01'];
Loading