ptgen

package module
v0.0.0-...-db3026e Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

README

FHIR Patient Generator Build Status

The ptgen project is a (partial) Go port of https://github.com/jnazarian1/Patient-Generator. This Go library generates synthetic patient records using the HL7 FHIR DSTU2 models defined in the Intervention Engine fhir project.

NOTE: Due to Intervention Engine's prominent use case, all synthetic records are tuned to a geriatric population. At this time, patient demographics, simple observations, office visits, conditions, and medications are generated.

Building ptgen Locally

For information on installing and running the full Intervention Engine stack, please see Building and Running the Intervention Engine Stack in a Development Environment.

The ptgen project is a Go library. For information related specifically to building the code in this repository (ptgen), please refer to the following sections in the above guide:

To build the ptgen library, you must install its dependencies via go get first, and then build it:

$ cd $GOPATH/src/github.com/intervention-engine/ptgen
$ go get
$ go build

For information on using the generate tool to create synthetic patient records and upload them to a FHIR server, please refer to the generate section of the tools repository README.

Using ptgen as a library

The following is a simple example of generating the FHIR resources to represent a single synthetic patient:

import "github.com/intervention-engine/ptgen"

func ExamplePtGeneration() []interface{} {
	return ptgen.GeneratePatient()
}

License

Copyright 2016 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func GenerateAddress

func GenerateAddress() models.Address

func GenerateBP

func GenerateBP(ctx Context) []models.Observation

func GenerateBloodSugars

func GenerateBloodSugars(ctx Context) []models.Observation

func GenerateCholesterol

func GenerateCholesterol(ctx Context) []models.Observation

func GenerateConditions

func GenerateConditions(ctx Context, md []ConditionMetadata) []models.Condition

func GenerateDemographics

func GenerateDemographics() models.Patient

func GenerateMedication

func GenerateMedication(medicationID int, onset *models.FHIRDateTime, abatement *models.FHIRDateTime, mmd []MedicationMetadata) *models.MedicationStatement

func GeneratePatient

func GeneratePatient() []interface{}

func GenerateQuantity

func GenerateQuantity(min, max int) *models.Quantity

func GenerateWeightAndHeight

func GenerateWeightAndHeight(ctx Context) []models.Observation

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RandomBirthDate

func RandomBirthDate() time.Time

RandomBirthDate generates a random birth date between 65 and 85 years ago

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type ConditionMetadata

type ConditionMetadata struct {
	ID                   int    `json:"condition_id"`
	ICD9                 string `json:"icd9code"`
	Display              string `json:"display"`
	MedicationID         int    `json:"medication_id"`
	Overnights           string `json:"overnights"`
	AbatementChance      int    `json:"abatementChance"`
	Fatal                bool   `json:"healOrDeath"`
	MortalityChance      int    `json:"mortalityChance"`
	MortalityTime        string `json:"mortalityTime"`
	RecoveryEstimate     string `json:"recoveryEstimate"`
	ProcedureChance      int    `json:"procedureChance"`
	ProcedureSuccess     int    `json:"procedureSuccess"`
	CheckUp              string `json:"checkUp"`
	ProcedureDescription string `json:"procedureDescription"`
	ProcedureCode        string `json:"procedureCode"`
	ProcedureName        string `json:"procedureCodeName"`
}

func LoadConditions

func LoadConditions() []ConditionMetadata

type Context

type Context struct {
	Smoker       string
	Hypertention string
	Alcohol      string
	Cholesterol  string
	Diabetes     string
	Height       int
	Weight       int
	BirthDate    time.Time
}

Context contains information about the patient that can be used when generating information

func NewContext

func NewContext() Context

NewContext generates a new context with randomly populated content

type MedicationMetadata

type MedicationMetadata struct {
	ID         int    `json:"medication_id"`
	RxNormCode string `json:"rxNormCode"`
	BrandName  string `json:"brandName"`
	TradeName  string `json:"tradeName"`
}

func LoadMedications

func LoadMedications() []MedicationMetadata

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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