Documentation ¶
Overview ¶
Package fhirstore contains utilities for interacting with GCP's FHIR store.
Index ¶
- Constants
- Variables
- type BundleError
- type BundleResponse
- type BundleResponses
- type Client
- func (c *Client) CheckGCSImportStatus(opName string) (isDone bool, err error)
- func (c *Client) ImportFromGCS(gcsURI string) (string, error)
- func (c *Client) UploadBatch(fhirJSONs [][]byte) error
- func (c *Client) UploadBundle(fhirBundleJSON []byte) error
- func (c *Client) UploadResource(fhirJSON []byte) error
- type Config
Constants ¶
const DefaultHealthcareEndpoint = "https://healthcare.googleapis.com/"
DefaultHealthcareEndpoint represents the default cloud healthcare API endpoint. This should be passed to UploadResource, unless in a test environment.
Variables ¶
var ErrorAPIServer = errors.New("error was received from the Healthcare API server")
ErrorAPIServer indicates that an error was received from the Healthcare API server.
Functions ¶
This section is empty.
Types ¶
type BundleError ¶
type BundleError struct { // ResponseStatusCode and ResponseStatusText hold the status for the bundle. // Within the bundle individual FHIR resources may have still failed to // upload. ResponseStatusCode int ResponseStatusText string ResponseBytes []byte }
BundleError represents an error returned from GCP FHIR Store when attempting to upload a FHIR bundle. The Bundle may succeed even if FHIR resources inside the bundle failed to upload. In that case ResponseStatusCode and ResponseStatusText hold the status of the bundle while ResponseBytes may have details on the individual resources.
func (*BundleError) Error ¶
func (b *BundleError) Error() string
Error returns a string version of error information.
func (*BundleError) Is ¶
func (b *BundleError) Is(target error) bool
Is returns true if this error should be considered equivalent to the target error (and makes this work smoothly with errors.Is calls)
type BundleResponse ¶
type BundleResponse struct { Response struct { Status string `json:"status"` Outcome struct { Issue json.RawMessage `json:"issue"` } `json:"outcome,omitempty"` } `json:"response"` }
BundleResponse holds a single FHIR Bundle response from the fhirService.ExecuteBundle call.
type BundleResponses ¶
type BundleResponses struct {
Entry []BundleResponse `json:"entry"`
}
BundleResponses holds the FHIR Bundle responses from the fhirService.ExecuteBundle call.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a FHIR store client that can be used to interact with GCP's FHIR store. Do not use this directly, call NewFHIRStoreClient to create a new one.
func (*Client) CheckGCSImportStatus ¶
CheckGCSImportStatus will check the long running GCS to FHIR store import job specified by opName, and return whether it is complete or not along with a possible error.
func (*Client) ImportFromGCS ¶
ImportFromGCS triggers a long-running FHIR store import job from a GCS location. Note wildcards can be used in the gcsURI, for example, gs://BUCKET/DIRECTORY/**.ndjson imports all files with .ndjson extension in DIRECTORY and its subdirectories.
This function returns the GCP long running op name, which can be passed to CheckGCSImportStatus to check the status of the long running import operation.
func (*Client) UploadBatch ¶
UploadBatch uploads the provided group of FHIR resources to the GCP FHIR store specified, and does so in "batch" mode assuming each FHIR resource is independent. The error returned may be an instance of BundleError, which provides additional structured information on the error.
func (*Client) UploadBundle ¶
UploadBundle uploads the provided json serialized FHIR Bundle to the GCP FHIR store specified. The error returned may be an instance of BundleError, which provides additional structured information on the error.
func (*Client) UploadResource ¶
UploadResource uploads the provided FHIR Resource to the GCP FHIR Store specified by projectID, location, datasetID, and fhirStoreID.
type Config ¶
type Config struct { // CloudHealthcareEndpoint is the base cloud healthcare API endpoint to be used for accessing this // FHIR store. For example, "https://healthcare.googleapis.com/". CloudHealthcareEndpoint string // ProjectID is the GCP project the FHIR Store belongs to. ProjectID string // Location is the GCP location the FHIR Store was created in. Location string // DatasetID is the GCP dataset this FHIR store is part of. DatasetID string // FHIRStoreID is the FHIR store identifier. FHIRStoreID string }
Config represents a FHIR Store configuration. It is passed to NewClient, but can also be used elsewhere to hold and represent FHIR Store configuration concepts.