Skip to content

Commit

Permalink
Merge pull request #145 from c3g/add-mcode-ingest-tests
Browse files Browse the repository at this point in the history
Add more tests for mcode and fhir ingestion
  • Loading branch information
zxenia committed Jul 9, 2020
2 parents 7706526 + 1b931c7 commit bf25133
Show file tree
Hide file tree
Showing 10 changed files with 171,250 additions and 89 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include chord_metadata_service/chord/workflows/*.wdl
include chord_metadata_service/chord/tests/*.json
include chord_metadata_service/dats/*
include chord_metadata_service/mcode/tests/*.json
include chord_metadata_service/package.cfg
include chord_metadata_service/restapi/tests/*.json
203 changes: 122 additions & 81 deletions chord_metadata_service/chord/tests/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"TEST_FHIR_SEARCH_QUERY",
]


VALID_DATA_USE_1 = {
"consent_code": {
"primary_category": {"code": "GRU"},
Expand All @@ -31,19 +30,16 @@
]
}


VALID_PROJECT_1 = {
"title": "Project 1",
"description": "Some description",
}


VALID_DATS_CREATORS = [
{
"name": "1000 Genomes Project"
}
]

{
"name": "1000 Genomes Project"
}
]

INVALID_DATS_CREATORS = [
{
Expand Down Expand Up @@ -98,82 +94,127 @@ def valid_table_1(dataset_id, model_compatible=False):

def dats_dataset(project_id, creators):
return {
"version": "1.0",
"project": project_id,
"privacy": "public open",
"licenses": [
{
"name": "BY-NC-SA"
}
],
"creators": creators,
"types": [
{
"information": {
"value": "genomics"
}
}
],
"title": "1000 Genomes Project",
"description": "The 1000 Genomes Project provides a comprehensive description of common human variation by "
"applying a combination of whole-genome sequencing, deep exome sequencing and dense microarray "
"genotyping to a diverse set of 2504 individuals from 26 populations. Over 88 million variants "
"are characterised, including >99% of SNP variants with a frequency of >1% for a variety of "
"ancestries.",
"storedIn": {
"name": "European Bioinformatics Institute"
},
"primaryPublications": [
{
"identifier": {
"identifier": "https://doi.org/10.1038/nature15393"
},
"title": "A global reference for human genetic variation",
"dates": [
{
"type": {
"value": "Primary reference publication date"
},
"date": "2015-10-01 00:00:00"
"version": "1.0",
"project": project_id,
"privacy": "public open",
"licenses": [
{
"name": "BY-NC-SA"
}
],
"creators": creators,
"types": [
{
"information": {
"value": "genomics"
}
],
"authors": [
{
"name": "1000 Genomes Project"
}
],
"title": "1000 Genomes Project",
"description": "The 1000 Genomes Project provides a comprehensive description of common human variation by "
"applying a combination of whole-genome sequencing, deep exome sequencing and dense microarray "
"genotyping to a diverse set of 2504 individuals from 26 populations. Over 88 million variants "
"are characterised, including >99% of SNP variants with a frequency of >1% for a variety of "
"ancestries.",
"storedIn": {
"name": "European Bioinformatics Institute"
},
"primaryPublications": [
{
"identifier": {
"identifier": "https://doi.org/10.1038/nature15393"
},
"title": "A global reference for human genetic variation",
"dates": [
{
"type": {
"value": "Primary reference publication date"
},
"date": "2015-10-01 00:00:00"
}
],
"authors": [
{
"name": "1000 Genomes Project"
}
]
}
],
"isAbout": [
{
"identifier": {
"identifier": "9606",
"identifierSource": "https://www.ncbi.nlm.nih.gov/taxonomy/9606"
},
"name": "Homo sapiens"
}
],
"dates": [
{
"type": {
"value": "CONP DATS JSON fileset creation date"
},
"date": "2019-06-17 13:16:33"
}
],
"distributions": [
{
"formats": [
"VCF"
],
"size": 10,
"unit": {
"value": "GB"
},
"access": {
"landingPage": "https://example.org",
"authorizations": [
{
"value": "public"
}
]
},
"storedIn": {
"name": "European Bioinformatics Institute"
}
]
}
],
"isAbout": [
{
"identifier": {
"identifier": "9606",
"identifierSource": "https://www.ncbi.nlm.nih.gov/taxonomy/9606"
},
"name": "Homo sapiens"
}
],
"dates": [
{
"type": {
"value": "CONP DATS JSON fileset creation date"
},
"date": "2019-06-17 13:16:33"
}
],
"hasPart": [],
"extraProperties": [
{
"category": "contact",
"values": [
{
"value": "Jennifer Tremblay-Mercier, Research Co-ordinator, "
"jennifer.tremblay-mercier@douglas.mcgill.ca, 514-761-6131 #3329"
}
],
"alternateIdentifiers": [
{
"identifier": "test alternative id"
}
],
"relatedIdentifiers": [
{
"identifier": "test related id"
}
],
"spatialCoverage": [
{
"@type": "Place",
"name": "Worldwide"
}
],
"dimensions": [
{
"name": {
"value": "test dimensions"
}
]
}
],
"data_use": VALID_DATA_USE_1
}
],
"hasPart": [],
"extraProperties": [
{
"category": "contact",
"values": [
{
"value": "Jennifer Tremblay-Mercier, Research Co-ordinator, "
"jennifer.tremblay-mercier@douglas.mcgill.ca, 514-761-6131 #3329"
}
]
}
],
"data_use": VALID_DATA_USE_1
}


Expand Down
8 changes: 0 additions & 8 deletions chord_metadata_service/mcode/parse_fhir_mcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,6 @@ def _get_tnm_staging_property(resource: dict, profile_urls: list, category_type=
return property_value


def _get_profiles(resource: dict, profile_urls: list):
# Can raise a KeyError in some cases
resource_profiles = resource["meta"]["profile"]
for p_url in profile_urls:
if p_url in resource_profiles:
return True


def condition_to_cancer_condition(resource):
""" FHIR Condition to Mcode Cancer Condition. """

Expand Down

0 comments on commit bf25133

Please sign in to comment.