Skip to content

Commit

Permalink
Merge branch 'main' into deployment
Browse files Browse the repository at this point in the history
# Conflicts:
#	docker-compose.yml
  • Loading branch information
tnaccarato committed Aug 13, 2024
2 parents 57293a9 + 3d46ba6 commit 8c6a033
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## Prerequisites

- Docker and Docker Compose installed on your system.
- Docker and Docker Compose installed on your system. You can follow the official Docker documentation to install
Docker and Docker Compose on your system.
- - You can access the documentation here: [Get Docker](https://docs.docker.com/get-docker/).
- SSL Certificates (cert.pem and key.pem) for HTTPS configuration.
- `docker-compose.yml` file from the repository.

Expand Down
48 changes: 40 additions & 8 deletions vis_phewas/templates/som/som_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="{% static 'mainapp/js/som.js' %}"></script>
<style>
.checkbox-container {
column-count: 3;
column-gap: 20px;
}
.checkbox-container label {
display: block;
margin-bottom: 5px;
}
</style>
</head>
<body>
<h1>SOM Visualization</h1>

{% if type == 'disease' %}
<h2>Filter by Disease Category</h2>
<form id="disease-filter-form" onsubmit="handleSubmit(event);">
{% for category in categories %}
<input type="checkbox" id="{{ category }}" name="filters" value="{{ category }}">
<label for="{{ category }}">{{ category }}</label><br>
{% endfor %}

<div class="checkbox-container">
{% for category in categories %}
<input type="checkbox" id="{{ category }}" name="filters" value="{{ category }}">
<label for="{{ category }}">{{ category }}</label>
{% endfor %}
</div>
<button type="submit" class="button btn btn-info updateSOM">Generate SOM with Selection</button>
</form>
{% endif %}
Expand All @@ -36,17 +47,38 @@ <h2>Filter by Disease Category</h2>
selectedFilters.push(baseFilter + checkbox.value);
});

// Join filters with " AND " to match the format
const joinedFilters = selectedFilters.join(' AND ');
// Store selected filters in localStorage
localStorage.setItem('selectedFilters', JSON.stringify(selectedFilters));

// Join filters with " OR " to match the format
const joinedFilters = selectedFilters.join(' OR ');
// Encode the joined filters to be used in the URL
return encodeURIComponent(joinedFilters);
}

// Function to load selected filters from localStorage on page load
function loadSelectedFilters() {
const selectedFilters = JSON.parse(localStorage.getItem('selectedFilters'));
if (selectedFilters) {
selectedFilters.forEach((filter) => {
const category = filter.replace('category_string:==:', '');
const checkbox = document.getElementById(category);
if (checkbox) {
checkbox.checked = true;
}
});
}
}

// Call the function to load selected filters on page load
document.addEventListener('DOMContentLoaded', loadSelectedFilters);

function handleSubmit(event) {
event.preventDefault(); // Prevent form submission and page reload
const filters = getSelectedFilters();
generateSOM(filters, 'disease'); // Call the generateSOM function with the filters
}


</script>
</body>
</html>

0 comments on commit 8c6a033

Please sign in to comment.