synthma

package
v0.0.0-...-7dca2ca Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConditionCodeBSONBuilder = func(param search.SearchParam, searcher *search.MongoSearcher) (object bson.M, err error) {

	cc, ok := param.(*ConditionCodeParam)
	if !ok {
		return nil, errors.New("Expected a ConditionCodeParam")
	}

	// First get a list of patient IDs for this condition
	var subjectWrappers []struct {
		Subject *models.Reference `bson:"subject,omitempty"`
	}
	if err := searcher.GetDB().C("conditions").Find(bson.M{"code.coding.code": cc.Code}).Select(bson.M{"_id": 0, "subject": 1}).All(&subjectWrappers); err != nil {
		return nil, err
	}

	patientIds := []string{}
	for _, wrapper := range subjectWrappers {
		if wrapper.Subject.Type == "Patient" {
			patientIds = append(patientIds, wrapper.Subject.ReferencedID)
		}
	}

	return bson.M{
		"_id": bson.M{
			"$in": patientIds,
		},
	}, nil
}

ConditionCodeBSONBuilder builds the Mongo BSON object corresponding to the query by Patient condition.

View Source
var ConditionCodeParamInfo = search.SearchParamInfo{
	Resource: "Patient",
	Name:     "condition-code",
	Type:     "synthma.patient_condition_code",
}

ConditionCodeParamInfo represents the condition-code for Patients' conditions. This allows patients to be searched by conditions they have.

View Source
var ConditionCodeParamParser = func(info search.SearchParamInfo, data search.SearchParamData) (search.SearchParam, error) {
	return &ConditionCodeParam{
		TokenParam: *search.ParseTokenParam(data.Value, info),
	}, nil
}

ConditionCodeParamParser parses the parameter and returns a ConditionCodeParam.

Functions

This section is empty.

Types

type ConditionCodeParam

type ConditionCodeParam struct {
	search.TokenParam
}

ConditionCodeParam represents the condition-code search parameter. Patient's may be searched by conditions they have using a combination of system and code. This behaves exactly the same as a standard TokenParam. See: http://hl7.org/fhir/2016Sep/search.html#token

Jump to

Keyboard shortcuts

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