You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user_guide.rst
+70-26Lines changed: 70 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,10 +58,15 @@ Uploading non-image media types
58
58
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
59
60
60
If you wish to upload subjects with non-image media (e.g. audio or video),
61
-
you will need to make sure you have the ``libmagic`` library installed. If you
62
-
don't already have ``libmagic``, please see the `dependency information for
63
-
python-magic <https://github.com/ahupp/python-magic#dependencies>`_ for more
64
-
details.
61
+
it is desirable to have the ``libmagic`` library installed for type detection.
62
+
If you don't already have ``libmagic``, please see the `dependency information
63
+
for python-magic <https://github.com/ahupp/python-magic#installation>`_ for
64
+
more details.
65
+
66
+
If `libmagic` is not installed, assignment of MIME types (e.g., image/jpeg,
67
+
video/mp4, text/plain, application/json, etc) will be based on file extensions.
68
+
Be aware that if file names and extension aren't accurate, this could lead to
69
+
issues when the media is loaded.
65
70
66
71
Usage Examples
67
72
--------------
@@ -414,58 +419,97 @@ You can also pass an optional `new_subject_set_name` parameter and this would be
414
419
415
420
Project(project_id).copy(new_subject_set_name='My New Subject Set')
416
421
417
-
Programmatic Data Exports
418
-
~~~~~~~~~~~~~~~~~~~~~~~~~
422
+
Data Exports
423
+
~~~~~~~~~~~~
419
424
The Panoptes Python Client allows you to generate, describe, and download data exports (e.g., classifications, subjects, workflows) via the Python ``panoptes_client`` library.
420
425
421
-
Multiple types of exports can be generated using the Python Client, including project-level products (classifications, subjects, workflows) as smaller scale classification exports (for workflows and subject sets).
426
+
Multiple types of exports can be generated using the Python Client, including project-level products (classifications, subjects, workflows) and smaller scale classification exports (for workflows and subject sets).
422
427
For the examples below, we will demonstrate commands for a project wide classifications export, but these functions work for any export type.
423
428
424
429
**Get Exports**
425
430
426
-
As the name implies, this method downloads a data export over HTTP. This uses the `get_export` method and can be called by passing in the following parameters::
431
+
As the name implies, this method downloads a data export over HTTP. This uses the `get_export` method and can be called by passing in the following parameters:
427
432
428
-
export_type #string specifying which type of export should be downloaded
433
+
* *export_type*: string specifying which type of export should be downloaded.
434
+
* *generate*: a boolean specifying whether to generate a new export and wait for it to be ready, or to just download the latest existing export. Default is False.
435
+
* *wait*: a boolean specifying whether to wait for an in-progress export to finish, if there is one. Has no effect if `generate` is true (wait will occur in this case). Default is False.
436
+
* *wait_timeout*: the number of seconds to wait if `wait` is True or `generate` is True. Has no effect if `wait` and `generate` are both False. Default is None (wait indefinetly).
429
437
430
-
generate #a boolean specifying if to generate a new export and wait for it to be ready, or to just download the latest existing export
438
+
Examples::
431
439
432
-
wait #a boolean specifying whether to wait for an in-progress export to finish, if there is one. Has no effect if generate is true.
The returned Response object has two additional attributes as a convenience for working with the CSV content; `csv_reader` and `csv_dictreader`, which are wrappers for `csv.reader()` and `csv.DictReader` respectively.
439
450
These wrappers take care of correctly decoding the export content for the CSV parser::
for row in classification_export.csv_dictreader():
443
-
print(row)
454
+
print(row)
444
455
445
456
**Generate Exports**
446
457
447
458
As the name implies, this method generates/starts a data export. This uses the `generate_export` method and can be called by passing in the `export_type` parameter::
This kick off the export generation process and returns `export_info` as a dictionary containing the metadata on the selected export.
450
463
451
-
This would return `export_info` as a dictionary containing the metadata on the selected export
464
+
**Describing Exports**
452
465
453
-
**Wait Exports**
466
+
This method fetches information/metadata about a specific type of export. This uses the `describe_export` method and can be called by passing the `export_type` (e.g., classifications, subjects) this way::
454
467
455
-
As the name implies, this method blocks/waits until an in-progress export is ready. It uses the `wait_export` method and can be called passing the following parameters::
As mentioned above, it is possible to request a classifications export for project, workflow, or subject set scope.
476
+
For the subject set classification export, classifications are included in the export if they satisfy two selection criteria:
462
477
463
-
This would return `export_info` as a dictionary containing the metadata on the selected export and throw a `PanoptesAPIException` once the time limit is exceeded and the export is not ready
478
+
1. The subject referenced in the classification is a member of the relevant subject set.
479
+
2. The relevant subject set is currently linked to the workflow referenced in the classification.
464
480
465
-
**Describing Exports**
481
+
Example Usage::
482
+
483
+
# For a SubjectSet, check which Workflows to which it is currently linked
The Zooniverse supports research teams by maintaining the ``panoptes_aggregation`` Python package
495
+
(see `docs <https://aggregation-caesar.zooniverse.org/docs>`_ and `repo <https://github.com/zooniverse/aggregation-for-caesar>`_).
496
+
This software requires local installation to run, which can be a deterrent for its use.
497
+
As an alternative to installing and running this aggregation code, we provide a Zooniverse-hosted service for producing aggregated results for simple datasets.
498
+
This "batch aggregation" feature is built to perform simple workflow-level data aggregation that uses baseline extractors and reducers without any custom configuration.
499
+
Please see :py:meth:`.Workflow.run_aggregation` and :py:meth:`.Workflow.get_batch_aggregation_links` docstrings for full details.
500
+
501
+
Example Usage::
502
+
503
+
# Generate input data exports: workflow-level classification export and project-level workflows export
504
+
Workflow(1234).generate_export('classification')
505
+
Project(2345).generate_export('workflows')
466
506
467
-
This method fetches information/metadata about a specific type of export. This uses the `describe_export` method and can be called by passing in the export_type(classifications, subject_sets) this way::
2. aggregation: a ZIP file containing all inputs (workflow-level classification export, project-level workflows export) and outputs (extracts, reductions)
0 commit comments