Skip to content

Commit

Permalink
fix: fix order of the overlap request
Browse files Browse the repository at this point in the history
...as the order matters now because of filtering
and transformation...and outcome should go first
  • Loading branch information
pieterlukasse committed Feb 13, 2025
1 parent 691a3c2 commit 30ca61d
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions src/Analysis/GWASApp/Utils/cohortMiddlewareApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const fetchSimpleOverlapInfo = async (
outcome,
) => {
const variablesPayload = {
variables: [...selectedCovariates, outcome,
variables: [outcome, ...selectedCovariates,
// add extra filter to make sure we only count persons that have a HARE group as well:
{
variable_type: 'concept',
Expand Down Expand Up @@ -113,52 +113,6 @@ export const addCDFilter = (cohortId, otherCohortId, covariateArr) => {
return covariateRequest;
};

export const fetchConceptStatsByHareSubsetCC = async (
cohortDefinitionId,
otherCohortDefinitionId,
covariateSubset,
sourceId,
) => fetchConceptStatsByHareSubset(
cohortDefinitionId,
addCDFilter(cohortDefinitionId, otherCohortDefinitionId, covariateSubset),
sourceId,
);

export const fetchConceptStatsByHareForCaseControl = async (
queriedCohortDefinitionId,
otherCohortDefinitionId,
selectedCovariates,
selectedDichotomousCovariates,
sourceId,
) => fetchConceptStatsByHareSubset(
queriedCohortDefinitionId,
addCDFilter(queriedCohortDefinitionId, otherCohortDefinitionId, [
...selectedCovariates,
...selectedDichotomousCovariates,
]),
sourceId,
);

export const fetchCovariateStats = async (
cohortDefinitionId,
selectedCovariateIds,
sourceId,
) => {
const covariateIds = { ConceptIds: selectedCovariateIds };
const conceptStatsEndpoint = `${cohortMiddlewarePath}concept-stats/by-source-id/${sourceId}/by-cohort-definition-id/${cohortDefinitionId}`;
const reqBody = {
method: 'POST',
credentials: 'include',
headers,
body: JSON.stringify(covariateIds),
};
const response = await fetch(conceptStatsEndpoint, reqBody);
if (!response.ok) {
const message = `An error has occured: ${response.status}`;
throw new Error(message);
}
return response.json();
};

export const fetchCohortDefinitions = async (sourceId, selectedTeamProject) => {
const cohortEndPoint = `${cohortMiddlewarePath}cohortdefinition-stats/by-source-id/${sourceId}/by-team-project?team-project=${selectedTeamProject}`;
Expand Down

0 comments on commit 30ca61d

Please sign in to comment.