Skip to content

Commit c717a2a

Browse files
committed
Current state
1 parent e9a0b3e commit c717a2a

File tree

7 files changed

+44
-14
lines changed

7 files changed

+44
-14
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ build-local:
2020
cd dev-local ; make build-local ; cd ..
2121

2222
run-local:
23-
cd dev-local ; make run-local ; cd ..
23+
cd dev-local ; make run-local ; cd ..
24+
25+
exec-web:
26+
cd dev-local ; make exec-web ; cd ..
27+

apps/fhir/bluebutton/v3/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
admin.autodiscover()
1818

1919
urlpatterns = [
20+
# IF WE DECIDE TO MIRROR BFD
21+
# re_path(
22+
# r"Patient/(?P<resource_id>/$generate_insurance_card[^/]+)",
23+
# waffle_switch('v3_endpoints')(DigitalInsuranceCardView.as_view(version=3)),
24+
# name='bb_oauth_fhir_dic_read',
25+
# ),
2026
# Patient ReadView
2127
re_path(
2228
r"Patient/(?P<resource_id>[^/]+)",

apps/fhir/bluebutton/views/insurancecard.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ApplicationActivePermission)
55
from apps.authorization.permissions import DataAccessGrantPermission
66
from apps.capabilities.permissions import TokenHasProtectedCapability
7+
from django.http import JsonResponse
78

89
from rest_framework import permissions # pyright: ignore[reportMissingImports]
910

@@ -79,18 +80,38 @@ def get(self, request, *args, **kwargs):
7980
print("GET OF INSURANCE CARD")
8081
print("request: ", request.__dict__)
8182
print("self.resource_type: ", self.resource_type)
82-
return super().get(request, self.resource_type, *args, **kwargs)
83-
# return JsonResponse(status=200, data={"ok": "go"})
83+
# return super().get(request, self.resource_type, *args, **kwargs)
84+
return JsonResponse(status=200, data={"ok": "go"})
8485

8586
# How do the has_permission herre and the has_permission in the permission classes
8687
# play together? If they pass, can this fail? Visa-versa?
88+
# def has_permission(self, request, view) -> bool: # type: ignore
89+
# required_scopes = getattr(view, 'required_scopes', None)
90+
# if required_scopes is None:
91+
# return True
92+
93+
# if hasattr(request, 'auth') and request.auth is not None:
94+
# token_scopes = request.auth.scope
95+
# return any(scope in token_scopes for scope in required_scopes)
96+
# return False
97+
98+
def has_permission(self, request, view):
99+
# TODO: Why is this not being called?
100+
# A print statement where this comment is does not appear when unit tests are run.
101+
# But, the permission classes run. Where/when does has_permission get called?
102+
# required_scopes = getattr(view, 'required_scopes', None)
103+
# if required_scopes is None:
104+
# return False
105+
# return request.user.is_authenticated and hasattr(request.user, 'crosswalk')
106+
return True
87107

88108
def build_parameters(self, request):
89109
return {
90110
'_format': 'application/json'
91111
}
92112

93113
def build_url(self, fhir_settings, resource_type, resource_id=None, *args, **kwargs):
114+
print("BUILD_URL IN DIGITALINSURANCECARD")
94115
if fhir_settings.fhir_url.endswith('v1/fhir/'):
95116
# only if called by tests
96117
return f"{fhir_settings.fhir_url}{resource_type}/"

apps/fhir/bluebutton/views/read.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def build_parameters(self, *args, **kwargs):
4040
}
4141

4242
def build_url(self, fhir_settings, resource_type, resource_id, **kwargs): # type: ignore
43+
print("THIS IS THE BUILD_URL IN READ.PY")
4344
if fhir_settings.fhir_url.endswith('v1/fhir/'):
4445
# only if called by tests
4546
return '{}{}/{}/'.format(fhir_settings.fhir_url, resource_type, resource_id)

apps/testclient/constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ def fmt(name: str, uri: str, version: int, patient: str = BAD_PATIENT_ID):
4949
case EndpointUrl.coverage:
5050
return f'{uri}/{version_as_string}/fhir/Coverage/?_format=application/fhir+json'
5151
case EndpointUrl.digital_insurance_card:
52-
# return f'{uri}/{version_as_string}/fhir/DigitalInsuranceCard/?_format=application/fhir+json'
53-
return f"{uri}/{version_as_string}/fhir/Patient/{patient}/$generate-insurance-card"
52+
return f'{uri}/{version_as_string}/fhir/DigitalInsuranceCard/?_format=application/fhir+json'
53+
# return f"{uri}/{version_as_string}/fhir/Patient/{patient}/$generate-insurance-card"
54+
# ?_format=application/fhir+json
5455
case _:
5556
logger.error(f'Could not match name in EndpointUrl: {name}')
5657

apps/testclient/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def _get_fhir_data_as_json(request: HttpRequest, params: FhirDataParams) -> Dict
8787
if params.version in [Versions.V1, Versions.V2] and request.GET.get('nav_link', None):
8888
uri = _build_pagination_uri(uri, params, request)
8989

90-
oas = _get_oauth2_session_with_token(request)
91-
r = oas.get(uri)
90+
oath_session = _get_oauth2_session_with_token(request)
91+
r = oath_session.get(uri)
9292

9393
try:
9494
result_json = r.json()

dev-local/Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ build-local:
88
--platform "linux/amd64" \
99
-t bb-local:latest \
1010
-f Dockerfile.local ..
11-
# TODO: Is this necessary in a local build? Probably not.
12-
# @echo "building selenium ecr image"
13-
# cd ../dev-local ; docker build \
14-
# --platform "linux/amd64" \
15-
# -t selenium-ecr:latest \
16-
# -f Dockerfile.selenium-ecr ..
1711
cd ../dev-local ; docker build \
1812
--platform "linux/amd64" \
1913
-t selenium-local:latest \
2014
-f Dockerfile.selenium-local ..
15+
2116
run-local:
2217
@echo "Configuring for ${ENV}" ; \
2318
./run-appropriate-stack.bash
24-
19+
20+
exec-web:
21+
docker exec -it `docker ps -aqf "name=.*web.*"` /bin/bash

0 commit comments

Comments
 (0)