Ejemplo n.º 1
0
class MeasurementValueFilter(filters.FilterSet):
    assay = django_filters.ModelChoiceFilter(
        name='measurement__assay',
        queryset=models.Assay.objects.all(),
    )
    created_before = django_filters.IsoDateTimeFilter(
        name='updated__mod_time',
        lookup_expr='lte',
    )
    created_after = django_filters.IsoDateTimeFilter(
        name='updated__mod_time',
        lookup_expr='gte',
    )
    line = django_filters.ModelChoiceFilter(
        name='measurement__assay__line',
        queryset=models.Line.objects.all(),
    )
    x__gt = django_filters.NumberFilter(name='x', lookup_expr='0__gte')
    x__lt = django_filters.NumberFilter(name='x', lookup_expr='0__lte')
    y__gt = django_filters.NumberFilter(name='y', lookup_expr='0__gte')
    y__lt = django_filters.NumberFilter(name='y', lookup_expr='0__lte')

    class Meta:
        model = models.MeasurementValue
        fields = {'measurement': ['exact', 'in']}
Ejemplo n.º 2
0
class MeasurementFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(name='active')
    created_before = django_filters.IsoDateTimeFilter(
        name='update_ref__mod_time',
        lookup_expr='lte',
    )
    created_after = django_filters.IsoDateTimeFilter(
        name='update_ref__mod_time',
        lookup_expr='gte',
    )
    compartment = django_filters.ChoiceFilter(
        name='compartment',
        choices=models.Measurement.Compartment.CHOICE,
    )
    line = django_filters.ModelChoiceFilter(
        name='assay__line',
        queryset=models.Line.objects.all(),
    )
    measurement_format = django_filters.ChoiceFilter(
        name='measurement_format',
        choices=models.Measurement.Format.CHOICE,
    )

    class Meta:
        model = models.Measurement
        fields = {
            'assay': ['exact', 'in'],
            'measurement_type': ['exact', 'in'],
            'x_units': ['exact', 'in'],
            'y_units': ['exact', 'in']
        }
Ejemplo n.º 3
0
Archivo: views.py Proyecto: zhwycsz/edd
class MeasurementFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(field_name="active")
    created_before = django_filters.IsoDateTimeFilter(
        field_name="update_ref__mod_time", lookup_expr="lte"
    )
    created_after = django_filters.IsoDateTimeFilter(
        field_name="update_ref__mod_time", lookup_expr="gte"
    )
    compartment = django_filters.ChoiceFilter(
        field_name="compartment", choices=models.Measurement.Compartment.CHOICE
    )
    line = django_filters.ModelChoiceFilter(
        field_name="assay__line", queryset=models.Line.objects.all()
    )
    measurement_format = django_filters.ChoiceFilter(
        field_name="measurement_format", choices=models.Measurement.Format.CHOICE
    )

    class Meta:
        model = models.Measurement
        fields = {
            "assay": ["exact", "in"],
            "measurement_type": ["exact", "in"],
            "x_units": ["exact", "in"],
            "y_units": ["exact", "in"],
        }
Ejemplo n.º 4
0
class EDDObjectFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(name='active')
    created_before = django_filters.IsoDateTimeFilter(name='created__mod_time', lookup_expr='lte')
    created_after = django_filters.IsoDateTimeFilter(name='created__mod_time', lookup_expr='gte')
    description = django_filters.CharFilter(name='description', lookup_expr='iregex')
    name = django_filters.CharFilter(name='name', lookup_expr='iregex')
    updated_before = django_filters.IsoDateTimeFilter(name='updated__mod_time', lookup_expr='lte')
    updated_after = django_filters.IsoDateTimeFilter(name='updated__mod_time', lookup_expr='gte')

    class Meta:
        model = models.EDDObject
        fields = []
Ejemplo n.º 5
0
Archivo: filters.py Proyecto: JBEI/edd
class EDDObjectFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(
        field_name="active",
        help_text=
        _("Filter on currently active/visible items (True/1/yes or false/0/no)"
          ),
    )
    created_before = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="lte",
    )
    created_after = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="gte",
    )
    description = django_filters.CharFilter(
        field_name="description",
        help_text=_("Runs a regular expression search on item description"),
        lookup_expr="iregex",
    )
    name = django_filters.CharFilter(
        field_name="name",
        help_text=_("Runs a regular expression search on item name"),
        lookup_expr="iregex",
    )
    updated_before = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="lte",
    )
    updated_after = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="gte",
    )

    class Meta:
        model = models.EDDObject
        fields = []

    @classmethod
    def truthy(cls, value):
        """
        Utility to check if a string filter value is Boolean True for filtering.
        Accepts case-insensitive "true", "yes", "t", "y", "1" as True. All
        other values are treated as False.
        """
        return str(value).lower() in {"true", "t", "yes", "y", "1"}
Ejemplo n.º 6
0
class EDDObjectFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(field_name="active")
    created_before = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time", lookup_expr="lte")
    created_after = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time", lookup_expr="gte")
    description = django_filters.CharFilter(field_name="description",
                                            lookup_expr="iregex")
    name = django_filters.CharFilter(field_name="name", lookup_expr="iregex")
    updated_before = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time", lookup_expr="lte")
    updated_after = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time", lookup_expr="gte")

    class Meta:
        model = models.EDDObject
        fields = []
Ejemplo n.º 7
0
class MeasurementValueFilter(filters.FilterSet):
    assay = django_filters.ModelChoiceFilter(
        field_name="measurement__assay", queryset=models.Assay.objects.all())
    created_before = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time", lookup_expr="lte")
    created_after = django_filters.IsoDateTimeFilter(
        field_name="updated__mod_time", lookup_expr="gte")
    line = django_filters.ModelChoiceFilter(
        field_name="measurement__assay__line",
        queryset=models.Line.objects.all())
    x__gt = django_filters.NumberFilter(field_name="x", lookup_expr="0__gte")
    x__lt = django_filters.NumberFilter(field_name="x", lookup_expr="0__lte")
    y__gt = django_filters.NumberFilter(field_name="y", lookup_expr="0__gte")
    y__lt = django_filters.NumberFilter(field_name="y", lookup_expr="0__lte")

    class Meta:
        model = models.MeasurementValue
        fields = {"measurement": ["exact", "in"]}
Ejemplo n.º 8
0
Archivo: filters.py Proyecto: JBEI/edd
class MeasurementFilter(filters.FilterSet):
    active = django_filters.BooleanFilter(
        field_name="active",
        help_text=
        _("Filter on currently active/visible items (True/1/yes or false/0/no)"
          ),
    )
    assay = ModelChoiceInFilter(
        field_name="assay",
        help_text=_("IDs of assay(s) to limit measurements"),
        queryset=models.Assay.objects.all(),
    )
    created_before = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="lte",
    )
    created_after = django_filters.IsoDateTimeFilter(
        field_name="created__mod_time",
        help_text=_("Use an ISO-8601-like datetime: 2020-01-01 00:00:00"),
        lookup_expr="gte",
    )
    compartment = django_filters.ChoiceFilter(
        choices=models.Measurement.Compartment.CHOICE,
        field_name="compartment",
        help_text=
        _("One of the compartment codes, 0, 1, 2 for N/A, Intracellular, Extracellular"
          ),
    )
    format = django_filters.ChoiceFilter(
        choices=models.Measurement.Format.CHOICE,
        field_name="measurement_format",
        help_text=_("One of the format codes; currently only '0' for Scalar "
                    "format values is supported"),
    )
    in_study = django_filters.CharFilter(
        field_name="study",
        help_text=_("An identifier for the study; can use ID, UUID, or Slug"),
        method=filter_in_study,
    )
    line = ModelChoiceInFilter(
        field_name="assay__line",
        help_text=_("IDs of line(s) to limit measurements"),
        queryset=models.Line.objects.all(),
    )
    protocol = ModelChoiceInFilter(
        field_name="assay__protocol",
        help_text=_("IDs of protocol(s) to limit measurements"),
        queryset=models.Protocol.objects.all(),
    )
    type = ModelChoiceInFilter(
        field_name="measurement_type",
        help_text=_("IDs of measurement type(s) to limit measurements"),
        queryset=models.MeasurementType.objects.all(),
    )
    x_units = ModelChoiceInFilter(
        field_name="x_units",
        help_text=_("IDs of unit(s) used on the x-axis to limit measurements"),
        queryset=models.MeasurementUnit.objects.all(),
    )
    y_units = ModelChoiceInFilter(
        field_name="y_units",
        help_text=_("IDs of unit(s) used on the y-axis to limit measurements"),
        queryset=models.MeasurementUnit.objects.all(),
    )

    class Meta:
        model = models.Measurement
        fields = []