Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
18e3f34
iniital
clewellyn-nava Nov 24, 2025
380d51c
fixing some import statements
clewellyn-nava Nov 25, 2025
d194ea6
add self to versions instance functions
clewellyn-nava Nov 25, 2025
1f3cc0c
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
clewellyn-nava Nov 25, 2025
480fe3c
declare versions as static
clewellyn-nava Nov 25, 2025
f40fd2e
refactor the fhirapi views and util functions
clewellyn-nava Nov 26, 2025
b347722
fix comments on viewsets
clewellyn-nava Nov 26, 2025
3e85c02
modifying protected capability statements and permission checking
clewellyn-nava Nov 26, 2025
5e98104
dealing with query param issues and class structure
clewellyn-nava Nov 26, 2025
3bfc4c7
add TODOs and fix fhir_id not being available in a "list"
clewellyn-nava Nov 26, 2025
c37389e
fix _format param, but raise additional question
clewellyn-nava Nov 26, 2025
8f07591
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
clewellyn-nava Nov 26, 2025
abd23c6
fixes from convo with Matt
clewellyn-nava Nov 26, 2025
b0d8ee2
more unit test fixes to urls
clewellyn-nava Nov 26, 2025
ab49edb
fix init initial split
clewellyn-nava Nov 26, 2025
6b4b588
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
JamesDemeryNava Dec 1, 2025
5a8e9a5
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
JamesDemeryNava Dec 1, 2025
ad0d4b0
Adding initial permissions checking
jadudm Dec 1, 2025
00a0be6
Merge branch 'clewellyn-nava/BB2-4266/C4DIC-endpoint' of https://gith…
jadudm Dec 1, 2025
23e22dc
Modify viewsets_base to look for read/search. Correct format=json in …
JamesDemeryNava Dec 1, 2025
a96d9ce
Fix failing unit tests
JamesDemeryNava Dec 2, 2025
70f4826
Incremental, adding impl, tests.
jadudm Dec 2, 2025
85f1949
Merge branch 'clewellyn-nava/BB2-4266/C4DIC-endpoint' of https://gith…
jadudm Dec 2, 2025
1dd88b1
Add pass through to BFD, make DIC endpoint visible for v3 testclient
JamesDemeryNava Dec 2, 2025
e9a0b3e
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
jadudm Dec 2, 2025
c717a2a
Current state
jadudm Dec 3, 2025
a56d698
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
JamesDemeryNava Dec 3, 2025
03a5827
Interim; testing an idea.
jadudm Dec 4, 2025
b47050a
Merge branch 'master' into clewellyn-nava/BB2-4266/C4DIC-endpoint
JamesDemeryNava Dec 4, 2025
b253c0f
Incremental.
jadudm Dec 4, 2025
54ed68e
Merge branch 'clewellyn-nava/BB2-4266/C4DIC-endpoint' of https://gith…
jadudm Dec 4, 2025
e79c3b3
Interim commit
jadudm Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ build-local:
cd dev-local ; make build-local ; cd ..

run-local:
cd dev-local ; make run-local ; cd ..
cd dev-local ; make run-local ; cd ..

exec-web:
cd dev-local ; make exec-web ; cd ..

6 changes: 6 additions & 0 deletions apps/fhir/bluebutton/v3/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
admin.autodiscover()

urlpatterns = [
# IF WE DECIDE TO MIRROR BFD
# re_path(
# r"Patient/(?P<resource_id>/$generate_insurance_card[^/]+)",
# waffle_switch('v3_endpoints')(DigitalInsuranceCardView.as_view(version=3)),
# name='bb_oauth_fhir_dic_read',
# ),
# Patient ReadView
re_path(
r"Patient/(?P<resource_id>[^/]+)",
Expand Down
25 changes: 23 additions & 2 deletions apps/fhir/bluebutton/views/insurancecard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ApplicationActivePermission)
from apps.authorization.permissions import DataAccessGrantPermission
from apps.capabilities.permissions import TokenHasProtectedCapability
from django.http import JsonResponse

from rest_framework import permissions # pyright: ignore[reportMissingImports]

Expand Down Expand Up @@ -79,18 +80,38 @@ def get(self, request, *args, **kwargs):
print("GET OF INSURANCE CARD")
print("request: ", request.__dict__)
print("self.resource_type: ", self.resource_type)
return super().get(request, self.resource_type, *args, **kwargs)
# return JsonResponse(status=200, data={"ok": "go"})
# return super().get(request, self.resource_type, *args, **kwargs)
return JsonResponse(status=200, data={"ok": "go"})

# How do the has_permission herre and the has_permission in the permission classes
# play together? If they pass, can this fail? Visa-versa?
# def has_permission(self, request, view) -> bool: # type: ignore
# required_scopes = getattr(view, 'required_scopes', None)
# if required_scopes is None:
# return True

# if hasattr(request, 'auth') and request.auth is not None:
# token_scopes = request.auth.scope
# return any(scope in token_scopes for scope in required_scopes)
# return False

def has_permission(self, request, view):
# TODO: Why is this not being called?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_permission is on the permissions.BasePermission, which is called by has_object_permission which is called on line 207 of generic.py in FhirDataView, which loops through self.get_permissions() which returns anything defined in the self.permission_classes (which is defined on line 60)

# A print statement where this comment is does not appear when unit tests are run.
# But, the permission classes run. Where/when does has_permission get called?
# required_scopes = getattr(view, 'required_scopes', None)
# if required_scopes is None:
# return False
# return request.user.is_authenticated and hasattr(request.user, 'crosswalk')
return True

def build_parameters(self, request):
return {
'_format': 'application/json'
}

def build_url(self, fhir_settings, resource_type, resource_id=None, *args, **kwargs):
print("BUILD_URL IN DIGITALINSURANCECARD")
if fhir_settings.fhir_url.endswith('v1/fhir/'):
# only if called by tests
return f"{fhir_settings.fhir_url}{resource_type}/"
Expand Down
1 change: 1 addition & 0 deletions apps/fhir/bluebutton/views/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def build_parameters(self, *args, **kwargs):
}

def build_url(self, fhir_settings, resource_type, resource_id, **kwargs): # type: ignore
print("THIS IS THE BUILD_URL IN READ.PY")
if fhir_settings.fhir_url.endswith('v1/fhir/'):
# only if called by tests
return '{}{}/{}/'.format(fhir_settings.fhir_url, resource_type, resource_id)
Expand Down
5 changes: 3 additions & 2 deletions apps/testclient/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def fmt(name: str, uri: str, version: int, patient: str = BAD_PATIENT_ID):
case EndpointUrl.coverage:
return f'{uri}/{version_as_string}/fhir/Coverage/?_format=application/fhir+json'
case EndpointUrl.digital_insurance_card:
# return f'{uri}/{version_as_string}/fhir/DigitalInsuranceCard/?_format=application/fhir+json'
return f"{uri}/{version_as_string}/fhir/Patient/{patient}/$generate-insurance-card"
return f'{uri}/{version_as_string}/fhir/DigitalInsuranceCard/?_format=application/fhir+json'
# return f"{uri}/{version_as_string}/fhir/Patient/{patient}/$generate-insurance-card"
# ?_format=application/fhir+json
case _:
logger.error(f'Could not match name in EndpointUrl: {name}')

Expand Down
4 changes: 2 additions & 2 deletions apps/testclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def _get_fhir_data_as_json(request: HttpRequest, params: FhirDataParams) -> Dict
if params.version in [Versions.V1, Versions.V2] and request.GET.get('nav_link', None):
uri = _build_pagination_uri(uri, params, request)

oas = _get_oauth2_session_with_token(request)
r = oas.get(uri)
oath_session = _get_oauth2_session_with_token(request)
r = oath_session.get(uri)

try:
result_json = r.json()
Expand Down
11 changes: 4 additions & 7 deletions dev-local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ build-local:
--platform "linux/amd64" \
-t bb-local:latest \
-f Dockerfile.local ..
# TODO: Is this necessary in a local build? Probably not.
# @echo "building selenium ecr image"
# cd ../dev-local ; docker build \
# --platform "linux/amd64" \
# -t selenium-ecr:latest \
# -f Dockerfile.selenium-ecr ..
cd ../dev-local ; docker build \
--platform "linux/amd64" \
-t selenium-local:latest \
-f Dockerfile.selenium-local ..

run-local:
@echo "Configuring for ${ENV}" ; \
./run-appropriate-stack.bash


exec-web:
docker exec -it `docker ps -aqf "name=.*web.*"` /bin/bash
Loading