diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..0d38068dc1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose +{ + "name": "Care", + "dockerComposeFile": [ + "../docker-compose.yaml", + "../docker-compose.local.yaml" + ], + "hostRequirements": { + "cpus": 4 + }, + "waitFor": "onCreateCommand", + "service": "backend", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "postCreateCommand": "python manage.py migrate && python manage.py collectstatic --noinput", + "postAttachCommand": { + "server": "python manage.py runserver" + }, + + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python" + ] + } + }, + "portsAttributes": { + "8000": { + "label": "Application", + "onAutoForward": "openPreview" + } + }, + "forwardPorts": [9000] +} diff --git a/.github/workflows/deployment-branch.yaml b/.github/workflows/deployment-branch.yaml index b376a6f98f..77682cf49c 100644 --- a/.github/workflows/deployment-branch.yaml +++ b/.github/workflows/deployment-branch.yaml @@ -8,6 +8,7 @@ on: - abdm - abdm-m2 - hcx-communications + - fix-hcx paths-ignore: - "docs/**" diff --git a/.gitignore b/.gitignore index a787e5bde5..aab77b83fa 100644 --- a/.gitignore +++ b/.gitignore @@ -156,7 +156,6 @@ typings/ !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json -.devcontainer/* # Provided default Pycharm Run/Debug Configurations should be tracked by git # In case of local modifications made by Pycharm, use update-index command diff --git a/care/facility/api/viewsets/asset.py b/care/facility/api/viewsets/asset.py index 7d999a8cb8..c392e4fded 100644 --- a/care/facility/api/viewsets/asset.py +++ b/care/facility/api/viewsets/asset.py @@ -111,13 +111,12 @@ class AssetFilter(filters.FilterSet): is_working = filters.BooleanFilter() qr_code_id = filters.CharFilter(field_name="qr_code_id", lookup_expr="icontains") in_use_by_consultation = filters.BooleanFilter( - method="filter_in_use_by_consultation" + method="filter_in_use_by_consultation", + distinct=True, ) - is_permanent = filters.BooleanFilter(method="filter_is_permanent") + is_permanent = filters.BooleanFilter(method="filter_is_permanent", distinct=True) - def filter_in_use_by_consultation(self, queryset, name, value): - if value is None: - return queryset + def filter_in_use_by_consultation(self, queryset, _, value): if value: return queryset.filter(assigned_consultation_beds__end_date__isnull=True) else: @@ -126,9 +125,7 @@ def filter_in_use_by_consultation(self, queryset, name, value): | Q(assigned_consultation_beds__end_date__isnull=False) ) - def filter_is_permanent(self, queryset, name, value): - if value is None: - return queryset + def filter_is_permanent(self, queryset, _, value): if value: return queryset.filter( asset_class__in=[ diff --git a/care/hcx/utils/fhir.py b/care/hcx/utils/fhir.py index c4b8f87ea0..1ecb041025 100644 --- a/care/hcx/utils/fhir.py +++ b/care/hcx/utils/fhir.py @@ -1060,12 +1060,7 @@ def get_errors_from_coding(codings): ) return { - "id": list( - filter( - lambda identifier: identifier.system == SYSTEM.claim_identifier, - claim_response.identifier, - ) - )[0].value, + "id": claim_bundle.id, "total_approved": reduce( lambda price, acc: price + acc, map( diff --git a/care/hcx/utils/hcx/__init__.py b/care/hcx/utils/hcx/__init__.py index b88a80bae5..533e0a9bbc 100644 --- a/care/hcx/utils/hcx/__init__.py +++ b/care/hcx/utils/hcx/__init__.py @@ -75,7 +75,7 @@ def createHeaders(self, recipientCode=None, correlationId=None): else str(uuid.uuid4()), # "x-hcx-workflow_id": str(uuid.uuid4()), "x-hcx-api_call_id": str(uuid.uuid4()), - "x-hcx-status": "response.complete", + # "x-hcx-status": "response.complete", } return hcx_headers diff --git a/care/users/api/viewsets/userskill.py b/care/users/api/viewsets/userskill.py index cef51feec5..085c46a885 100644 --- a/care/users/api/viewsets/userskill.py +++ b/care/users/api/viewsets/userskill.py @@ -44,7 +44,7 @@ class UserSkillViewSet( def get_queryset(self): username = self.kwargs["users_username"] user = get_object_or_404(User, username=username) - return self.queryset.filter(user=user) + return self.queryset.filter(user=user).distinct() def perform_create(self, serializer): username = self.kwargs["users_username"] diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index f56fa8ccc3..e418a93638 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -3,7 +3,7 @@ version: '3.4' services: db: env_file: - - ./.env + - ./docker/.local.env backend: build: @@ -11,7 +11,6 @@ services: dockerfile: docker/DevDockerfile env_file: - ./docker/.local.env - - ./.env volumes: - .:/app @@ -22,7 +21,6 @@ services: dockerfile: docker/DevDockerfile env_file: - ./docker/.local.env - - ./.env entrypoint: [ "bash", "celery_dev.sh" ] depends_on: - db