diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24a563a3..81f055f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,12 +48,12 @@ jobs: echo "host=127.0.0.1" >> /home/runner/work/config.ini echo "port=3306" >> /home/runner/work/config.ini - - name: Run tests + - name: Run Tests run: | + export SECRET_KEY=$(openssl rand -base64 12) python manage.py makemigrations python manage.py migrate python manage.py test gene2phenotype_app.tests env: - SECRET_KEY: ${{ secrets.SECRET_KEY }} PROJECT_CONFIG_PATH: /home/runner/work/config.ini working-directory: gene2phenotype_project diff --git a/gene2phenotype_project/gene2phenotype_app/serializers/curation.py b/gene2phenotype_project/gene2phenotype_app/serializers/curation.py index e5ef2db6..43d1fadc 100644 --- a/gene2phenotype_project/gene2phenotype_app/serializers/curation.py +++ b/gene2phenotype_project/gene2phenotype_app/serializers/curation.py @@ -237,12 +237,13 @@ def check_entry(self, input_json_data): def get_entry_info_from_json_data(self, json_data): """ - Extracts specific information from a given JSON data structure related to genotype, disease, and panel. + Extracts specific information from a given JSON data structure. This method parses the provided `json_data` dictionary to extract the following fields: - "genotype": Retrieved from the "allelic_requirement" key. - "disease": Retrieved from the nested "disease_name" key inside the "disease" dictionary. - "panel": Retrieved from the "panels" key. + - "confidence": Retrieved from the key "level" inside the "confidence" dictionary. If any of the keys are missing, the method returns `None` for the corresponding fields. @@ -251,13 +252,16 @@ def get_entry_info_from_json_data(self, json_data): Returns: dict: A dictionary containing the extracted fields with the following keys: - - "genotype" (str or None): The value of the "allelic_requirement" field, or `None` if not present. - - "disease" (str or None): The value of the "disease_name" field inside the "disease" dictionary, or `None` if not present. + - "genotype" (str): The allelic requirement (genotype) value, or empty string if not present. + - "disease" (str): The disease name, or empty string if not present. + - "panel" (list): The list of panels, or empty list if not present. + - "confidence" (str): The confidence level, or empty string if not present. """ return { "genotype": json_data.get("allelic_requirement"), "disease": json_data.get("disease", {}).get("disease_name"), - "panel": json_data.get("panels") + "panel": json_data.get("panels"), + "confidence": json_data.get("confidence", {}).get("level") } @transaction.atomic diff --git a/gene2phenotype_project/gene2phenotype_app/views/search.py b/gene2phenotype_project/gene2phenotype_app/views/search.py index 59285c41..1dc874b3 100644 --- a/gene2phenotype_project/gene2phenotype_app/views/search.py +++ b/gene2phenotype_project/gene2phenotype_app/views/search.py @@ -39,7 +39,7 @@ def get_queryset(self): return LocusGenotypeDisease.objects.none() base_locus = Q(locus__name=search_query, is_deleted=0) - base_locus_2 = Q(locus__locusidentifier__isnull=False, locus__locusidentifier__identifier=search_query) + base_locus_2 = Q(locus__locusidentifier__isnull=False, locus__locusidentifier__identifier=search_query, is_deleted=0) base_locus_3 = Q(locus__locusattrib__isnull=False, locus__locusattrib__value=search_query, locus__locusattrib__is_deleted=0) base_disease = Q(disease__name__regex=fr"(?i)(?