SPATIAL-Lab / spatial-group-demo

0 stars 0 forks source link

multi_download.php #12

Closed bumbanian closed 7 years ago

bumbanian commented 7 years ago

Please develop a second download tool for downloading data from multiple sites. This will be triggered by a UI request that sends the same query information as for site_download.php EXCEPT that no Site_ID will be given. The query should run against the database, using the same WHERE criteria as site_download, and produce 2 files:

data file - same content and structure as the file produced by the site_download.php query, with the addition that "Project_ID" should also be reported on each row

project file - contains all rows from the "Projects" table, except "Proprietary", for each Project_ID that appears in the data file.

These should be returned directly to the UI or packaged as a .zip or the like and returned, whatever is easier.

Thanks and let me know if anything here is unclear!

HuanUU commented 7 years ago

New protocol is available. Please take a look.

Thanks, Chonghuan

Return a .zip file containing data file and project file Request: [Post] /multi_download.php Note: This requires user's query. If some parameter is not applicable, make its value as null. { "latitude" : { "Min" : DOUBLE, "Max" : DOUBLE }, "longitude" : { "Min" : DOUBLE, "Max" : DOUBLE }, "elevation" : { "Min" : DOUBLE, "Max" : DOUBLE }, "countries" : [ { "Country" : STRING }, ... ], "states" : [ { "State" : STRING }, ... ], "collection_date": { "Min" : STRING, (format: "yyyy-MM-dd" ) "Max" : STRING (format: "yyyy-MM-dd" ) }, "types" : [ { "Type" : STRING }, ... ], "h2" : null or 1, "o18" : null or 1 }

Response: { "status": { "Code" : INT, "Message" : STRING }, "filePath": STRING }

The data file (csv) - contains the following information from the sites, samples, and water_isotope_data tables:

Site_Name Latitude Longitude Elevation Sample_ID Type Start_Date Start_Time Collection_Date Collection_Time Phase Depth_meters d2H d18O d2H_Analytical_SD d18O_Analytical_SD WI_Analysis_Source Project_ID WHERE Samples.Sample_Ignore = 0 AND Water_Isotope_Data.WI_Analysis_Ignore = 0 AND Projects.Proprietary = 0

project file - contains all rows from the "Projects" table, except "Proprietary", for each Project_ID that appears in the data file.

End

bumbanian commented 7 years ago

Great, thanks! Karan - can you try to implement this on the front end? Should just need to set it up to submit and to download the .zip produced (sorry, just saw that part!)