person

package
v0.0.0-...-e69eef7 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Overview

Package person provides functionality to generate a person. This includes: - demographic information, ie: name, surname, gender, date of birth, ethnicity, etc. - address, telephone number, - NHS and MRN numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressGenerator

type AddressGenerator interface {
	Random() *ir.Address
}

AddressGenerator is an interface to generate addresses.

type EthnicityGenerator

type EthnicityGenerator struct {
	*sample.DiscreteDistribution
}

EthnicityGenerator generates ethnicity.

func NewEthnicityGenerator

func NewEthnicityGenerator(d *config.Data) EthnicityGenerator

NewEthnicityGenerator returns new EthnicityGenerator based on data provided.

func (EthnicityGenerator) Random

func (eg EthnicityGenerator) Random() *ir.Ethnicity

Random returns a random ethnicity, which can be nil.

type Generator

type Generator struct {
	Clock              clock.Clock
	NameGenerator      *names.Generator
	GenderConvertor    gender.Convertor
	EthnicityGenerator EthnicityGenerator
	AddressGenerator   AddressGenerator
	MRNGenerator       id.Generator
	Country            string
}

Generator is a generator of person.

func (Generator) NewPerson

func (g Generator) NewPerson(pathwayPerson *pathway.Person) *ir.Person

NewPerson returns a new person based on pathway.Person.

func (Generator) UpdatePersonFromPathway

func (g Generator) UpdatePersonFromPathway(person *ir.Person, pathwayPerson *pathway.Person)

UpdatePersonFromPathway updates a person with information from a pathway. Calling this method populates all fields of a Person, if they were not already set. Fields that are set in the pathway's person always override the original person's. Fields that are set in the original person, but not in the pathway, are kept as they are. Fields that are not set in any are generated randomly.

Jump to

Keyboard shortcuts

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