Skip to content

Commit

Permalink
Merge pull request #274 from CanDIG/daisieh/cohort
Browse files Browse the repository at this point in the history
DIG-1522: change cohort to program
  • Loading branch information
daisieh authored Nov 25, 2024
2 parents a7cec23 + d4cac22 commit ac1b6de
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 101 deletions.
4 changes: 2 additions & 2 deletions chord_metadata_service/mohpackets/apis/clinical_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def query_donors(request, filters: DonorExplorerFilterSchema = Query(...)):
systemictherapy__drug_name__in=filter_dict["systemic_therapy_drug_name"]
)

if filter_dict["exclude_cohorts"]:
queryset = queryset.exclude(program_id__in=filter_dict["exclude_cohorts"])
if filter_dict["exclude_programs"]:
queryset = queryset.exclude(program_id__in=filter_dict["exclude_programs"])

class Unnest(Func):
contains_subquery = True
Expand Down
20 changes: 10 additions & 10 deletions chord_metadata_service/mohpackets/apis/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DiagnosisAgeCountSchema,
DiscoveryDonorSchema,
GenderCountSchema,
PatientPerCohortSchema,
PatientPerProgramSchema,
PrimarySiteCountSchema,
ProgramDiscoverySchema,
TreatmentTypeCountSchema,
Expand Down Expand Up @@ -74,8 +74,8 @@ def discover_programs(request):
@discovery_router.get("/donors/", response=List[DiscoveryDonorSchema])
def discover_donors(request):
"""
Return the number of donors per cohort in the database.
Note: This function is identical to `discover_patients_per_cohort`
Return the number of donors per program in the database.
Note: This function is identical to `discover_patients_per_program`
and is here because the frontend ingest uses it. It's probably best
to clean up later.
"""
Expand Down Expand Up @@ -126,20 +126,20 @@ def discover_sidebar_list(request):
###############################################


@overview_router.get("/cohort_count/", response=Dict[str, int])
@overview_router.get("/program_count/", response=Dict[str, int])
@decorate_view(cache_page(CACHE_DURATION))
def discover_cohort_count(request):
def discover_program_count(request):
"""
Return the number of cohorts in the database.
Return the number of programs in the database.
"""
return {"cohort_count": Program.objects.count()}
return {"program_count": Program.objects.count()}


@overview_router.get("/patients_per_cohort/", response=List[PatientPerCohortSchema])
@overview_router.get("/patients_per_program/", response=List[PatientPerProgramSchema])
@decorate_view(cache_page(CACHE_DURATION))
def discover_patients_per_cohort(request):
def discover_patients_per_program(request):
"""
Return the number of patients per cohort in the database.
Return the number of patients per program in the database.
"""
result = (
Donor.objects.values("program_id")
Expand Down
4 changes: 2 additions & 2 deletions chord_metadata_service/mohpackets/apis/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def explorer_donor(request, filters: DonorExplorerFilterSchema = Query(...)):
systemictherapy__drug_name__in=filter_dict["systemic_therapy_drug_name"]
)

if filter_dict["exclude_cohorts"]:
queryset = queryset.exclude(program_id__in=filter_dict["exclude_cohorts"])
if filter_dict["exclude_programs"]:
queryset = queryset.exclude(program_id__in=filter_dict["exclude_programs"])

class Unnest(Func):
contains_subquery = True
Expand Down
2 changes: 1 addition & 1 deletion chord_metadata_service/mohpackets/docs/schema_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
827f8485764cf524dee24e3835778864ea25dd27
982eaf7e95bf11e8d11bad15bda8d8935c30b905
36 changes: 18 additions & 18 deletions chord_metadata_service/mohpackets/docs/schemas/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}
}
},
"description": "Return the number of donors per cohort in the database.\nNote: This function is identical to `discover_patients_per_cohort`\nand is here because the frontend ingest uses it. It's probably best\nto clean up later.",
"description": "Return the number of donors per program in the database.\nNote: This function is identical to `discover_patients_per_program`\nand is here because the frontend ingest uses it. It's probably best\nto clean up later.",
"tags": [
"discovery"
]
Expand Down Expand Up @@ -96,10 +96,10 @@
]
}
},
"/v3/discovery/overview/cohort_count/": {
"/v3/discovery/overview/program_count/": {
"get": {
"operationId": "chord_metadata_service_mohpackets_apis_discovery_discover_cohort_count",
"summary": "Discover Cohort Count",
"operationId": "chord_metadata_service_mohpackets_apis_discovery_discover_program_count",
"summary": "Discover Program Count",
"parameters": [],
"responses": {
"200": {
Expand All @@ -117,16 +117,16 @@
}
}
},
"description": "Return the number of cohorts in the database.",
"description": "Return the number of programs in the database.",
"tags": [
"overview"
]
}
},
"/v3/discovery/overview/patients_per_cohort/": {
"/v3/discovery/overview/patients_per_program/": {
"get": {
"operationId": "chord_metadata_service_mohpackets_apis_discovery_discover_patients_per_cohort",
"summary": "Discover Patients Per Cohort",
"operationId": "chord_metadata_service_mohpackets_apis_discovery_discover_patients_per_program",
"summary": "Discover Patients Per Program",
"parameters": [],
"responses": {
"200": {
Expand All @@ -135,7 +135,7 @@
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/PatientPerCohortSchema"
"$ref": "#/components/schemas/PatientPerProgramSchema"
},
"title": "Response",
"type": "array"
Expand All @@ -144,7 +144,7 @@
}
}
},
"description": "Return the number of patients per cohort in the database.",
"description": "Return the number of patients per program in the database.",
"tags": [
"overview"
]
Expand Down Expand Up @@ -1156,12 +1156,12 @@
},
{
"in": "query",
"name": "exclude_cohorts",
"name": "exclude_programs",
"schema": {
"items": {
"type": "string"
},
"title": "Exclude Cohorts",
"title": "Exclude Programs",
"type": "array"
},
"required": false
Expand Down Expand Up @@ -3854,12 +3854,12 @@
},
{
"in": "query",
"name": "exclude_cohorts",
"name": "exclude_programs",
"schema": {
"items": {
"type": "string"
},
"title": "Exclude Cohorts",
"title": "Exclude Programs",
"type": "array"
},
"required": false
Expand Down Expand Up @@ -3930,7 +3930,7 @@
"title": "DiscoveryDonorSchema",
"type": "object"
},
"PatientPerCohortSchema": {
"PatientPerProgramSchema": {
"properties": {
"program_id": {
"title": "Program Id",
Expand All @@ -3945,7 +3945,7 @@
"program_id",
"patients_count"
],
"title": "PatientPerCohortSchema",
"title": "PatientPerProgramSchema",
"type": "object"
},
"GenderCountSchema": {
Expand Down Expand Up @@ -9023,11 +9023,11 @@
"title": "Systemic Therapy Drug Name",
"type": "array"
},
"exclude_cohorts": {
"exclude_programs": {
"items": {
"type": "string"
},
"title": "Exclude Cohorts",
"title": "Exclude Programs",
"type": "array"
}
},
Expand Down
44 changes: 22 additions & 22 deletions chord_metadata_service/mohpackets/docs/schemas/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Return all the programs in the database.

*Discover Donors*

Return the number of donors per cohort in the database.
Note: This function is identical to `discover_patients_per_cohort`
Return the number of donors per program in the database.
Note: This function is identical to `discover_patients_per_program`
and is here because the frontend ingest uses it. It's probably best
to clean up later.

Expand Down Expand Up @@ -100,15 +100,15 @@ Retrieve the list of drug names and treatment for frontend usage

<h1 id="moh-service-api-overview">overview</h1>

## chord_metadata_service_mohpackets_apis_discovery_discover_cohort_count
## chord_metadata_service_mohpackets_apis_discovery_discover_program_count

<a id="opIdchord_metadata_service_mohpackets_apis_discovery_discover_cohort_count"></a>
<a id="opIdchord_metadata_service_mohpackets_apis_discovery_discover_program_count"></a>

`GET /v3/discovery/overview/cohort_count/`
`GET /v3/discovery/overview/program_count/`

*Discover Cohort Count*
*Discover Program Count*

Return the number of cohorts in the database.
Return the number of programs in the database.

> Example responses

Expand All @@ -121,15 +121,15 @@ Return the number of cohorts in the database.
}
```

## chord_metadata_service_mohpackets_apis_discovery_discover_patients_per_cohort
## chord_metadata_service_mohpackets_apis_discovery_discover_patients_per_program

<a id="opIdchord_metadata_service_mohpackets_apis_discovery_discover_patients_per_cohort"></a>
<a id="opIdchord_metadata_service_mohpackets_apis_discovery_discover_patients_per_program"></a>

`GET /v3/discovery/overview/patients_per_cohort/`
`GET /v3/discovery/overview/patients_per_program/`

*Discover Patients Per Cohort*
*Discover Patients Per Program*

Return the number of patients per cohort in the database.
Return the number of patients per program in the database.

> Example responses

Expand Down Expand Up @@ -876,7 +876,7 @@ Used by the query service to return donors along with their sample IDs, treatmen
|treatment_type|query|array[string]|false|none|
|primary_site|query|array[string]|false|none|
|systemic_therapy_drug_name|query|array[string]|false|none|
|exclude_cohorts|query|array[string]|false|none|
|exclude_programs|query|array[string]|false|none|
|page|query|integer|false|none|
|page_size|query|integer|false|none|

Expand Down Expand Up @@ -1608,7 +1608,7 @@ This endpoint is called by the query service and bypasses user authorization.
|treatment_type|query|array[string]|false|none|
|primary_site|query|array[string]|false|none|
|systemic_therapy_drug_name|query|array[string]|false|none|
|exclude_cohorts|query|array[string]|false|none|
|exclude_programs|query|array[string]|false|none|

> Example responses

Expand Down Expand Up @@ -1683,12 +1683,12 @@ DiscoveryDonorSchema
|program_id|string|true|none|none|
|donors_count|string|true|none|none|

<h2 id="tocS_PatientPerCohortSchema">PatientPerCohortSchema</h2>
<h2 id="tocS_PatientPerProgramSchema">PatientPerProgramSchema</h2>

<a id="schemapatientpercohortschema"></a>
<a id="schema_PatientPerCohortSchema"></a>
<a id="tocSpatientpercohortschema"></a>
<a id="tocspatientpercohortschema"></a>
<a id="schemapatientperprogramschema"></a>
<a id="schema_PatientPerProgramSchema"></a>
<a id="tocSpatientperprogramschema"></a>
<a id="tocspatientperprogramschema"></a>

```json
{
Expand All @@ -1698,7 +1698,7 @@ DiscoveryDonorSchema

```

PatientPerCohortSchema
PatientPerProgramSchema

### Properties

Expand Down Expand Up @@ -10547,7 +10547,7 @@ or
"systemic_therapy_drug_name": [
"string"
],
"exclude_cohorts": [
"exclude_programs": [
"string"
]
}
Expand All @@ -10563,7 +10563,7 @@ DonorExplorerFilterSchema
|treatment_type|[string]|false|none|none|
|primary_site|[string]|false|none|none|
|systemic_therapy_drug_name|[string]|false|none|none|
|exclude_cohorts|[string]|false|none|none|
|exclude_programs|[string]|false|none|none|

<h2 id="tocS_PagedQueryDonorSchema">PagedQueryDonorSchema</h2>

Expand Down
Loading

0 comments on commit ac1b6de

Please sign in to comment.