Skip to content

Commit d1a4caf

Browse files
committed
Merge branch 'main' into isaacmilarky/NDH-539-build-missing-query-string-params-search-func
2 parents 47afb2c + 23820a3 commit d1a4caf

File tree

10 files changed

+42
-29
lines changed

10 files changed

+42
-29
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ A list of core team members responsible for the code and documentation in this r
7272

7373
## Repository Structure
7474

75-
This is the main repository for the Naitonal Provider Directory (NPD) workstream. You will find more information about each component in a README.md file within its respective directory.
75+
This is the main repository for the National Provider Directory (NPD) workstream. You will find more information about each component in a README.md file within its respective directory.
7676

7777
- [backend](./backend/): FHIR Provider Directory API and directory browser
78-
- [frontend](./backend/): Directory browser React application
78+
- [frontend](./frontend/): Directory browser React application
7979
- [flyway](./flyway/): Database migrations
8080
- [playwright](./playwright/): End-to-end test suite
8181

backend/app/settings.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,16 @@
9292
CORS_ALLOW_ALL_ORIGINS = True
9393
CORS_ALLOWED_METHODS = ["GET"]
9494

95-
CSRF_COOKIE_SECURE = config("DJANGO_CSRF_COOKIE_SECURE", cast=bool, default=False) # Only if using HTTPS
96-
CSRF_COOKIE_HTTPONLY = config("DJANGO_CSRF_COOKIE_HTTPONLY", cast=bool, default=False) # Must be False for JavaScript access
95+
CSRF_COOKIE_SECURE = config(
96+
"DJANGO_CSRF_COOKIE_SECURE", cast=bool, default=False
97+
) # Only if using HTTPS
98+
CSRF_COOKIE_HTTPONLY = config(
99+
"DJANGO_CSRF_COOKIE_HTTPONLY", cast=bool, default=False
100+
) # Must be False for JavaScript access
97101
CSRF_COOKIE_SAMESITE = config("DJANGO_CSRF_COOKIE_SAMESITE", default="Lax") # or 'Strict' or 'None'
98-
CSRF_TRUSTED_ORIGINS = config("DJANGO_CSRF_TRUSTED_DOMAINS", default="").split(",") # Add your domains
102+
CSRF_TRUSTED_ORIGINS = config("DJANGO_CSRF_TRUSTED_DOMAINS", default="").split(
103+
","
104+
) # Add your domains
99105

100106
if DEBUG:
101107
# in development, allow the frontend app to POST forms to the backend
@@ -226,6 +232,7 @@
226232
"rest_framework.authentication.SessionAuthentication",
227233
],
228234
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
235+
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
229236
}
230237

231238
SPECTACULAR_SETTINGS = {
@@ -322,11 +329,7 @@
322329
"handlers": ["console"],
323330
"level": LOG_LEVEL,
324331
},
325-
'django.security.csrf': {
326-
'handlers': ['console'],
327-
'level': LOG_LEVEL,
328-
'propagate': False
329-
},
332+
"django.security.csrf": {"handlers": ["console"], "level": LOG_LEVEL, "propagate": False},
330333
},
331334
}
332335

backend/app/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# See app/tests/test_routing.py for validation tests to ensure that changes
4949
# inside npdfhir.urls don't break our routing configuration.
5050
path("fhir/", include("npdfhir.urls")),
51-
path("fhir", npdfhir_router.get_api_root_view, name="api-root"),
51+
path("fhir", npdfhir_router.get_api_root_view(), name="api-root"),
5252
path("admin/", admin.site.urls),
5353
# everything else goes to provider_directory
5454
path("", include("provider_directory.urls")),

backend/npdfhir/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ class CapabilityStatementSerializer(serializers.Serializer):
613613
Serializer for FHIR CapablityStatement resource
614614
"""
615615

616-
def to_representation(self, instance):
616+
def to_representation(self):
617617
request = self.context.get("request")
618618
baseURL = request.build_absolute_uri("/fhir")
619619
metadataURL = request.build_absolute_uri(reverse("fhir-metadata"))
620-
schemaData = get_schema_data(request, "schema")
620+
schemaData = get_schema_data(request)
621621

622622
capability_statement = CapabilityStatement(
623623
url=metadataURL,

backend/npdfhir/tests/test_basic_views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ def test_health_view(self):
1111
res_obj = response.json()
1212
self.assertEqual(response.status_code, status.HTTP_200_OK)
1313
self.assertEqual(res_obj["status"], "healthy")
14+
15+
def test_fhir_endpoint_list_without_slash(self):
16+
response = self.client.get("/fhir")
17+
self.assertEqual(response.status_code, status.HTTP_200_OK)
18+
19+
def test_fhir_endpoint_list_with_slash(self):
20+
response = self.client.get("/fhir/")
21+
self.assertEqual(response.status_code, status.HTTP_200_OK)

backend/npdfhir/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
re_path("docs/redoc/?", SpectacularRedocView.as_view(url_name="schema"), name="schema-redoc"),
1515
re_path("docs/?", SpectacularSwaggerView.as_view(url_name="schema"), name="schema-swagger-ui"),
1616
path("healthCheck", views.health, name="healthCheck"),
17-
path("metadata", views.FHIRCapabilityStatementView.as_view(), name="fhir-metadata"),
17+
path("metadata/?", views.FHIRCapabilityStatementView.as_view(), name="fhir-metadata"),
1818
# Router URLs
1919
# everything else is passed to the rest_framework router to manage
2020
path("", include(router.urls), name="index"),

backend/npdfhir/utils.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.urls import reverse
22
from fhir.resources.R4B.address import Address
33
from fhir.resources.R4B.reference import Reference
4-
from rest_framework.test import APIClient
4+
from drf_spectacular.views import SpectacularJSONAPIView
55

66

77
def SmartyStreetstoFHIR(address):
@@ -17,15 +17,13 @@ def SmartyStreetstoFHIR(address):
1717
)
1818

1919

20-
def get_schema_data(request, url_name, additional_args=None):
21-
client = APIClient()
22-
if request.user:
23-
# reuse the authenticated user from the active request to make the
24-
# internal request to retrieve the current schema
25-
client.force_authenticate(user=request.user)
26-
schema_url = reverse(url_name, kwargs=additional_args)
27-
response = client.get(schema_url)
28-
return response.data
20+
def get_schema_data(request):
21+
schema_view = SpectacularJSONAPIView.as_view()
22+
response = schema_view(request._request)
23+
# The response contains the schema data in its .data attribute
24+
schema_data = response.data
25+
26+
return schema_data
2927

3028

3129
def genReference(url_name, identifier, request):

backend/npdfhir/views.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,10 @@ def get(self, request):
553553
"""
554554
Query metadata about this FHIR instance, represented as FHIR CapabilityStatement resource
555555
"""
556-
serializer = CapabilityStatementSerializer(context={"request": request})
557-
response = serializer.to_representation(None)
556+
serialized_capability_statement = CapabilityStatementSerializer(
557+
context={"request": request}
558+
)
559+
560+
response = Response(serialized_capability_statement.to_representation())
558561

559-
return Response(response)
562+
return response

backend/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ text-unidecode==1.3
4747
types-python-dateutil==2.9.0.20250516
4848
typing_extensions==4.14.0
4949
unittest-xml-reporting==3.2.0
50-
urllib3==2.6.0
50+
urllib3==2.6.3

etls/loadFIPS/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ pandas==2.3.1
33
sqlalchemy==2.0.41
44
python-dotenv==1.1.1
55
pangres==4.2.1
6-
psycopg2-binary==2.9.10
6+
psycopg2-binary==2.9.10
7+
urllib3==2.6.3

0 commit comments

Comments
 (0)