The codebase has helper functions for creating various FHIR resources (e.g., create_condition, create_document_reference), but is missing a helper for creating DocumentReferenceContent objects. This makes it harder to build DocumentReference resources with content.
File: healthchain/fhir/helpers.py
Current TODO:
# TODO: create a function that creates a DocumentReferenceContent to add to the DocumentReference
Goal:
Create a create_document_reference_content() helper function following the existing patterns in helpers.py.
Acceptance Criteria:
Suggested API:
def create_document_reference_content(
attachment_data: str,
content_type: str = "text/plain",
language: str = "en-US",
title: Optional[str] = None,
**kwargs
) -> DocumentReferenceContent:
"""Create a FHIR DocumentReferenceContent object.
Args:
attachment_data: The content data (text or base64 encoded)
content_type: MIME type (e.g., 'text/plain', 'application/pdf')
language: Language code
title: Optional title for the content
**kwargs: Additional DocumentReferenceContent fields
Returns:
DocumentReferenceContent: A FHIR DocumentReferenceContent object
Example:
>>> content = create_document_reference_content(
... "Patient presents with fever...",
... content_type="text/plain",
... title="Clinical Note"
... )
"""
Resources:
- FHIR DocumentReference docs
- Study existing helpers in
healthchain/fhir/helpers.py for patterns
fhir.resources library documentation for DocumentReferenceContent
The codebase has helper functions for creating various FHIR resources (e.g.,
create_condition,create_document_reference), but is missing a helper for creatingDocumentReferenceContentobjects. This makes it harder to build DocumentReference resources with content.File:
healthchain/fhir/helpers.pyCurrent TODO:
# TODO: create a function that creates a DocumentReferenceContent to add to the DocumentReferenceGoal:
Create a
create_document_reference_content()helper function following the existing patterns inhelpers.py.Acceptance Criteria:
create_condition, etc.)DocumentReferenceContentobjecttests/fhir/test_helpers.pyhealthchain/fhir/__init__.pySuggested API:
Resources:
healthchain/fhir/helpers.pyfor patternsfhir.resourceslibrary documentation for DocumentReferenceContent