### authorize(env, params) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Initiates the SMART authorization flow. This function is called to start the OAuth2 authorization process with the specified environment and parameters. ```APIDOC ## authorize(env, params) ### Description Initiates the SMART authorization flow. ### Method authorize ### Parameters - **env** (object) - Required - The environment configuration. - **params** (object) - Required - Authorization parameters. ### Response Returns a promise that resolves when authorization is complete. ``` -------------------------------- ### getFhirVersion() Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Gets the FHIR version string from the server. Returns a Promise that resolves to the version string. ```APIDOC ## Method: getFhirVersion() ### Description Get FHIR version string. ### Returns `Promise` - The FHIR version string. ### Example No example provided. ``` -------------------------------- ### getFhirRelease() Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Gets the numeric FHIR version from the server. Returns a Promise that resolves to 2, 3, 4, or 0. ```APIDOC ## Method: getFhirRelease() ### Description Get numeric FHIR version. ### Returns `Promise` - The numeric FHIR version (2, 3, 4, or 0). ### Example No example provided. ``` -------------------------------- ### Delete Operation Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Deletes a FHIR resource by its URI. Example: client.delete("Patient/123"). ```APIDOC ## Delete Operation ### Description Deletes a FHIR resource by its URI. Example: client.delete("Patient/123"). ### Method DELETE ### Endpoint (Not specified in source) ### Parameters #### Path Parameters - **uri** (string) - Required - The URI of the resource to delete, e.g., "Patient/123". ### Response #### Success Response (Not specified in source) ``` -------------------------------- ### init(env, authorizeOptions, readyOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Initializes the SMART API by performing authorization and then waiting for readiness. This is a convenience function that combines authorize and ready. ```APIDOC ## init(env, authorizeOptions, readyOptions) ### Description Initializes the SMART API by performing authorization and then waiting for readiness. ### Method init ### Parameters - **env** (object) - Required - The environment configuration. - **authorizeOptions** (object) - Required - Options for the authorize step. - **readyOptions** (object) - Optional - Options for the ready step. ### Response Returns a promise that resolves when initialization is complete. ``` -------------------------------- ### ready(env, options) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Completes the authorization process by exchanging the authorization code for access tokens and creating an authenticated Client instance. Validates authorization response parameters and handles popup/iframe completion scenarios. ```APIDOC ## ready(env, options) ### Description Completes the authorization process by exchanging the authorization code for access tokens and creating an authenticated Client instance. ### Method ready ### Parameters - **env** (object) - Required - Environment object containing configuration. - **options** (object) - Required - Options for completing authorization. ### Response Returns an authenticated Client instance. ### Key Implementation Details - Validates authorization response parameters (`code`, `state`, `error`) - Exchanges authorization code for access tokens using `buildTokenRequest` - Handles popup/iframe completion scenarios - Creates and returns authenticated Client instance ``` -------------------------------- ### init(env, authorizeOptions, readyOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Combines `authorize` and `ready` into a single function for handling authorization on one page, useful when `launch_uri` equals `redirect_uri`. It checks for existing authorization code/state in URL, calls `ready()` if present, checks for cached client state, otherwise calls `authorize()`. ```APIDOC ## init(env, authorizeOptions, readyOptions) ### Description Combines `authorize` and `ready` into a single function for handling authorization on one page, useful when `launch_uri` equals `redirect_uri`. ### Method init ### Parameters - **env** (object) - Required - Environment object containing configuration. - **authorizeOptions** (object) - Required - Options for the authorize step. - **readyOptions** (object) - Required - Options for the ready step. ### Response Returns an authenticated Client instance or redirects to authorization server. ### Implementation Logic - Checks for existing authorization code/state in URL - If present, calls `ready()` to complete authorization - If absent, checks for cached client state - Otherwise, calls `authorize()` to start the flow ``` -------------------------------- ### ready(env, options) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Waits for the SMART API to be ready. This function is used to ensure the API is initialized before making further calls. ```APIDOC ## ready(env, options) ### Description Waits for the SMART API to be ready. ### Method ready ### Parameters - **env** (object) - Required - The environment configuration. - **options** (object) - Optional - Additional options. ### Response Returns a promise that resolves when the API is ready. ``` -------------------------------- ### authorize(env, params) Source: https://deepwiki.com/smart-on-fhir/client-js/3.1-smart-api Initiates the SMART Launch Sequence by discovering OAuth endpoints and redirecting to the authorization server. Handles both single configuration and multiple EHR configurations, implements PKCE security, and supports various launch scenarios. ```APIDOC ## authorize(env, params) ### Description Initiates the SMART Launch Sequence by discovering OAuth endpoints and redirecting to the authorization server. ### Method authorize ### Parameters - **env** (object) - Required - Environment object containing configuration. - **params** (object) - Required - Parameters for the authorization request. ### Response Redirects to the authorization server. ### Key Implementation Details - Handles both single configuration and multiple EHR configurations - Discovers OAuth endpoints via `.well-known/smart-configuration` or CapabilityStatement - Implements PKCE (Proof Key for Code Exchange) security - Supports various launch scenarios (EHR launch, standalone launch, development modes) ``` -------------------------------- ### ready(options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Completes authorization and returns a client. Returns a Promise that resolves to a Client. ```APIDOC ## ready(options?) ### Description Completes authorization and returns a client. ### Method ready ### Parameters - **options** (optional) - Additional options for completing authorization. ### Returns `Promise` ``` -------------------------------- ### init(options) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference One-page authorization flow. Returns a Promise that resolves to never or a Client. ```APIDOC ## init(options) ### Description One-page authorization flow. ### Method init ### Parameters - **options** (AuthorizeParams) - Required - Configuration options for the authorization flow. ### Returns `Promise` ``` -------------------------------- ### authorize(options) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Initiates the SMART launch sequence. Returns a Promise that resolves to a string or void. ```APIDOC ## authorize(options) ### Description Initiates the SMART launch sequence. ### Method authorize ### Parameters - **options** (AuthorizeParams) - Required - Configuration options for starting an authorization flow. ### Returns `Promise` ``` -------------------------------- ### client.getState() Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Provides access to the internal client state. This method safely handles undefined intermediate properties, unlike direct property access which would throw errors. ```APIDOC ## client.getState() ### Description Provides access to the internal client state. This method safely handles undefined intermediate properties, unlike direct property access which would throw errors. ### Method getState ### Parameters None ### Response No explicit response schema provided. ``` -------------------------------- ### client.create(resource, options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Creates a new FHIR resource. ```APIDOC ## client.create(resource, options?) ### Description Creates a new FHIR resource. ### Method create ### Parameters - **resource** (Resource) - Required - The resource object to create. - **options** (RequestOptions) - Optional - Request options. ``` -------------------------------- ### encounter.read(requestOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Reads the current encounter resource from the FHIR server. Returns a Promise that resolves to the Encounter resource or rejects if no encounter context is available. ```APIDOC ## encounter.read(requestOptions) ### Description Reads the current encounter resource from the FHIR server. Returns a Promise that resolves to the Encounter resource or rejects if no encounter context is available. ### Parameters - **requestOptions** (object) - Optional - Request options for the FHIR read operation. ### Returns - **Promise** - Resolves to the Encounter resource. ``` -------------------------------- ### Encounter Context Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Provides access to the current encounter. Includes properties for encounter ID and reading the encounter resource. ```APIDOC ## Encounter Context ### Description Provides access to the current encounter. Includes properties for encounter ID and reading the encounter resource. ### Properties - **client.encounter.id** (string|null) - Encounter ID or null if not available. - **client.encounter.read()** (function) - Fetches the encounter resource. ``` -------------------------------- ### Create Operation Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Creates a new FHIR resource on the server. The resource parameter should be a complete FHIR resource object. ```APIDOC ## Create Operation ### Description Creates a new FHIR resource on the server. The resource parameter should be a complete FHIR resource object. ### Method POST ### Endpoint (Not specified in source) ### Parameters #### Request Body - **resource** (object) - Required - A complete FHIR resource object to create. ### Response #### Success Response (Not specified in source) ``` -------------------------------- ### client(state) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Creates a client from state. Returns a Client. ```APIDOC ## client(state) ### Description Creates a client from state. ### Method client ### Parameters - **state** - Required - State used to create the client. ### Returns `Client` ``` -------------------------------- ### user.read(requestOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Reads the current user resource from the FHIR server using the fhirUser reference. ```APIDOC ## user.read(requestOptions) ### Description Reads the current user resource from the FHIR server using the `fhirUser` reference. ### Parameters - **requestOptions** (object) - Optional - Request options for the FHIR read operation. ### Returns - **Promise** - Resolves to the user resource. ``` -------------------------------- ### client.user.read() Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Fetches the user resource for the current user context. Returns a Promise that resolves to the user FHIR resource. ```APIDOC ## Method: client.user.read() ### Description Fetch user resource. ### Returns `Promise` - The user FHIR resource. ### Example No example provided. ``` -------------------------------- ### client.refresh(requestOptions = {}) Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Force refresh the access token. This method is part of the manual token management options provided by the Client API. ```APIDOC ## client.refresh(requestOptions = {}) ### Description Force refresh the access token. ### Method refresh ### Parameters #### Request Options - **requestOptions** (object) - Optional - Options for the refresh request. ### Response No explicit response schema provided. ``` -------------------------------- ### patient.request(requestOptions, fhirOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Performs a patient-contextualized request. Automatically filters the request by the current patient by extracting the resource type from the URL, validating patient compartment support, fetching the conformance statement to determine the correct search parameter, and adding the patient filter to the request's search parameters. ```APIDOC ## patient.request(requestOptions, fhirOptions) ### Description Performs a patient-contextualized request. Automatically filters the request by the current patient. ### Parameters - `requestOptions` (object) - Required - Options for the request. - `fhirOptions` (object) - Optional - FHIR-specific options. ### Contextualization Process 1. Extracts the resource type from the URL path. 2. Validates that the resource type supports patient compartment filtering. 3. Fetches the server's conformance statement to determine the correct patient search parameter. 4. Adds the patient filter to the request's search parameters. ``` -------------------------------- ### client.request(uri, fhirOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference The foundation of all FHIR interactions. Handles authentication, token refresh, pagination, reference resolution, and other FHIR-specific concerns. ```APIDOC ## client.request(uri, fhirOptions) ### Description The foundation of all FHIR interactions. Handles authentication, token refresh, pagination, reference resolution, and other FHIR-specific concerns. ### Method request ### Parameters #### Request Options - **uri** (string | URL | RequestOptions) - Required - Target URL or request configuration. - **fhirOptions** (FhirOptions) - Required - FHIR-specific options. #### FHIR Options - **pageLimit** (number) - Optional - Number of pages to fetch (0 = all). Default: 1. - **onPage** (Function) - Optional - Callback for processing pages. - **flat** (boolean) - Optional - Return resources array instead of bundle. Default: false. - **resolveReferences** (string | string[]) - Optional - References to resolve automatically. - **graph** (boolean) - Optional - Mount resolved references in result tree. Default: true. - **useRefreshToken** (boolean) - Optional - Automatically refresh expired tokens. Default: true. - **includeResponse** (boolean) - Optional - Include Response object in result. Default: false. ``` -------------------------------- ### client.encounter.read() Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Fetches the encounter resource for the current encounter context. Returns a Promise that resolves to the encounter FHIR resource. ```APIDOC ## Method: client.encounter.read() ### Description Fetch encounter resource. ### Returns `Promise` - The encounter FHIR resource. ### Example No example provided. ``` -------------------------------- ### client.getState(path="") Source: https://deepwiki.com/smart-on-fhir/client-js/3.4-utility-methods Provides safe access to the client's internal state with optional path-based selection. Returns a copy of the client state when called without arguments, or a specific property when a path is provided. ```APIDOC ## client.getState(path="") ### Description Provides safe access to the client's internal state with optional path-based selection. ### Method `client.getState(path="") → any` ### Parameters - **path** (string) - Optional - Dot-notation path to a specific state property. Defaults to empty string. ### Response Returns a copy of the client state when called without arguments, or a specific property when a path is provided. ``` -------------------------------- ### client.request() Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api The core method for making FHIR HTTP requests. It handles all communication with FHIR servers and supports pagination, reference resolution, and automatic token refresh. ```APIDOC ## client.request() ### Description The `client.request()` method is the single most important method in the Client API. It handles all HTTP communication with FHIR servers and provides advanced features like pagination, reference resolution, and automatic token refresh. ### Method Not specified (HTTP-based) ### Endpoint Not specified (dynamic based on request) ### Parameters #### Request Options (fhirOptions object) - **pageLimit** (Number) - Optional - Default: 1 - Number of pages to fetch (0 = all pages) - **onPage** (Function) - Optional - Callback for handling pages as they arrive - **flat** (Boolean) - Optional - Default: false - Return array of resources instead of bundles - **graph** (Boolean) - Optional - Default: true - Mount resolved references in result tree - **resolveReferences** (String|String[]) - Optional - Reference paths to resolve - **useRefreshToken** (Boolean) - Optional - Default: true - Automatically refresh expired tokens - **includeResponse** (Boolean) - Optional - Default: false - Include raw Response object in result ### Response #### Success Response Returns different types based on the request and options: - **String** - When server returns text/plain (e.g., text files) - **Response** - When server returns non-JSON, non-text (e.g., PDF files) - **FHIR Resource** - For single resource request (e.g., `Patient/id`) - **FHIR Bundle** - For bundle request (e.g., `Patient` search) - **Array of Bundles** - When multiple pages requested (`pageLimit > 1`) - **Array of Resources** - When flattened bundle (`flat: true`) - **null** - When using onPage callback (streaming processing) - **{response, body}** - When using includeResponse (raw response access) ``` -------------------------------- ### encounter.id Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Returns the ID of the selected encounter or null if no encounter context is available. Requires the launch/encounter scope. ```APIDOC ## encounter.id ### Description Returns the ID of the selected encounter or `null` if no encounter context is available. ### Returns - **string | null** - The encounter ID or `null` if no encounter context is available. ``` -------------------------------- ### patient.read(requestOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Reads the current patient resource from the FHIR server. Returns a Promise that resolves to the Patient resource or rejects if no patient context is available. ```APIDOC ## patient.read(requestOptions) ### Description Reads the current patient resource from the FHIR server. Returns a Promise that resolves to the Patient resource or rejects if no patient context is available. ### Parameters - **requestOptions** (object) - Optional - Request options for the FHIR read operation. ### Returns - **Promise** - Resolves to the Patient resource. ``` -------------------------------- ### client.byCode(observations, property) Source: https://deepwiki.com/smart-on-fhir/client-js/3.4-utility-methods Groups resources by their coded values, creating a map structure for efficient lookups. Returns a map where keys are the coded values and values are arrays of matching resources. ```APIDOC ## client.byCode(observations, property) ### Description Groups resources by their coded values, creating a map structure for efficient lookups. ### Method `client.byCode(observations, property) → Object` ### Parameters - **observations** (Array) - Required - Array of FHIR resources (e.g., observations). - **property** (string) - Required - The property path to extract coded values from. ### Response Returns a map where keys are the coded values and values are arrays of matching resources. ``` -------------------------------- ### user.resourceType Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Returns the resource type of the authenticated user (e.g., "Practitioner", "Patient", "RelatedPerson"). ```APIDOC ## user.resourceType ### Description Returns the resource type of the authenticated user (e.g., `"Practitioner"`, `"Patient"`, `"RelatedPerson"`). ### Returns - **string** - The resource type of the authenticated user. ``` -------------------------------- ### client.units.{converter}({ code, value }) Source: https://deepwiki.com/smart-on-fhir/client-js/3.4-utility-methods Unit conversion utilities for common healthcare measurements, accessible through the `client.units` namespace. Each converter accepts an object with `code` and `value` properties and returns the converted numeric value. ```APIDOC ## client.units.{converter}({ code, value }) ### Description Unit conversion utilities for common healthcare measurements. ### Method `client.units.{converter}({ code, value }) → Number` ### Parameters - **code** (string) - Required - The unit code of the input value. - **value** (number) - Required - The numeric value to convert. ### Response Returns the converted numeric value. ### Available Converters - `client.units.cm()` - Length conversion to centimeters. Supported units: `cm`, `m`, `in`, `[in_us]`, `[in_i]`, `ft`, `[ft_us]`. - `client.units.kg()` - Weight conversion to kilograms. Supported units: `kg`, `g`, strings containing `lb`, strings containing `oz`. - `client.units.any()` - Generic numeric assertion. Returns input value if numeric. ``` -------------------------------- ### client.getPath(object, path) Source: https://deepwiki.com/smart-on-fhir/client-js/3.4-utility-methods Safely traverses object properties using dot-notation paths, returning undefined if any intermediate property does not exist. Useful for accessing nested FHIR resource data without runtime errors. ```APIDOC ## client.getPath(object, path) ### Description Safely traverses object properties using dot-notation paths, preventing errors when intermediate properties are undefined. ### Method `client.getPath(object, path) → any` ### Parameters - **object** (Object) - Required - The object to traverse. - **path** (string) - Required - Dot-notation path to the desired property. Array access uses numeric indices. ### Response Returns the value at the specified path, or `undefined` if any intermediate property does not exist. ``` -------------------------------- ### client.getFhirVersion() Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Returns FHIR version string from conformance statement. This method queries the server's conformance/capability statement to determine the supported FHIR version. ```APIDOC ## client.getFhirVersion() ### Description Returns FHIR version string from conformance statement. This method queries the server's conformance/capability statement to determine the supported FHIR version. ### Method getFhirVersion ### Parameters None ### Response No explicit response schema provided. ``` -------------------------------- ### getIdToken() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Decodes and returns the ID token claims. Returns null if not available. ```APIDOC ## getIdToken() ### Description Decodes and returns the ID token claims. ### Return Type `object | null` ``` -------------------------------- ### client.refresh(options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Refreshes the access token. Returns a Promise that resolves to an Object. ```APIDOC ## client.refresh(options?) ### Description Refreshes the access token. ### Method refresh ### Parameters - **options** (optional) - Options for refreshing the token. ### Returns `Promise` ``` -------------------------------- ### client.update(resource, options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Updates an existing FHIR resource. ```APIDOC ## client.update(resource, options?) ### Description Updates an existing FHIR resource. ### Method update ### Parameters - **resource** (Resource) - Required - The resource object to update. - **options** (RequestOptions) - Optional - Request options. ``` -------------------------------- ### client.byCodes(observations, property) Source: https://deepwiki.com/smart-on-fhir/client-js/3.4-utility-methods Creates a filter function for extracting resources with specific codes, providing a functional programming approach to resource filtering. The returned function accepts one or more code values and returns a flat array of matching resources. ```APIDOC ## client.byCodes(observations, property) ### Description Creates a filter function for extracting resources with specific codes. ### Method `client.byCodes(observations, property) → Function` ### Parameters - **observations** (Array) - Required - Array of FHIR resources. - **property** (string) - Required - The property path to extract coded values from. ### Response Returns a function that accepts one or more code values and returns a flat array of matching resources. ``` -------------------------------- ### client.user.resourceType Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Property that holds the user resource type. It is null if not available. ```APIDOC ## Property: client.user.resourceType ### Description User resource type. ### Type `string | null` ### Example No example provided. ``` -------------------------------- ### client.patient.read() Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Fetches the patient resource for the current patient context. Returns a Promise that resolves to the patient FHIR resource. ```APIDOC ## Method: client.patient.read() ### Description Fetch patient resource. ### Returns `Promise` - The patient FHIR resource. ### Example No example provided. ``` -------------------------------- ### User Context Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Provides access to the currently authenticated user. Includes properties for user ID, FHIR user identifier, resource type, and reading the user resource. ```APIDOC ## User Context ### Description Provides access to the currently authenticated user. Includes properties for user ID, FHIR user identifier, resource type, and reading the user resource. ### Properties - **client.user.id** (string) - User ID from token. - **client.user.fhirUser** (string) - User identifier like "Practitioner/id". - **client.user.resourceType** (string) - User resource type (Practitioner, Patient, etc.). - **client.user.read()** (function) - Fetches the user resource. ``` -------------------------------- ### client.getFhirRelease() Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Returns numeric FHIR version (2=DSTU2, 3=STU3, 4=R4, 0=unknown). This method queries the server's conformance/capability statement to determine the supported FHIR version. ```APIDOC ## client.getFhirRelease() ### Description Returns numeric FHIR version (2=DSTU2, 3=STU3, 4=R4, 0=unknown). This method queries the server's conformance/capability statement to determine the supported FHIR version. ### Method getFhirRelease ### Parameters None ### Response No explicit response schema provided. ``` -------------------------------- ### patient.id Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Returns the ID of the selected patient or null if no patient context is available. Requires the launch/patient scope. ```APIDOC ## patient.id ### Description Returns the ID of the selected patient or `null` if no patient context is available. ### Returns - **string | null** - The patient ID or `null` if no patient context is available. ``` -------------------------------- ### client.refreshIfNeeded(requestOptions = {}) Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Refresh the access token only if needed. This method is part of the manual token management options provided by the Client API. ```APIDOC ## client.refreshIfNeeded(requestOptions = {}) ### Description Refresh the access token only if needed. ### Method refreshIfNeeded ### Parameters #### Request Options - **requestOptions** (object) - Optional - Options for the refresh request. ### Response No explicit response schema provided. ``` -------------------------------- ### client.refreshIfNeeded(options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Conditionally refreshes the access token if needed. Returns a Promise that resolves to an Object. ```APIDOC ## client.refreshIfNeeded(options?) ### Description Conditionally refreshes the access token if needed. ### Method refreshIfNeeded ### Parameters - **options** (optional) - Options for refreshing the token. ### Returns `Promise` ``` -------------------------------- ### Patient Context Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Provides access to the currently selected patient. Includes properties for patient ID, reading the patient resource, making patient-scoped requests, and fhir.js integration. ```APIDOC ## Patient Context ### Description Provides access to the currently selected patient. Includes properties for patient ID, reading the patient resource, making patient-scoped requests, and fhir.js integration. ### Properties - **client.patient.id** (string|null) - The patient ID or null if not available. - **client.patient.read()** (function) - Fetches the patient resource. - **client.patient.request(options, fhirOptions)** (function) - Makes patient-scoped requests. Automatically adds appropriate search parameters to filter resources to the current patient. - **client.patient.api** (object) - fhir.js integration (if available). ``` -------------------------------- ### units.any(codeValue) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Pass-through validation for any unit. Returns the value unchanged. ```APIDOC ## Method: units.any(codeValue) ### Description Pass-through validation. ### Parameters - **codeValue** (string) - Required - The value to validate. ### Returns `any` - The value unchanged. ### Example No example provided. ``` -------------------------------- ### client.user.id Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Property that holds the user ID from the authorization flow. It is null if no user context is available. ```APIDOC ## Property: client.user.id ### Description User ID. ### Type `string | null` ### Example No example provided. ``` -------------------------------- ### client.user.fhirUser Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Property that holds the FHIR user reference (e.g., `Practitioner/123`). It is null if not available. ```APIDOC ## Property: client.user.fhirUser ### Description FHIR user reference (e.g., `Practitioner/123`). ### Type `string | null` ### Example No example provided. ``` -------------------------------- ### patient.request(requestOptions, fhirOptions) Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Makes FHIR requests that are automatically scoped to the current patient. This method contextualizes the request by adding appropriate patient filters to ensure results are limited to the current patient's compartment. ```APIDOC ## patient.request(requestOptions, fhirOptions) ### Description Makes FHIR requests that are automatically scoped to the current patient. This method contextualizes the request by adding appropriate patient filters to ensure results are limited to the current patient's compartment. ### Parameters - **requestOptions** (object) - Required - Request options for the FHIR request. - **fhirOptions** (object) - Optional - Additional FHIR options. ### Returns - **Promise** - Resolves to the FHIR response. ``` -------------------------------- ### client.delete(uri, options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Deletes a FHIR resource. ```APIDOC ## client.delete(uri, options?) ### Description Deletes a FHIR resource. ### Method delete ### Parameters - **uri** (string) - Required - The resource URL. - **options** (RequestOptions) - Optional - Request options. ``` -------------------------------- ### user.fhirUser Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Returns the full FHIR user reference in the format "{ResourceType}/{id}" (e.g., "Practitioner/123"). ```APIDOC ## user.fhirUser ### Description Returns the full FHIR user reference in the format `"{ResourceType}/{id}"` (e.g., `"Practitioner/123"`). ### Returns - **string** - The full FHIR user reference. ``` -------------------------------- ### getPath(object, path) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Safely accesses a property from an object using a path string. Returns the value at the path or undefined if not found. ```APIDOC ## Method: getPath(object, path) ### Description Safe property access. ### Parameters - **object** (Object) - Required - The object to access. - **path** (string) - Required - The path to the property. ### Returns `any` - The value at the path. ### Example No example provided. ``` -------------------------------- ### client.patient.request(url, options?) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Performs a patient-scoped request. Automatically adds patient filtering parameters to the URL: for `/Observation` it appends `?patient=patient-id`, and for `/Group` it appends `?member=patient-id`. ```APIDOC ## Method: client.patient.request(url, options?) ### Description Patient-scoped requests. Automatically adds patient filtering parameters. ### Parameters - **url** (string) - Required - The request URL. - **options** (object) - Optional - Request options. ### Returns `Promise` - The response object. ### Example No example provided. ``` -------------------------------- ### client.encounter.id Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Property that holds the selected encounter ID from the authorization flow. It is null if no encounter context is available. ```APIDOC ## Property: client.encounter.id ### Description Selected encounter ID. ### Type `string | null` ### Example No example provided. ``` -------------------------------- ### user.id Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Returns the user ID extracted from the fhirUser or profile claim in the ID token. ```APIDOC ## user.id ### Description Returns the user ID extracted from the `fhirUser` or `profile` claim in the ID token. ### Returns - **string** - The user ID. ``` -------------------------------- ### getPatientId() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Extracts the patient ID from the token response. Returns null if not available. ```APIDOC ## getPatientId() ### Description Extracts the patient ID from the token response. ### Return Type `string | null` ``` -------------------------------- ### units.kg(codeValue) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Converts a value with units to kilograms. Supported units: kg, g, lb, oz. ```APIDOC ## Method: units.kg(codeValue) ### Description Convert to kilograms. ### Parameters - **codeValue** (string) - Required - The value with units to convert. ### Returns `number` - The converted value in kilograms. ### Example No example provided. ``` -------------------------------- ### getUserType() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Extracts the user resource type from the FHIR user reference. Returns null if not available. ```APIDOC ## getUserType() ### Description Extracts the user resource type from the FHIR user reference. ### Return Type `string | null` ``` -------------------------------- ### getFhirUser() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Extracts the FHIR user reference from the ID token. Returns null if not available. ```APIDOC ## getFhirUser() ### Description Extracts the FHIR user reference from the ID token. ### Return Type `string | null` ``` -------------------------------- ### client.patient.id Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Property that holds the selected patient ID from the authorization flow. It is null if no patient context is available. ```APIDOC ## Property: client.patient.id ### Description Selected patient ID. ### Type `string | null` ### Example No example provided. ``` -------------------------------- ### getUserId() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Extracts the user ID from the FHIR user reference. Returns null if not available. ```APIDOC ## getUserId() ### Description Extracts the user ID from the FHIR user reference. ### Return Type `string | null` ``` -------------------------------- ### Update Operation Source: https://deepwiki.com/smart-on-fhir/client-js/3.2-client-api Updates an existing FHIR resource. The resource must include an id field to identify which resource to update. ```APIDOC ## Update Operation ### Description Updates an existing FHIR resource. The resource must include an id field to identify which resource to update. ### Method PUT ### Endpoint (Not specified in source) ### Parameters #### Request Body - **resource** (object) - Required - The FHIR resource to update, must include an `id` field. ### Response #### Success Response (Not specified in source) ``` -------------------------------- ### getEncounterId() Source: https://deepwiki.com/smart-on-fhir/client-js/3.3-context-apis Extracts the encounter ID from the token response. Returns null if not available. ```APIDOC ## getEncounterId() ### Description Extracts the encounter ID from the token response. ### Return Type `string | null` ``` -------------------------------- ### units.cm(codeValue) Source: https://deepwiki.com/smart-on-fhir/client-js/3-api-reference Converts a value with units to centimeters. Supported units: cm, m, in, ft. ```APIDOC ## Method: units.cm(codeValue) ### Description Convert to centimeters. ### Parameters - **codeValue** (string) - Required - The value with units to convert. ### Returns `number` - The converted value in centimeters. ### Example No example provided. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.