Skip to content

Commit e439d8e

Browse files
authored
Merge pull request #225 from hubmapconsortium/test-release
v2.0.17 release
2 parents 3b0e1ba + bf644ab commit e439d8e

File tree

6 files changed

+86
-16
lines changed

6 files changed

+86
-16
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.16
1+
2.0.17

bulk-registration/donors-tsv.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Donor Bulk Registration
2+
3+
Donors can be bulk registered by choosing the Bulk Registration -> Donors menu pick in the [Ingest UI](https://ingest.hubmapconsortium.org)
4+
`insert screen shot showing menu`
5+
6+
To register multiple donors at once you'll be asked to upload a tsv file with one row of data per donor to be registered. The tsv file has the following columns:
7+
8+
| Column<br>Name | Required | Neo4j/WS<br>attrib | Description | Validation Rules |
9+
|-------------|----------|----------|-------------|------------------|
10+
| lab_id | no | donor.lab_donor_id | An id used by the lab for this donor. This id can be used when searching for the donor in the Ingest UI | Can be blank or an alpha numeric string less than 1024 characters |
11+
| lab_name | yes | donor.label | A de-identified name used by the lab. This name can be usd when searching for the donor in the Ingest UI | Must be a valid alpha-numeric string greater that 1 and less than 1024 characters |
12+
| selection_protocol | yes | donor.protocol_url | The doi or doi url to the Protocols IO protocol describing the criteria used when selecting this donor, e.g. 10.17504/protocols.io.bjuxknxn or https://dx.doi.org/10.17504/protocols.io.bjuxknxn | A string that matches either of the patterns<br> - `https://dx.doi.org/##.####/protocols.io.*` <br> - `##.####/protocols.io.*` <br> where # is a numeric character and * matches any characters |
13+
| description | no | donor.description | A description of this donor | The field can be empty or contain an alphanumeric string less than 10,000 characters |
14+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lab_id lab_name selection_protocol description
2+
test_dn_01 Test Donor 1 ttps://dx.doi.org/10.17504/protocols.io.bjuxknxn Donor 1, Male aged 87
3+
test_dn_2 Donor 2 ttps://dx.doi.org/10.17504/protocols.io.dkasfkkaadf Liver donor, white female, 65 years old
4+
test donor 3 Donor 3 10.17504/protocols.io.adskfadfadf surgical donor, skin biopsy
5+
test donor 4 10.17504/protocols.io.ajdsjafjsdif
6+
test donor 5 test donor 4 10.17504/protocols.io.kkdjdiudi
7+
test donor 6 fail invalid lab_name 10.17504/protocols.io.zsdfasdfadf
8+
test donor 7 fail invalid protocol 10.A7504/protocols.io.adskfadfadf If this were a real description you'd be finding out some relevant information now
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
source_id lab_id sample_type organ_type sample_protocol description rui_location
2+
bfbcdea6a2b709fd0d3aa71b5a47d924 test_smpl_01 organ br https://dx.doi.org/10.17504/protocols.io.bjuxknxn random sample commet
3+
f083597a5ebb0fae68c17b28bd5b3bc7 test_smpl_01 organ HT https://dx.doi.org/10.17504/protocols.io.bjuxknxn random sample commet
4+
HBM854.MBMF.586 test_sample_2 biopsy https://dx.doi.org/10.17504/protocols.io.dkasfkkaadf another random comment
5+
a0572d23c12e18e963f5404292b3d153 test sample 3 blood 10.17504/protocols.io.adskfadfadf
6+
ff5180d5994eef2526629a710017874f test sample 4 FRESH_TISSUE 10.17504/protocols.io.mjeisdfasdf
7+
2f9522d5462d7cc22a667417c6b80623 test sample 4a fresh_frozen_oct_block 10.17504/protocols.io.zujdiskshjy {"@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084", "@type": "SpatialEntity", "label": "SpatialEntity for Male, Age 21, BMI 21.8", "creator": "Jeff Spraggins", "creator_first_name": "Jeff", "creator_last_name": "Spraggins", "creation_date": "2/12/2020 9:48:13 AM", "ccf_annotations": [], "x_dimension": 23, "y_dimension": 18, "z_dimension": 5, "dimension_units": "millimeter", "placement": {"@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084_placement", "@type": "SpatialPlacement", "target": "http://purl.org/ccf/latest/ccf.owl#VHRightKidney", "placement_date": "2/12/2020 9:48:13 AM", "x_scaling": 1, "y_scaling": 1, "z_scaling": 1, "scaling_units": "ratio", "x_rotation": 0, "y_rotation": 0, "z_rotation": 247.9199981689453, "rotation_order": "XYZ", "rotation_units": "degree", "x_translation": -2.729999542236328, "y_translation": 33.220001220703125, "z_translation": -8.940000534057617, "translation_units": "millimeter"}}
8+
a22c4514e7e40a641d1ea5cdcdb63582 test sample 5 fail invalid organ type fresh_frozen_oct_block LV 10.17504/protocols.io.kkdjdiudi
9+
HBM265.FCRT.233 test sample 6 fail bad organ code organ bad_code 10.17504/protocols.io.zsdfasdfadf
10+
ba906793fcba084898ac24e850d5a964 test sample 7 fail bad protocol fresh_frozen_oct_block 10.A7504/protocols.io.adskfadfadf If this were a real description you'd be finding out some relevant information now
11+
ba5af685d3b266183ec0a903beb0d8dc test-sample-8-missing organ code organ 10.17504/protocols.io.adsdududys
12+
HBM446.VBGG.933 test-sample-9-missing sample_type 10.17504/protocols.io.dsfsdadf
13+
75870f9e402e3ac841f1ec78c290bbc9 test-sample-10-bad sample_type zzyx 10.17504/protocols.io.ajdsjafjsdif
14+
HBX222.1234.938 test-sample-11-misformatted id gdna 10.17504/protocols.io.idsafasdfad
15+
test-sample-12 fail missing id 10.17504/protocols.io.hfiwkwsdad
16+
ffd96a39274136284f5x66c7730a4d98 test-sample-13-misformatted id gdna 10.17504/protocols.io.owjwsodffs
17+
6b955ebeafe9c351831bc36aa086575f test-sample-14 fail incorrect source type gdna 10.17504/protocols.io.siaskasfadsf
18+
75f837c40c1248e9d53cecf049dc88a6 test-sample-15 fail incorrect source type2 organ RK 10.17504/protocols.io.fiadsfiasdfadf
19+
fail test_sample_16 missing protocol biopsy
20+
1222af1638d9bc176f393710cc8b2ebf fail test sample-16 invalid rui json fresh_frozen_oct_block 10.17504/protocols.io.ifjoijrlksfsdf { "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084", "@type": "SpatialEntity", "label": "SpatialEntity for Male, Age 21, BMI 21.8", "creator": "Jeff Spraggins", "creator_first_name": "Jeff", "creator_last_name": "Spraggins", "creation_date": "2/12/2020 9:48:13 AM", "ccf_annotations": [], "x_dimension": 23, "y_dimension": 18, "z_dimension": 5, "dimension_units": "millimeter", "placement": {"@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084_placement", "@type": "SpatialPlacement", "target": "http://purl.org/ccf/latest/ccf.owl#VHRightKidney", "placement_date": "2/12/2020 9:48:13 AM", "x_scaling": 1, "y_scaling": 1, "z_scaling": 1, "scaling_units": "ratio", "x_rotation": 0, "y_rotation": 0, "z_rotation": 247.9199981689453, "rotation_order": "XYZ", "rotation_units": "degree", "x_translation": -2.729999542236328, "y_translation": 33.220001220703125, "z_translation": -8.940000534057617, "translation_units": "millimeter"}}"
21+
0cf6c31efb7463eb036d474369dfec11 fail test sample-17 organ with RUI info organ LK 10.17504/protocols.io.yeuiwwerwe {"@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084", "@type": "SpatialEntity", "label": "SpatialEntity for Male, Age 21, BMI 21.8", "creator": "Jeff Spraggins", "creator_first_name": "Jeff", "creator_last_name": "Spraggins", "creation_date": "2/12/2020 9:48:13 AM", "ccf_annotations": [], "x_dimension": 23, "y_dimension": 18, "z_dimension": 5, "dimension_units": "millimeter", "placement": {"@context": "https://hubmapconsortium.github.io/hubmap-ontology/ccf-context.jsonld", "@id": "http://purl.org/ccf/0.5/c62cd431-dd48-4c1b-9c7b-ca4a683fe084_placement", "@type": "SpatialPlacement", "target": "http://purl.org/ccf/latest/ccf.owl#VHRightKidney", "placement_date": "2/12/2020 9:48:13 AM", "x_scaling": 1, "y_scaling": 1, "z_scaling": 1, "scaling_units": "ratio", "x_rotation": 0, "y_rotation": 0, "z_rotation": 247.9199981689453, "rotation_order": "XYZ", "rotation_units": "degree", "x_translation": -2.729999542236328, "y_translation": 33.220001220703125, "z_translation": -8.940000534057617, "translation_units": "millimeter"}}

bulk-registration/samples-tsv.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Sample Donor Registration
2+
3+
(Tissue) Samples can be bulk registered by choosing the Bulk Registration -> Samples menu pick in the [Ingest UI](https://ingest.hubmapconsortium.org)
4+
`insert screen shot showing menu`
5+
6+
To register multiple samples at once you'll be asked to upload a tsv file with one row of data per donor to be registered. The tsv file has the following columns:
7+
8+
| Column<br>Name | Required | entity-api<br>attrib | Description | Validation Rules |
9+
|-------------|----------|----------|-------------|------------------|
10+
| source_id | yes | sample.direct_ancestor_uuid | The id of the source/parent of the new sample, can be a UUID, HuBMAP ID or HuBMAP Sample ID per [this](https://portal.hubmapconsortium.org/docs/apis) | - This is required and should fit the format of a hubmap uuid, hubmap id, or hubmap submission id<br> - should be checked against the uuid-api for existance<br> - if sample_type == organ it must point to a donor<br> - if sample_type != organ it must point to a sample<br> -If rui_location is not blank cannot be the id of a donor |
11+
| lab_id | yes | sample.lab_tissue_sample_id |An id used by the lab for this sample. This id can be used when searching for the donor in the Ingest UI | Must be an alpha numeric string less than 1024 characters |
12+
| sample_type | yes | specimen.specimen_type | The code specifying the type of sample | -Must be a code listed in the [tissue sample types file](https://github.com/hubmapconsortium/search-api/blob/master/src/search-schema/data/definitions/enums/tissue_sample_types.yaml) via case insensitive compare<br> -If rui_location is not blank cannot be 'organ' |
13+
| organ_type | maybe | specimen.organ | The code specifying the type of organ that the sample is | -if sample_type == organ must be a code from the [organ types file](https://github.com/hubmapconsortium/search-api/blob/master/src/search-schema/data/definitions/enums/organ_types.yaml) via case insensitive compare <br> -if sample_type != organ must be empty |
14+
| sample_protocol | yes | sample.protocol_url | The doi or doi url to the Protocols IO protocol describing how the sample was procured, e.g. 10.17504/protocols.io.bjuxknxn or https://dx.doi.org/10.17504/protocols.io.bjuxknxn | A string that matches either of the patterns<br> - `https://dx.doi.org/##.####/protocols.io.*` <br> - `##.####/protocols.io.*` <br> where # is a numeric character and * matches any characters |
15+
| description | no | sample.description | A description of this sample | The field can be empty or contain an alphanumeric string less than 10,000 characters |
16+
| rui_location | no | sample.rui_location | The json output from the RUI location registration interface. Must not include any line breaks. | - Can be blan <br> - If not blank must be a valid json string |

src/app.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,32 @@ def get_entity_by_id(id):
358358
# On entity retrieval, the 'on_read_trigger' doesn't really need a token
359359
complete_dict = schema_manager.get_complete_entity_result(token, entity_dict)
360360

361-
# Additional handlings to make sure only public accessible info gets returned for Dataset
362-
# A Dataset entity is published doesn't ensure its revisions are also published
363-
if (normalized_entity_type == 'Dataset') and (entity_dict['status'].lower() == DATASET_STATUS_PUBLISHED):
364-
# The `next_revision_uuid` and `previous_revision_uuid` are only availabe in complete_dict
365-
# since they are generated by the 'on_read_trigger' methods
366-
# Remove the properties from response if they are not published
367-
properties_to_pop = ['next_revision_uuid', 'previous_revision_uuid']
368-
369-
for prop in properties_to_pop:
370-
if prop in complete_dict:
371-
revision_entity_dict = query_target_entity(complete_dict[prop], token)
372-
# Remove the property from the resulting complete_dict
373-
# if the revision is not also published
374-
if revision_entity_dict['status'].lower() != DATASET_STATUS_PUBLISHED:
375-
complete_dict.pop(prop)
361+
# Additional handlings on dataset revisions
362+
# The rule is that a revision can only be made against a published dataset,
363+
# so it should never occur that a consortium level revision is between two published revisions
364+
# However, the very last dataset revision can be non-published
365+
if normalized_entity_type == 'Dataset':
366+
# The `next_revision_uuid` is only availabe in complete_dict because it's generated by the 'on_read_trigger'
367+
property_to_pop = 'next_revision_uuid'
368+
369+
# When the dataset is published but:
370+
# - The nexus token is valid but the user doesn't belong to HuBMAP-READ group
371+
# - Or the token is valid but doesn't contain group information (auth token or transfer token)
372+
# We need to remove the `next_revision_uuid` from response
373+
# Otherwise, we should send back the `next_revision_uuid` (if exists) when the member belongs to HuBMAP-Read group
374+
if entity_dict['status'].lower() == DATASET_STATUS_PUBLISHED:
375+
if not user_in_hubmap_read_group(request):
376+
if property_to_pop in complete_dict:
377+
revision_entity_dict = query_target_entity(complete_dict[property_to_pop], token)
378+
# Remove the property from the resulting complete_dict
379+
# if the revision is not published
380+
if revision_entity_dict['status'].lower() != DATASET_STATUS_PUBLISHED:
381+
complete_dict.pop(property_to_pop)
382+
# Non-published dataset can NOT have next revisions
383+
else:
384+
if property_to_pop in complete_dict:
385+
# Remove the `next_revision_uuid` from response if it ever exists
386+
complete_dict.pop(property_to_pop)
376387

377388
# Also normalize the result based on schema
378389
final_result = schema_manager.normalize_entity_result_for_response(complete_dict)

0 commit comments

Comments
 (0)