Real Time Information Director User Documentation
    RTID Metadata Language 
Hewlett-Packard Company  62  529618-002   
public static EnrichedRecord encounterRecord = 
 new EnrichedRecord("ENCOUNTER",  
 new PartitionedSystemKey("ENCOUNTERIDENTIFIER", 
"ENCOUNTERPID", 
 encounterIdDispenser,  
 new SystemKeyAffinity("UNIQUEIDENTIFIER", 
personIdDispenser))); 
Here is an excerpt from the document definition PatientEvents.java, defining the other 
records related to an Encounter. The metadata expresses the fact that whenever an 
Encounter record is inserted into the database, a corresponding ChartEntry record is 
inserted. (That is, for every input record representing a patient’s visit with a medical 
provider, a related entry is made in the patient’s medical record.) Moreover, for each 
ChartEntry, any of the following related records can be inserted: Observation, Tests, 
Medication, Immunization, Reports, or Referral. 
public class PatientEvents extends NativeDocumentDefinition 
{ 
  private static DocumentRecord documentRecord = 
 new DocumentRecord(EHR.externalEncounterRecord,  
 new RelatedRecords(EHR.chartEntryRecord, new 
RelatedRecords[] { 
 new RelatedRecords(EHR.observationRecord), 
 new RelatedRecords(EHR.testsRecord), 
 new RelatedRecords(EHR.medicationRecord), 
 new RelatedRecords(EHR.immunisationRecord), 
 new RelatedRecords(EHR.reportsRecord), 
 new RelatedRecords(EHR.referralRecord) 
 })); 
Because the ENCOUNTER record is the parent record, the Encounter identifier (which is 
created by the PartitionSystemKey enrichment) is propagated to all the children and 
grand children of the ENCOUNTER. 
Assigning Instance IDs to Child Records 
Some related records can repeat multiple times for any given input record. For example, 
the ChinnAddEvent2.xml sample file contains an Encounter record that has a ChartEntry 
dependent record, and the ChartEntry record contains eight dependent TESTS records. 
The dependent TESTS records are uniquely identified in the database by a TESTID 
column. EHR.java metadata provides for the TESTID column values to be automatically 
generated as follows: 
  public static EnrichedRecord testsRecord = 
    new EnrichedRecord("TESTS", new Enrichment[] { 
  encounterAffinityKey,  
  new InstanceId("TESTID") 
 }); 
The InstanceId assigns incrementing IDs for all repeating TESTS records within a 
CHARTENTRY record. Thus, the first TESTS record is assigned the TESTID value 1, 










