CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-fhir--resources

FHIR Resources as Model Classes - Python classes for all FHIR resources with validation and serialization

Pending
Overview
Eval results
Files

patient-resources.mddocs/

Patient Resources

Comprehensive patient demographics and identity management for healthcare systems. Patient resources capture essential demographic information, contact details, communication preferences, emergency contacts, and care provider relationships.

Capabilities

Patient Demographics

Core patient demographic information including names, addresses, gender, birth date, and vital status.

class Patient(DomainResource):
    """Patient demographics and identity information"""
    def __init__(
        self,
        # Identity and demographics
        identifier: Optional[List["Identifier"]] = None,
        active: Optional[bool] = None,
        name: Optional[List["HumanName"]] = None,
        telecom: Optional[List["ContactPoint"]] = None,
        gender: Optional[str] = None,  # male | female | other | unknown
        birthDate: Optional[str] = None,  # Date
        deceasedBoolean: Optional[bool] = None,
        deceasedDateTime: Optional[str] = None,  # DateTime
        address: Optional[List["Address"]] = None,
        
        # Marital and family status
        maritalStatus: Optional["CodeableConcept"] = None,
        multipleBirthBoolean: Optional[bool] = None,
        multipleBirthInteger: Optional[int] = None,
        
        # Visual and documentation
        photo: Optional[List["Attachment"]] = None,
        
        # Contacts and relationships
        contact: Optional[List["PatientContact"]] = None,
        
        # Communication preferences
        communication: Optional[List["PatientCommunication"]] = None,
        
        # Care providers
        generalPractitioner: Optional[List["Reference"]] = None,
        managingOrganization: Optional["Reference"] = None,
        
        # Links to other patients
        link: Optional[List["PatientLink"]] = None,
        
        **kwargs
    ): ...

Usage Example:

from fhir.resources.patient import Patient
from fhir.resources.humanname import HumanName
from fhir.resources.identifier import Identifier
from fhir.resources.address import Address
from fhir.resources.contactpoint import ContactPoint

# Create comprehensive patient record
patient = Patient(
    id="patient-001",
    active=True,
    identifier=[
        Identifier(
            use="usual",
            type=CodeableConcept(
                coding=[Coding(
                    system="http://terminology.hl7.org/CodeSystem/v2-0203",
                    code="MR",
                    display="Medical Record Number"
                )]
            ),
            system="http://hospital.example.org/patients",
            value="MRN789456"
        )
    ],
    name=[
        HumanName(
            use="official",
            family="Smith",
            given=["Jane", "Marie"],
            prefix=["Ms."]
        )
    ],
    telecom=[
        ContactPoint(
            system="phone",
            value="555-123-4567",
            use="home"
        ),
        ContactPoint(
            system="email",
            value="jane.smith@email.com"
        )
    ],
    gender="female",
    birthDate="1985-03-15",
    address=[
        Address(
            use="home",
            type="postal",
            line=["456 Oak Avenue"],
            city="Springfield",
            state="IL",
            postalCode="62704",
            country="US"
        )
    ]
)

Patient Contacts

Emergency contacts, family members, and other individuals associated with the patient's care.

class PatientContact:
    """Patient contact person information"""
    def __init__(
        self,
        relationship: Optional[List["CodeableConcept"]] = None,
        name: Optional["HumanName"] = None,
        telecom: Optional[List["ContactPoint"]] = None,
        address: Optional["Address"] = None,
        gender: Optional[str] = None,  # male | female | other | unknown
        organization: Optional["Reference"] = None,
        period: Optional["Period"] = None
    ): ...

Usage Example:

from fhir.resources.patient import Patient
from fhir.resources.patientcontact import PatientContact
from fhir.resources.codeableconcept import CodeableConcept
from fhir.resources.coding import Coding

patient_with_contact = Patient(
    # ... other patient data ...
    contact=[
        PatientContact(
            relationship=[
                CodeableConcept(
                    coding=[Coding(
                        system="http://terminology.hl7.org/CodeSystem/v2-0131",
                        code="C",
                        display="Emergency Contact"
                    )]
                )
            ],
            name=HumanName(
                family="Smith",
                given=["Robert"]
            ),
            telecom=[
                ContactPoint(
                    system="phone",
                    value="555-987-6543",
                    use="mobile"
                )
            ],
            gender="male"
        )
    ]
)

Communication Preferences

Patient language preferences and communication needs including interpreters and special requirements.

class PatientCommunication:
    """Patient communication preferences"""
    def __init__(
        self,
        language: "CodeableConcept",
        preferred: Optional[bool] = None
    ): ...

Usage Example:

# Patient with multiple language preferences
patient_multilingual = Patient(
    # ... other patient data ...
    communication=[
        PatientCommunication(
            language=CodeableConcept(
                coding=[Coding(
                    system="urn:ietf:bcp:47",
                    code="en-US",
                    display="English (United States)"
                )]
            ),
            preferred=True
        ),
        PatientCommunication(
            language=CodeableConcept(
                coding=[Coding(
                    system="urn:ietf:bcp:47", 
                    code="es-MX",
                    display="Spanish (Mexico)"
                )]
            ),
            preferred=False
        )
    ]
)

Patient Links

Links between patient records for merged records, person records, or related patients.

class PatientLink:
    """Link to another Patient resource"""
    def __init__(
        self,
        other: "Reference",
        type: str  # replaced-by | replaces | refer | seealso
    ): ...

Usage Example:

# Link to merged patient record
patient_with_link = Patient(
    # ... other patient data ...
    link=[
        PatientLink(
            other=Reference(
                reference="Patient/patient-old-record-123",
                display="Previous patient record"
            ),
            type="replaces"
        )
    ]
)

Related Person Resources

Persons related to the patient who are relevant to their care but are not formal caregivers.

class RelatedPerson(DomainResource):
    """Person related to patient"""
    def __init__(
        self,
        identifier: Optional[List["Identifier"]] = None,
        active: Optional[bool] = None,
        patient: "Reference",
        relationship: Optional[List["CodeableConcept"]] = None,
        name: Optional[List["HumanName"]] = None,
        telecom: Optional[List["ContactPoint"]] = None,
        gender: Optional[str] = None,  # male | female | other | unknown
        birthDate: Optional[str] = None,  # Date
        address: Optional[List["Address"]] = None,
        photo: Optional[List["Attachment"]] = None,
        period: Optional["Period"] = None,
        communication: Optional[List["RelatedPersonCommunication"]] = None,
        **kwargs
    ): ...

Usage Example:

from fhir.resources.relatedperson import RelatedPerson

# Create related person (spouse)
spouse = RelatedPerson(
    active=True,
    patient=Reference(
        reference="Patient/patient-001",
        display="Jane Marie Smith"
    ),
    relationship=[
        CodeableConcept(
            coding=[Coding(
                system="http://terminology.hl7.org/CodeSystem/v3-RoleCode",
                code="SPOUSE",
                display="Spouse"
            )]
        )
    ],
    name=[
        HumanName(
            use="official",
            family="Smith",
            given=["John", "David"]
        )
    ],
    telecom=[
        ContactPoint(
            system="phone",
            value="555-234-5678",
            use="mobile"
        )
    ],
    gender="male"
)

Types

from typing import Optional, List
from fhir.resources.domainresource import DomainResource
from fhir.resources.address import Address
from fhir.resources.attachment import Attachment
from fhir.resources.codeableconcept import CodeableConcept
from fhir.resources.coding import Coding
from fhir.resources.contactpoint import ContactPoint
from fhir.resources.humanname import HumanName
from fhir.resources.identifier import Identifier
from fhir.resources.period import Period
from fhir.resources.reference import Reference

# Patient-specific backbone elements
class PatientContact: ...
class PatientCommunication: ...
class PatientLink: ...
class RelatedPersonCommunication: ...

Install with Tessl CLI

npx tessl i tessl/pypi-fhir--resources

docs

administrative-resources.md

clinical-resources.md

core-functions.md

data-types.md

financial-resources.md

index.md

patient-resources.md

serialization.md

version-support.md

tile.json