-
Notifications
You must be signed in to change notification settings - Fork 16
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
Icf cpheapm79 observations animalv2 #1168
Open
ZindahFarhaICF
wants to merge
8
commits into
bioassay-v2
Choose a base branch
from
ICF-cpheapm79-observations-animalv2
base: bioassay-v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
39df09d
add guidelines and guideline profiles
2565e1f
add obvervations to models
95dc277
update experiment and observation model
e93ac8d
add observation UI and logic
1d77fab
Add experiment observations tab to sidebar
bba6eb7
update assessment form and toxrefdb text
b20ff7c
Add tests
e1c1240
lint changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import django_filters as df | ||
from django.db.models import Q | ||
|
||
from ..common.autocomplete import AutocompleteTextWidget | ||
from ..common.filterset import ( | ||
BaseFilterSet, | ||
InlineFilterForm, | ||
PaginationFilter, | ||
) | ||
from . import autocomplete, models | ||
|
||
|
||
class ExperimentFilterSet(BaseFilterSet): | ||
query = df.CharFilter( | ||
method="filter_query", | ||
label="Short Citation", | ||
help_text="Filter citations (author, year, title, ID)", | ||
) | ||
name = df.CharFilter( | ||
lookup_expr="icontains", | ||
label="Experiment name", | ||
widget=AutocompleteTextWidget( | ||
autocomplete_class=autocomplete.ExperimentAutocomplete, | ||
field="name", | ||
attrs={ | ||
"data-placeholder": "Filter by name (ex: developmental)", | ||
"class": "autocompletefilter", | ||
}, | ||
), | ||
) | ||
design = df.CharFilter( | ||
lookup_expr="icontains", | ||
label="Experiment design", | ||
widget=AutocompleteTextWidget( | ||
autocomplete_class=autocomplete.ExperimentAutocomplete, | ||
field="design", | ||
attrs={"data-placeholder": "Filter by design (ex: B)", "class": "autocompletefilter"}, | ||
), | ||
) | ||
chemical = df.CharFilter( | ||
field_name="v2_chemicals__name", | ||
lookup_expr="icontains", | ||
label="Chemical name", | ||
widget=AutocompleteTextWidget( | ||
autocomplete_class=autocomplete.ChemicalAutocomplete, | ||
field="name", | ||
attrs={"data-placeholder": "Chemical name", "class": "autocompletefilter"}, | ||
), | ||
help_text="ex: sodium", | ||
) | ||
cas = df.CharFilter( | ||
field_name="v2_chemicals__cas", | ||
lookup_expr="icontains", | ||
label="CAS", | ||
widget=AutocompleteTextWidget( | ||
autocomplete_class=autocomplete.ChemicalAutocomplete, | ||
field="cas", | ||
attrs={"data-placeholder": "CAS", "class": "autocompletefilter"}, | ||
), | ||
help_text="ex: 107-02-8", | ||
) | ||
paginate_by = PaginationFilter() | ||
|
||
class Meta: | ||
model = models.Experiment | ||
form = InlineFilterForm | ||
fields = ["query", "name", "design", "paginate_by"] | ||
main_field = "query" | ||
appended_fields = ["name", "design", "chemical", "cas", "paginate_by"] | ||
|
||
def __init__(self, *args, assessment, **kwargs): | ||
super().__init__(*args, assessment=assessment, **kwargs) | ||
|
||
def filter_queryset(self, queryset): | ||
queryset = super().filter_queryset(queryset).prefetch_related("v2_chemicals") | ||
queryset = queryset.filter(study__assessment=self.assessment, study__bioassay=True) | ||
return queryset | ||
|
||
def filter_query(self, queryset, name, value): | ||
query = Q(study__short_citation__icontains=value) | ||
return queryset.filter(query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
hawc/apps/animalv2/migrations/0003_experiment_guideline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 5.1.6 on 2025-02-09 22:39 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("animalv2", "0002_studylevelvalue"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="experiment", | ||
name="guideline", | ||
field=models.CharField(blank=True, max_length=128, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
hawc/apps/animalv2/templates/animalv2/experiment_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{% extends 'assessment-rooted.html' %} | ||
|
||
{% block content %} | ||
<div class="d-flex"> | ||
<h2>Available bioassay experiments ({{page_obj.paginator.count}} found)</h2> | ||
</div> | ||
|
||
{% include 'common/inline_filter_form.html' %} | ||
|
||
<table id="mainTbl" class="table table-sm table-striped"> | ||
{% bs4_colgroup '25,25,50' %} | ||
{% bs4_thead 'Short citation,Experiment name,Experiment design' %} | ||
<tbody> | ||
{% for object in object_list %} | ||
<tr> | ||
<td> | ||
<a href="{% url 'vocab:observation-list' object.pk %}?order_by=system">{{ object.study.short_citation }}</a> | ||
{% debug_badge object.id %} | ||
</td> | ||
<td> | ||
<a href="{% url 'study:detail' object.pk %}">{{ object.name }}</a> | ||
</td> | ||
<td> | ||
<a href="{% url 'study:detail' object.pk %}">{{ object.design }}</a> | ||
</td> | ||
</tr> | ||
{% empty %} | ||
<tr> | ||
<td colspan="7"> | ||
No experiments available | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
|
||
{% include 'includes/paginator.html' with plural_object_name='experiments' %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
hawc/apps/assessment/migrations/0049_assessment_enable_observations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 5.1.6 on 2025-02-09 23:39 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("assessment", "0048_assessment_animal_version"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="assessment", | ||
name="enable_observations", | ||
field=models.BooleanField( | ||
default=True, | ||
help_text="Observations can be used to identify negative effects in animal bioassay studies. The project must use the Toxicity Reference Database Vocabulary to use Observations.", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ticket 79: "display a list of bioassay experiments with short citation, experiment name, experiment type, chemical name, and casrn. Search should be able to filter by each of these fields"