fhirdataset

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBearerToken

func GetBearerToken() (string, error)

GetBearerToken logs in and gets a Google bearer auth token. The user referred to by `cloudhealthEmail` needs to have IAM permissions that allow them to read and write from the project's Cloud Healthcare base.

Types

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository accesses and updates patient data that is stored on Healthcare FHIR repository

func NewFHIRRepository

func NewFHIRRepository(_ context.Context, hsv *healthcare.Service, projectID, datasetID, datasetLocation, fhirStoreID string) *Repository

NewFHIRRepository initializes a FHIR repository

func (Repository) CreateDataset

func (fr Repository) CreateDataset() (*healthcare.Operation, error)

CreateDataset creates a dataset and returns it's name

func (Repository) CreateFHIRResource

func (fr Repository) CreateFHIRResource(resourceType string, payload map[string]interface{}, resource interface{}) error

CreateFHIRResource creates an FHIR resource.

The payload should be the result of marshalling a resource to JSON

func (Repository) CreateFHIRStore

func (fr Repository) CreateFHIRStore() (*healthcare.FhirStore, error)

CreateFHIRStore creates a FHIR store.

func (Repository) DeleteFHIRResource

func (fr Repository) DeleteFHIRResource(resourceType, fhirResourceID string) error

DeleteFHIRResource deletes an FHIR resource.

func (Repository) FHIRHeaders

func (fr Repository) FHIRHeaders() (http.Header, error)

FHIRHeaders composes suitable FHIR headers, with authentication and content type already set

func (Repository) FHIRRestURL

func (fr Repository) FHIRRestURL() string

FHIRRestURL composes a FHIR REST URL for manual calls to the FHIR REST API

func (Repository) GetDataset

func (fr Repository) GetDataset() (*healthcare.Dataset, error)

GetDataset gets a dataset.

func (Repository) GetFHIRPatientAllData

func (fr Repository) GetFHIRPatientAllData(fhirResourceID string) ([]byte, error)

GetFHIRPatientAllData gets all resources associated with a particular patient compartment.

func (Repository) GetFHIRResource

func (fr Repository) GetFHIRResource(resourceType, fhirResourceID string, resource interface{}) error

GetFHIRResource gets an FHIR resource.

func (Repository) GetFHIRStore

func (fr Repository) GetFHIRStore() (*healthcare.FhirStore, error)

GetFHIRStore gets an FHIR store.

func (Repository) POSTRequest

func (fr Repository) POSTRequest(
	resourceName string, path string, params url.Values, body io.Reader) ([]byte, error)

POSTRequest is used to manually compose POST requests to the FHIR service

- `resourceName` is a FHIR resource name e.g "Patient" - `path` is a sub-path e.g `_search` under a resource - `params` should be query params, sent as `url.Values`

func (Repository) PatchFHIRResource

func (fr Repository) PatchFHIRResource(
	resourceType, fhirResourceID string, payload map[string]interface{}, resource interface{}) error

PatchFHIRResource patches a FHIR resource. The payload is an instance of domain.FHIR<Resource>Input converted to a map[string]interface{} e.g. domain.FHIRPatientInput

This function first converts the payload to a JSON patch document that follows guidance on Patch from the FHIR standard. See:

patches := []map[string]interface{}{
	{
		"op":    "replace",
		"path":  "/<fieldName>",
		"value": newValue,
	},
}

See: https://www.hl7.org/fhir/http.html#patch

func (Repository) SearchFHIRResource

func (fr Repository) SearchFHIRResource(resourceType string, params map[string]interface{}, tenant dto.TenantIdentifiers, pagination dto.Pagination) (*domain.PagedFHIRResource, error)

SearchFHIRResource ...

func (Repository) UpdateFHIRResource

func (fr Repository) UpdateFHIRResource(
	resourceType, fhirResourceID string, payload map[string]interface{}, resource interface{}) error

UpdateFHIRResource updates the entire contents of a resource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL