Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GroupBSONBuilder = func(param search.SearchParam, searcher *search.MongoSearcher) (object bson.M, err error) { gp, ok := param.(*GroupParam) if !ok { return nil, errors.New("Expected a GroupParam") } // First get the group var groupID string if bson.IsObjectIdHex(gp.Code) { groupID = bson.ObjectIdHex(gp.Code).Hex() } else { return nil, fmt.Errorf("Invalid BSON ID: %s", gp.Code) } var group fhir.Group if err := searcher.GetDB().C("groups").Find(bson.M{"_id": groupID}).One(&group); err != nil { return nil, err } if group.Actual != nil && *group.Actual { // Return a BSON object (for patient) indicating the ID can be any of those in the group var ids []string for _, m := range group.Member { if m.Entity != nil && m.Entity.Type == "Patient" && m.Entity.ReferencedID != "" { ids = append(ids, m.Entity.ReferencedID) } } return bson.M{ "_id": bson.M{ "$in": ids, }, }, nil } info, err := LoadCharacteristicInfo(group.Characteristic) if err != nil { return nil, err } if !info.HasConditionCharacteristics && !info.HasEncounterCharacteristics { q := search.Query{Resource: "Patient", Query: info.PatientQueryValues.Encode()} return searcher.CreateQueryObject(q), nil } ids, err := resolveGroup(info, searcher) if err != nil { return nil, err } return bson.M{ "_id": bson.M{ "$in": ids, }, }, nil }
GroupBSONBuilder builds the Mongo BSON object corresponding to the query for group membership.
var GroupParamInfo = search.SearchParamInfo{
Resource: "Patient",
Name: "groupId",
Type: "ie.group",
}
GroupParamInfo represents the "groupId" parameter on patients. This allows patients to be searched by their membership to a group. Their membership may be explicit (they are explicitly named as a member of a group) or implicit (they match characteristics criteria of a group).
var GroupParamParser = func(info search.SearchParamInfo, data search.SearchParamData) (search.SearchParam, error) { return &GroupParam{ TokenParam: *search.ParseTokenParam(data.Value, info), }, nil }
GroupParamParser parses the parameter and returns a GroupParam
var QueryBSONBuilder = func(param search.SearchParam, searcher *search.MongoSearcher) (object bson.M, err error) { qp, ok := param.(*QueryParam) if !ok { return nil, errors.New("Expected a QueryParam") } if qp.String != "group" { return nil, fmt.Errorf("Unknown _query type: %s", qp.String) } return bson.M{}, nil }
QueryBSONBuilder returns an empty BSON object unless it detects an invalid query type
var QueryParamInfo = search.SearchParamInfo{
Resource: "Patient",
Name: "_query",
Type: "ie.noop",
}
QueryParamInfo represents the info for the Patient._query parameter.
var QueryParamParser = func(info search.SearchParamInfo, data search.SearchParamData) (search.SearchParam, error) { return &QueryParam{ StringParam: *search.ParseStringParam(data.Value, info), }, nil }
QueryParamParser parses the parameter and returns a QueryParam
Functions ¶
func InstaCountAllHandler ¶
Types ¶
type CharacteristicInfo ¶
type CharacteristicInfo struct { PatientQueryValues url.Values HasPatientCharacteristics bool ConditionQueryValues url.Values HasConditionCharacteristics bool EncounterQueryValues url.Values HasEncounterCharacteristics bool }
func LoadCharacteristicInfo ¶
func LoadCharacteristicInfo(characteristics []fhir.GroupCharacteristicComponent) (*CharacteristicInfo, error)
type GroupParam ¶
type GroupParam struct {
search.TokenParam
}
GroupParam represents the group parameter. Since this is an id, we simply embed a TokenParam. After fhir search is fully refactored, we may be able to get rid of GroupParam and just return a TokenParam from the parser.
type QueryParam ¶
type QueryParam struct {
search.StringParam
}
QueryParam represents the _query parameter. This exists only to provide backwards compatibility for the frontend, which sends "_query=group". Without this, the FHIR server would reject the _query parameter as unsupported. Since this is a string, we simply embed a StringParam. After fhir search is fully refactored, we may be able to get rid of GroupParam and just return a StringParam from the parser.