Real Time Information Director User Documentation
RTID Metadata Language
Hewlett-Packard Company 70 529618-002
Using a Lookup Table to Select Data for a Person
The previous example showed how to select data for a single person based on an
EXTERNALIDENTIFIER value provided in the input document. But what if the external
identifier is not recognized? Is this a new patient who needs to be registered, or was the
same person registered earlier under another identifier. In such a case, we can resolve the
UNIQUEIDENTIFIER column by using a lookup table.
For example, consider the PatientByDOB.java document definition:
new RequestRecord("DATEOFBIRTH POSTCODE FAMILYNAME",
new RelatedRecords("PLOOKUP", new CompoundEnrichment(new
Enrichment[] {
. . .
}
)}
As specified by the RequestRecord metadata class, the input file is expected to contain
three keys: the date of birth, the postal code, and the family name. These columns are
used to select one or more rows in the PLOOKUP table, which contain values for the
UNIQUEIDENTIFIER column. The output to this query might contain zero, one or
more records; for example, twins would have the same date of birth, postal code, and
family name. The client displays the results on the screen, so the operator can select the
one that applies (if any). If the patient is already registered under another external
identifier, the new external identifier is recorded and correlated with the internal
identifier for the same person; if not, this is a brand-new registration.
Limiting Output to Specified Columns
The PatientEventsHistory.java document definition returns all columns from all tables
included in the definition. But what if only some of the data is of interest to the client?
To limit a query response to an explicit set of columns, the Director uses LeftJoin and
ColumnList metadata.
For example, consider the PatientByDOB.java document definition:
new RelatedRecords("PLOOKUP", new CompoundEnrichment(new
Enrichment[] {
new Alias("PL"),
new LeftJoin("PERSON", "P", " PL.UNIQUEIDENTIFIER =
P.UNIQUEIDENTIFIER "),
new LeftJoin("NAME", "NAME", " PL.UNIQUEIDENTIFIER =
NAME.UNIQUEIDENTIFIER "),
new LeftJoin("ADDRESSES", "ADDR", "PL.UNIQUEIDENTIFIER =
ADDR.UNIQUEIDENTIFIER"),
new LeftJoin("CONSUMERMATCHING", "CM", "PL.UNIQUEIDENTIFIER =
CM.UNIQUEIDENTIFIER"),
new ColumnList("P.EXTERNALIDENTIFIER P.IDENTIFIERTYPECODE
NAME.GIVENNAMES" + "CM.SEX ADDR.ADDRESSTYPE ADDR.PROPERTYNUMBER
ADDR.STREET ADDR.SUBURB ADDR.STATE")
})