Patient Facility Address

The PatientFacilityAddress effect enables the creation, updating, and deletion of patient facility address records within Canvas. Patient facility addresses link patients to healthcare facilities, with optional room number information. The address details are automatically populated from the linked facility.

You can either reference an existing facility by ID, or create a new facility inline by providing the facility details.

Build a PatientFacilityAddress with the attributes you want to set, then return one of its methods from your handler: create(), update(), or delete().

Methods #

create() → Effect #

Creates a patient facility address.

  • patient_id is required, and must be the id of an existing patient.
  • Supply either facility_id for an existing facility, or the fields to create a new facility (facility_name, facility_city, facility_state_code, and facility_postal_code), but not both. See Facility Reference Options.
  • id must not be set.

update() → Effect #

Updates an existing patient facility address.

  • id is required, and must be the id of an existing patient facility address.

delete() → Effect #

Deletes an existing patient facility address.

  • id is required, and must be the id of an existing patient facility address.

Attributes #

AttributeTypeDescriptionRequired
idstr or UUIDID of the patient facility addressFor update() and delete()
patient_idstr or UUIDID of the patientFor create()
facility_idstr or UUIDID of an existing facility to linkFor create(), unless creating a new facility
facility_namestrName of new facility to createWhen creating a new facility
facility_npi_numberstrNPI number for new facilityNo
facility_phone_numberstrPhone number for new facilityNo
facility_fax_numberstrFax number for new facilityNo
facility_activeboolWhether the new facility is activeNo
facility_line1strStreet address line 1 for new facilityNo
facility_line2strStreet address line 2 for new facilityNo
facility_citystrCity for new facilityWhen creating a new facility
facility_districtstrDistrict for new facilityNo
facility_state_codestrState code for new facility (e.g., “CA”, “NY”)When creating a new facility
facility_postal_codestrPostal code for new facilityWhen creating a new facility
room_numberstrRoom number at the facilityNo
address_typeAddressType or strType of address: “physical” or “both”. Defaults to “physical”.No

Facility Reference Options #

When creating a patient facility address, you must either:

  1. Reference an existing facility by providing facility_id
  2. Create a new facility inline by providing facility creation fields (facility_name, facility_city, facility_state_code, facility_postal_code)

Required Fields for Inline Facility Creation #

When creating a new facility inline, the following fields are required:

  • facility_name
  • facility_city
  • facility_state_code
  • facility_postal_code

Address Type #

The address_type field accepts the following values:

ValueDescription
physicalPhysical/street address (default)
bothBoth physical and mailing address

Validation #

The effect validates:

  • Create: patient_id is required and must reference an existing patient
  • Create: Either facility_id or facility creation fields must be provided (not both)
  • Create: If facility_id is provided, it must reference an existing facility
  • Create: If creating a new facility, all required facility fields must be provided
  • Update/Delete: id is required and must reference an existing patient facility address
  • Update: If updating facility, same rules apply as create (facility_id OR creation fields)
  • address_type must be “physical” or “both” if provided

Example Usage #

Creating with Existing Facility #

from canvas_sdk.effects.patient_facility_address import PatientFacilityAddress, AddressType
from canvas_sdk.handlers.base import BaseHandler


class MyHandler(BaseHandler):
    def compute(self):
        effect = PatientFacilityAddress(
            patient_id="patient-uuid-here",
            facility_id="facility-uuid-here",
            room_number="101A",
            address_type=AddressType.PHYSICAL,
        )
        return [effect.create()]

Creating with New Facility #

from canvas_sdk.effects.patient_facility_address import PatientFacilityAddress, AddressType
from canvas_sdk.handlers.base import BaseHandler


class MyHandler(BaseHandler):
    def compute(self):
        effect = PatientFacilityAddress(
            patient_id="patient-uuid-here",
            facility_name="Downtown Medical Center",
            facility_line1="123 Main Street",
            facility_line2="Suite 400",
            facility_city="Boston",
            facility_state_code="MA",
            facility_postal_code="02101",
            facility_phone_number="617-555-1234",
            facility_npi_number="1234567890",
            room_number="Room 205",
            address_type=AddressType.PHYSICAL,
        )
        return [effect.create()]

Updating an Existing Address #

from canvas_sdk.effects.patient_facility_address import PatientFacilityAddress
from canvas_sdk.handlers.base import BaseHandler


class MyHandler(BaseHandler):
    def compute(self):
        # Update to use a different existing facility
        effect = PatientFacilityAddress(
            id="existing-address-uuid",
            facility_id="new-facility-uuid",
            room_number="202B",
        )
        return [effect.update()]

Deleting an Address #

from canvas_sdk.effects.patient_facility_address import PatientFacilityAddress
from canvas_sdk.handlers.base import BaseHandler


class MyHandler(BaseHandler):
    def compute(self):
        effect = PatientFacilityAddress(
            id="existing-address-uuid",
        )
        return [effect.delete()]

Notes #

  • The address details (line1, line2, city, state, country, postal_code) displayed for a patient facility address are automatically populated from the linked facility’s address information.
  • When a facility’s address is updated, all linked patient facility addresses are automatically updated to match. This synchronization happens asynchronously and applies to line1, line2, city, district, state_code, postal_code, and country fields. Non-address changes to the facility (such as name, NPI number, or phone number) do not trigger this cascade.
  • When creating a new facility inline, the facility is created first, then linked to the patient facility address.
  • Room number is optional and can be used to specify the patient’s specific room within the facility.