Skip to content

Commit

Permalink
Merge pull request #2172 from coronasafe/develop
Browse files Browse the repository at this point in the history
Develop to Staging
  • Loading branch information
gigincg authored May 16, 2024
2 parents 0240be1 + 57986ea commit 7c4b853
Show file tree
Hide file tree
Showing 58 changed files with 4,555 additions and 776 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
}
},
"postCreateCommand": "echo 'eval \"$(direnv hook bash)\"' >> ~/.bashrc && cp .env.example .env",
"postAttachCommand": "make up",
"postStartCommand": "make up",
"forwardPorts": [8000, 9000, 4000]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,7 @@ secrets.sh
/.idea/modules.xml
/.idea/vcs.xml
/.idea/ruff.xml


# Redis
*.rdb
12 changes: 6 additions & 6 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ djangoql = "==0.17.1"
djangorestframework = "==3.14.0"
djangorestframework-simplejwt = "==5.3.1"
dry-rest-permissions = "==0.1.10"
drf-nested-routers = "==0.93.4"
drf-nested-routers = "==0.94.1"
drf-spectacular = "==0.26.4"
"fhir.resources" = "==6.5.0"
gunicorn = "==22.0.0"
Expand All @@ -36,18 +36,18 @@ newrelic = "==9.3.0"
pillow = "==10.3.0"
psycopg = "==3.1.18"
pycryptodome = "==3.20.0"
pydantic = "==1.10.12" # fix for fhir.resources < 7.0.2
pydantic = "==1.10.15" # fix for fhir.resources < 7.0.2
pyjwt = "==2.8.0"
python-slugify = "==8.0.1"
pywebpush = "==1.14.0"
redis = {extras = ["hiredis"], version = "<5.0.0"} # constraint for redis-om
requests = "==2.31.0"
sentry-sdk = "==1.30.0"
whitenoise = "==6.5.0"
whitenoise = "==6.6.0"
redis-om = "==0.2.1"

[dev-packages]
black = "==24.3.0"
black = "==24.4.2"
boto3-stubs = {extras = ["s3", "boto3"], version = "==1.34.84"}
coverage = "==7.4.0"
debugpy = "==1.8.1"
Expand All @@ -60,14 +60,14 @@ djangorestframework-stubs = "==3.14.2"
factory-boy = "==3.3.0"
flake8 = "==7.0.0"
freezegun = "==1.2.2"
ipython = "==8.15.0"
ipython = "==8.24.0"
isort = "==5.12.0"
mypy = "==1.9.0"
pre-commit = "==3.4.0"
requests-mock = "==1.12.1"
tblib = "==2.0.0"
watchdog = "==3.0.0"
werkzeug = "==2.3.8"
werkzeug = "==3.0.3"

[docs]
furo = "==2023.9.10"
Expand Down
621 changes: 311 additions & 310 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions aws/backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"name": "CURRENT_DOMAIN",
"value": "https://care.ohc.network"
},
{
"name": "BACKEND_DOMAIN",
"value": "https://careapi.ohc.network"
},
{
"name": "DJANGO_ADMIN_URL",
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"
Expand Down
8 changes: 8 additions & 0 deletions aws/celery.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"name": "CURRENT_DOMAIN",
"value": "https://care.ohc.network"
},
{
"name": "BACKEND_DOMAIN",
"value": "https://careapi.ohc.network"
},
{
"name": "DJANGO_ADMIN_URL",
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"
Expand Down Expand Up @@ -307,6 +311,10 @@
"name": "CURRENT_DOMAIN",
"value": "https://care.ohc.network"
},
{
"name": "BACKEND_DOMAIN",
"value": "https://careapi.ohc.network"
},
{
"name": "DJANGO_ADMIN_URL",
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"
Expand Down
33 changes: 33 additions & 0 deletions care/abdm/api/serializers/consent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from rest_framework import serializers

from care.abdm.api.serializers.abhanumber import AbhaNumberSerializer
from care.abdm.models.consent import ConsentArtefact, ConsentRequest
from care.users.api.serializers.user import UserBaseMinimumSerializer


class ConsentArtefactSerializer(serializers.ModelSerializer):
id = serializers.CharField(source="external_id", read_only=True)

class Meta:
model = ConsentArtefact
exclude = (
"deleted",
"external_id",
"key_material_private_key",
"key_material_public_key",
"key_material_nonce",
"key_material_algorithm",
"key_material_curve",
"signature",
)


class ConsentRequestSerializer(serializers.ModelSerializer):
id = serializers.CharField(source="external_id", read_only=True)
patient_abha_object = AbhaNumberSerializer(source="patient_abha", read_only=True)
requester = UserBaseMinimumSerializer(read_only=True)
consent_artefacts = ConsentArtefactSerializer(many=True, read_only=True)

class Meta:
model = ConsentRequest
exclude = ("deleted", "external_id")
12 changes: 8 additions & 4 deletions care/abdm/api/viewsets/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def post(self, request, *args, **kwargs):
data["hiRequest"]["keyMaterial"]["nonce"],
)

AbdmGateway().data_transfer(
data_transfer_response = AbdmGateway().data_transfer(
{
"transaction_id": data["transactionId"],
"data_push_url": data["hiRequest"]["dataPushUrl"],
Expand All @@ -306,11 +306,11 @@ def post(self, request, *args, **kwargs):
],
"data": cipher.encrypt(
Fhir(
PatientConsultation.objects.get(
PatientConsultation.objects.filter(
external_id=context[
"careContextReference"
]
)
).first()
).create_record(record)
)["data"],
},
Expand All @@ -332,7 +332,7 @@ def post(self, request, *args, **kwargs):
"parameters": "Curve25519/32byte random key",
"keyValue": cipher.key_to_share,
},
"nonce": cipher.sender_nonce,
"nonce": cipher.internal_nonce,
},
}
)
Expand All @@ -345,6 +345,10 @@ def post(self, request, *args, **kwargs):
],
"consent_id": data["hiRequest"]["consent"]["id"],
"transaction_id": data["transactionId"],
"session_status": "TRANSFERRED"
if data_transfer_response
and data_transfer_response.status_code == 202
else "FAILED",
"care_contexts": list(
map(
lambda context: {"id": context["careContextReference"]},
Expand Down
Loading

0 comments on commit 7c4b853

Please sign in to comment.