Exemple #1
0
class IVExperimentSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    cell_type = IVCellTypeSerializer()
    url = serializers.CharField(source='get_absolute_url', read_only=True)
    metabolic_activation = serializers.CharField(
        source='get_metabolic_activation_display', read_only=True)

    class Meta:
        model = models.IVExperiment
        fields = '__all__'
        depth = 1
Exemple #2
0
class SingleResultSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    meta_result = serializers.PrimaryKeyRelatedField(read_only=True)

    def to_representation(self, instance):
        ret = super().to_representation(instance)
        ret['estimateFormatted'] = instance.estimate_formatted
        return ret

    class Meta:
        model = models.SingleResult
        fields = '__all__'
Exemple #3
0
class SingleResultSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    outcome_group = AssessedOutcomeGroupVerboseSerializer()
    meta_result = serializers.PrimaryKeyRelatedField(read_only=True)

    def to_representation(self, instance):
        ret = super(SingleResultSerializer, self).to_representation(instance)
        if instance.outcome_group is None:
            ret['estimateFormatted'] = instance.estimate_formatted
        return ret

    class Meta:
        model = models.SingleResult
Exemple #4
0
class MetaProtocolSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    inclusion_criteria = serializers.StringRelatedField(many=True)
    exclusion_criteria = serializers.StringRelatedField(many=True)
    url = serializers.ReadOnlyField(source="get_absolute_url")
    protocol_type = serializers.ReadOnlyField(
        source="get_protocol_type_display")
    lit_search_strategy = serializers.ReadOnlyField(
        source="get_lit_search_strategy_display")
    results = MetaResultLinkSerializer(many=True)

    class Meta:
        model = models.MetaProtocol
        fields = '__all__'
Exemple #5
0
class ExperimentSerializer(serializers.ModelSerializer):
    study = StudySerializer()

    def to_representation(self, instance):
        ret = super().to_representation(instance)
        ret['url'] = instance.get_absolute_url()
        ret['type'] = instance.get_type_display()
        ret['is_generational'] = instance.is_generational()
        ret['cas_url'] = instance.cas_url
        return ret

    class Meta:
        model = models.Experiment
        fields = '__all__'
Exemple #6
0
class MetaProtocolSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    inclusion_criteria = serializers.StringRelatedField(many=True)
    exclusion_criteria = serializers.StringRelatedField(many=True)

    def to_representation(self, instance):
        ret = super(MetaProtocolSerializer, self).to_representation(instance)
        ret['url'] = instance.get_absolute_url()
        ret['protocol_type'] = instance.get_protocol_type_display()
        ret['lit_search_strategy'] = instance.get_lit_search_strategy_display()
        return ret

    class Meta:
        model = models.MetaProtocol
Exemple #7
0
class StudyPopulationSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    criteria = StudyPopulationCriteriaSerializer(source='spcriteria', many=True)
    outcomes = OutcomeLinkSerializer(many=True)
    exposures = ExposureLinkSerializer(many=True)
    can_create_sets = serializers.BooleanField(read_only=True)
    comparison_sets = ComparisonSetLinkSerializer(many=True)
    country = serializers.CharField(source='country.name', read_only=True)
    url = serializers.CharField(source='get_absolute_url', read_only=True)
    design = serializers.CharField(source='get_design_display', read_only=True)

    class Meta:
        model = models.StudyPopulation
        fields = '__all__'
Exemple #8
0
class IVExperimentSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    cell_type = IVCellTypeSerializer()

    def to_representation(self, instance):
        ret = super(IVExperimentSerializer, self).to_representation(instance)
        ret['url'] = instance.get_absolute_url()
        ret['metabolic_activation'] = instance.get_metabolic_activation_display(
        )
        ret['title'] = unicode(self.instance)
        return ret

    class Meta:
        model = models.IVExperiment
        depth = 1
Exemple #9
0
class StudyPopulationSerializer(serializers.ModelSerializer):
    study = StudySerializer()
    ethnicity = serializers.StringRelatedField(many=True)
    inclusion_criteria = serializers.StringRelatedField(many=True)
    exclusion_criteria = serializers.StringRelatedField(many=True)
    confounding_criteria = serializers.StringRelatedField(many=True)

    def to_representation(self, instance):
        ret = super(StudyPopulationSerializer, self).to_representation(instance)
        ret['url'] = instance.get_absolute_url()
        ret['design'] = instance.get_design_display()
        ret['country'] = instance.get_country_display()
        ret['sex'] = instance.get_sex_display()
        ret['age_sd_type'] = instance.get_age_sd_type_display()
        ret['age_mean_type'] = instance.get_age_mean_type_display()
        ret['age_lower_type'] = instance.get_age_lower_type_display()
        ret['age_upper_type'] = instance.get_age_upper_type_display()
        return ret

    class Meta:
        model = models.StudyPopulation
Exemple #10
0
class IVChemicalSerializer(_IVChemicalSerializer):
    study = StudySerializer()