Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to fix tooltip on measurement value charts #1490

Open
wants to merge 4 commits into
base: DB_1472_Data
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

defaults: &defaults
docker:
- image: us.gcr.io/broad-dsp-gcr-public/workbench:buildimage-0.0.28
- image: us.gcr.io/broad-dsp-gcr-public/workbench:buildimage-0.0.29
working_directory: ~/data-browser
java_defaults: &java_defaults
<<: *defaults
Expand Down Expand Up @@ -51,7 +51,7 @@ commands:
jobs:
public-api-local-test:
docker:
- image: us.gcr.io/broad-dsp-gcr-public/workbench:buildimage-0.0.28
- image: us.gcr.io/broad-dsp-gcr-public/workbench:buildimage-0.0.29
- image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=ubuntu
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile.circle_build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM cimg/openjdk:17.0-browsers

USER circleci

ENV CLOUD_SDK_VERSION 471.0.0
ENV CLOUD_SDK_VERSION 503.0.0

RUN cd && \
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz -O gcloud.tgz && \
Expand Down Expand Up @@ -53,7 +53,7 @@ RUN cd /tmp && \

ENV PATH=/home/circleci/node/bin:/home/circleci/google-cloud-sdk/bin:$PATH

RUN curl https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 > /tmp/cloud_sql_proxy \
RUN curl -o /tmp/cloud_sql_proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.14.2/cloud-sql-proxy.linux.amd64 \
&& sudo mv /tmp/cloud_sql_proxy /usr/local/bin && sudo chmod +x /usr/local/bin/cloud_sql_proxy

# It never makes sense for Gradle to run a daemon within a docker container.
Expand Down
13 changes: 7 additions & 6 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,30 @@ RUN n 22
# Install openapi-generator-cli
RUN npm install @openapitools/openapi-generator-cli -g

ENV CLOUD_SDK_VERSION 471.0.0
ENV CLOUD_SDK_VERSION 503.0.0

WORKDIR /root
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz -O gcloud.tgz && \
RUN curl -o gcloud.tgz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
tar -xf gcloud.tgz && \
./google-cloud-sdk/install.sh --quiet && \
./google-cloud-sdk/bin/gcloud components install app-engine-java && \
rm -rf gcloud.tgz

ENV PATH=~/node/bin:~/google-cloud-sdk/bin:$PATH

RUN wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O /tmp/cloud_sql_proxy \
RUN curl -o /tmp/cloud_sql_proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.14.2/cloud-sql-proxy.linux.amd64 \
&& mv /tmp/cloud_sql_proxy /usr/local/bin && chmod +x /usr/local/bin/cloud_sql_proxy

# It never makes sense for Gradle to run a daemon within a docker container.
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false"

ENV GRADLE_VERSION 7.6.1

RUN wget "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" -O /tmp/gradle.zip \
RUN curl -L -o /tmp/gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& unzip /tmp/gradle.zip -d /opt/gradle
ENV PATH="/opt/gradle/gradle-${GRADLE_VERSION}/bin:${PATH}"

# Force a lower concurrent-ruby version, as we only have Ruby 2.3.
RUN gem install activesupport -v 6.1.4.6
RUN gem install logger
RUN gem install concurrent-ruby -v 1.3.4
RUN gem install activesupport -v 6.1.4.6 --conservative
RUN gem install jira-ruby
1 change: 0 additions & 1 deletion deploy/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
deploy:
build:
Expand Down
1 change: 1 addition & 0 deletions deploy/libproject/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "open3"
require "set"
require "logger"
require_relative "../../aou-utils/serviceaccounts"
require_relative "../../aou-utils/utils/common"
require_relative "../../aou-utils/workbench"
Expand Down
2 changes: 1 addition & 1 deletion public-api/config/cdr_config_prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
"creationTime": "2023-12-19 15:55:44Z",
"releaseNumber": 15,
"numParticipants": 633540,
"publicDbName": "p_2024q3_18"
"publicDbName": "p_2024q3_21"
}
]
2 changes: 1 addition & 1 deletion public-api/config/cdr_config_stable.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@
"creationTime": "2023-12-19 15:55:44Z",
"releaseNumber": 15,
"numParticipants": 633540,
"publicDbName": "p_2024q3_18"
"publicDbName": "p_2024q3_21"
}
]
2 changes: 1 addition & 1 deletion public-api/config/cdr_config_staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@
"creationTime": "2023-12-19 15:55:44Z",
"releaseNumber": 15,
"numParticipants": 633540,
"publicDbName": "p_2024q3_18"
"publicDbName": "p_2024q3_21"
}
]
2 changes: 1 addition & 1 deletion public-api/config/cdr_config_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@
"creationTime": "2023-12-19 15:55:44Z",
"releaseNumber": 15,
"numParticipants": 633540,
"publicDbName": "p_2024q3_18"
"publicDbName": "p_2024q3_21"
}
]
2,769 changes: 1,382 additions & 1,387 deletions public-api/db-cdr/generate-cdr/csv/survey_metadata.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public-api/db-cdr/generate-cdr/csv/survey_module.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ concept_id,"name","description",question_count,participant_count,order_number
1333342,"COVID-19 Participant Experience (COPE)","This survey asks about the impact of COVID-19 on a participant’s mental health, well-being, and everyday life. This survey was administered to participants multiple times from May 2020 to March 2021.",176,100220,7
1585710,"Overall Health","This survey collects information about a participant’s overall health including general health, daily activities, and women’s health topics.",21,412220,2
1585855,"Lifestyle","This survey asks about a participant’s use of tobacco, alcohol, and recreational drugs.",26,412220,3
1586134,"The Basics","This core survey asks basic demographic questions, including questions about a participant’s work and home. Participants must complete this survey before responding to additional surveys.",28,413360,1
1586134,"The Basics","This core survey asks basic demographic questions, including questions about a participant’s work and home. Participants must complete this survey before responding to additional surveys.",25,413360,1
40192389,"Social Determinants of Health","This survey asks about the social determinants of health, including a participant’s neighborhood, social life, stress, and feelings about everyday life.",80,117800,9
43528895,"Health Care Access And Utilization","This survey asks questions about a participant’s access to and use of health care.",57,190220,5
43529712,"Personal and Family Health History","This survey includes information about past medical history, including medical conditions and approximate age of diagnosis. Multiple versions of this survey have been offered at different times. All survey questions are presented together on this page. Further breakdown by survey type can be performed within the Research Workbench. The layout of each survey version can be viewed in the linked PDFs.",604,185240,6
6 changes: 4 additions & 2 deletions public-api/libproject/cloudsqlproxycontext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ class CloudSqlProxyContext < ServiceAccountContext
def run()
# TODO(dmohs): An error here does not cause the main thread to die.
super do
instance = "#{@project}:us-central1:databrowsermaindb"
@ps = fork do
exec(*%W{
cloud_sql_proxy
-instances #{@project}:us-central1:databrowsermaindb=tcp:0.0.0.0:3307
-credential_file=#{@path}
--port 3307
#{instance}
--credentials-file=#{@path}
})
end
begin
Expand Down
2 changes: 1 addition & 1 deletion public-api/src/dev/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV CLOUD_SDK_VERSION 471.0.0
ENV CLOUD_SDK_VERSION 503.0.0

ENV PATH /google-cloud-sdk/bin:$PATH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ interface Props {
}

export class ValueReactChartComponent extends React.Component<Props, State> {
chartRef: React.RefObject<any>;
constructor(props) {
super(props);
this.state = {
options: null,
pageX: 0,
pageY: 0,
};
this.chartRef = React.createRef();
}

componentDidMount() {
Expand Down Expand Up @@ -169,12 +171,24 @@ export class ValueReactChartComponent extends React.Component<Props, State> {
useHTML: true,
};
}

newBaseOptions.tooltip.positioner = (width, height, point) => {
return {
x: this.state.pageX - 144,
y: this.state.pageY - 90,
};
const chart = this.chartRef.current?.chart; // Access chart via ref
if (!chart) return { x: 0, y: 0 };

const chartWidth = chart.chartWidth;
const chartHeight = chart.chartHeight;

const xPos = point.plotX + chart.plotLeft + point.shapeArgs.width;
const yPos = point.plotY + chart.plotTop - height / 2;

// Ensure the tooltip stays within chart bounds
const adjustedX = Math.max(0, Math.min(chartWidth - width, xPos));
const adjustedY = Math.max(0, Math.min(chartHeight - height, yPos));

return { x: adjustedX, y: adjustedY };
};

this.setState({ options: newBaseOptions });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,16 +733,13 @@ export const GenomicViewComponent = withRouteData(
window.addEventListener("beforeunload", this.componentCleanup);
const { search } = urlParamsStore.getValue();
const currentUrl = window.location.href;
console.log(currentUrl);
console.log(currentUrl.includes('variants'));
console.log(currentUrl.includes('structural-variants'));

if (search) {
if (currentUrl.includes('structural-variants')) {
this.setState({ svSearchTerm: search }, () => {
this.getSVVariantSearch(search);
});
} else if (currentUrl.includes('variants')) {
} else if (currentUrl.includes('snvsindels')) {
this.setState({ searchTerm: search }, () => {
this.getVariantSearch(search);
});
Expand Down