Real Time Information Director User Documentation
    RTID Metadata Language 
Hewlett-Packard Company  69  529618-002   
Using Dependent Links to Select Child Records 
Although the <KEYS> section of a query is of crucial importance for selecting records, 
related (child) records must be selected by other means. For example, consider the 
following query document, called ChinnQueryMichaelEventsHistory.xml, in the folder 
C:\rtid\chin\inputs: 
<PATIENTEVENTSHISTORY_R> 
  <HEADER> 
    . . . 
  </HEADER> 
  <KEYS> 
  <EXTERNALIDENTIFIER>PAT00002</EXTERNALIDENTIFIER> 
  <IDENTIFIERTYPECODE>CRN</IDENTIFIERTYPECODE> 
  </KEYS> 
</PATIENTEVENTSHISTORY_R> 
The keys make it possible to retrieve information for a person using the person’s external 
identifier as a key. But only the PERSON table contains the EXTERNALIDENTIFIER value. 
The nested ENCOUNTER table is keyed by the UNIQUEIDENTIFIER column, which is 
not provided in the input keys. To make it possible to retrieve medical-encounter 
information, the document definition uses an object called DependentLinks, as shown in 
the following excerpt from the file PatientEventsHistory.java. This document definition 
refers to several enriched records defined in the file EHR.java. 
private static DocumentRecord documentRecord = 
new DocumentRecord(EHR.personRecord, new RelatedRecords[] { 
  new RelatedRecords(EHR.encounterRecord, new 
DependentLinks("UNIQUEIDENTIFIER"), new RelatedRecords[] { 
new RelatedRecords(EHR.externalChartEntryRecord, new 
RelatedRecords[] { 
… 
 } 
} 
The DependentLinks metadata object specifies that only the ENCOUNTER records that 
have the same UNIQUEIDENTIFIER value as the PERSON record are selected.  In other 
words, the top-level PERSON record is selected based on the KEYS values from the 
input. That record also contains a value for UNIQUEIDENTIFIER, which correlates 
with the EXTERNALIDENTIFIER value in the input. Thus child records of PERSON should 
be selected only if the value of UNIQUEIDENTIFIER in the child record matches the 
value of UNIQUEIDENTIFIER in the parent record. 
Incidentally, if you look at the file EHR.java, you’ll see that the definition of 
externalChartEntryRecord uses the OrderBy enrichment to control the order of output 
records.  In this case, Encounter records are returned in descending order by the date. 










