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/howto/discoveryMetadataTools.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@
3
3
**Table of Contents**
4
4
5
5
-[Overview](#overview)
6
+
-[Export Discovery Metadata into File](#export-discovery-metadata-from-file)
7
+
-[Publish Discovery Metadata from File]()
6
8
-[DOIs in Gen3](#dois-in-gen3-discovery-metadata-and-page-for-visualizing-public-doi-metadata)
7
9
-[dbGaP FHIR Metadata in Gen3 Discovery](#combine-dbgap-fhir-metadata-with-current-discovery-metadata)
8
10
@@ -20,6 +22,48 @@ So you can choose to use the CLI or write your own Python script and use the SDK
20
22
functions yourself. Generally this provides the most flexibility, at less
21
23
of a convenience.
22
24
25
+
### Export Discovery Metadata into File
26
+
Gen3's SDK can be used to export discovery metadata from a certain Gen3 environment into a file by using the `output_expanded_discovery_metadata()` function. By default this function will query for metadata with `guid_type=discovery_metadata` for the dump, and export the metadata into a TSV file. User can also specify a different `guid_type` values for this operation, and/or choose to export the metadata into a JSON file. When using TSV format, some certain fields from metadata will be flattened or "jsonified" so that each metadata record can be fitted into one row.
27
+
28
+
Example of usage:
29
+
```python
30
+
from gen3.tools.metadata.discovery import (
31
+
output_expanded_discovery_metadata,
32
+
)
33
+
from gen3.utils import get_or_create_event_loop_for_thread
Gen3's SDK can also be used to publish discovery metadata onto a target Gen3 environment from a file by using the `publish_discovery_metadata()` function. Ideally the metadata file should be originated from a metadata dump obtained by using the `output_expanded_discovery_metadata()` function.
48
+
49
+
Example of usage:
50
+
```python
51
+
from gen3.tools.metadata.discovery import (
52
+
publish_discovery_metadata,
53
+
)
54
+
from gen3.utils import get_or_create_event_loop_for_thread
Copy file name to clipboardExpand all lines: gen3/cli/discovery.py
+48-9Lines changed: 48 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ def discovery():
23
23
"--default-file",
24
24
"use_default_file",
25
25
is_flag=True,
26
-
help="Publishes {commons}-discovery_metadata.tsv from current directory",
26
+
help="Publishes {commons}-{guid_type}.tsv from current directory",
27
27
show_default=True,
28
28
)
29
29
@click.option(
@@ -43,15 +43,25 @@ def discovery():
43
43
),
44
44
show_default=True,
45
45
)
46
+
@click.option(
47
+
"--guid_field",
48
+
"guid_field",
49
+
help=(
50
+
'The column / field name within the metadata that will be used as GUIDs, if not specified, will try to find a column \ field named "guid" from the metadata.'
51
+
"If that field doesn't exists in a certain metadata record, that record will be skipped from publishing."
0 commit comments