Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To access encounter variables, either loop through the ENCOUNTERS collection or use one of the properties or methods described below to obtain a reference to an Encounter object. At that point you can access a variable value with the encounter.#VariableCode syntax as described above.

See Examples.

Properties

  • Count – returns the number of encounters in the collection.
  • FirstEncounter – returns the first encounter in the collection. If no encounter is found, a null encounter is returned.
    • Example:    <%var dayStart = ENCOUNTERS.FirstEncounter.#VarCode %>.#EncounterDate.value; 
      • Sets the value of variable dayStart to the Encounter Date of the first encounter
  • LastEncounter – returns the last encounter in the collection. If no encounter is found, a null encounter is returned.
    • Example:  var dayEnd = ENCOUNTERS.LastEncounter.#EncounterDate.value;
      • Sets the value of variable dayEnd to the Encounter Date of the last encounter

Methods

  • Average(variableId) – returns the average value of the variable specified by variableId for all encounters in the collection. Returns NaN if any values are null.
  • Sum(variableId) – returns the sum of the variable specified by variableId for all encounters in the collection. Returns NaN if any values are null.
  • Filter(variableId, "compareOperator", compareValue) – returns a collection of encounters that are not excluded by the specified filter. The valid values for compareOperator are:
    • IS NOT NULL
    • IS NULL
    • =
    • !=
    • <>
    • <
    • <=
    • >
    • >=
      • Example: var filteredEnc = ENCOUNTERS.Filter(#IntervalName.ID,"=", "Clinic Visit");
        • The encounters are filtered to only include those named "Clinic Visit"
      • Example:  var sortedFilteredEnc = ENCOUNTERS.Filter(#IntervalName.ID, "=", "Clinic Visit").Sort(#EncounterDate.ID, true);
        • The encounters are filtered to only include those named "Clinic Visit" and they are sorted in ascending order by the Encounter Date (see sort information below)
  • GetCount(variableId) – returns the number of encounters in the collection that have a non-null value for the specified variableId.
  • GetEncounter(encounterDate) – returns the first encounter in the collection with the specified encounterDate if found, otherwise it returns a null encounter.
  • GetEncounter(encounterDateString) – attempts to convert the string to a date and then returns the first encounter in the collection with the specified encounterDate, if found, otherwise it returns a null encounter.
  • GetEncounter(index) – returns the encounter at the specified index in the collection. If the index is greater than the number of items in the collection, a null encounter is returned.
  • GetFirstEncounter()- returns the same as the FirstEncounter property. If no encounter is found, a null encounter is returned.
  • GetNextEncounter(encounterObject) – returns the encounter in the collection that follows the specified encounter. If no encounter is found, a null encounter is returned.
  • GetNextEncounter(encounterDate) – returns the encounter in the collection that follows the encounter with the specified date. If no encounter is found, a null encounter is returned.
  • GetNextEncounter(encounterDateString) – attempts to convert the string to a date and then returns the encounter in the collection that follows the encounter with the specified date. If no encounter is found, a null encounter is returned.
  • GetPriorEncounter(encounterObject) – returns the encounter in the collection that precedes the specified encounter. If no encounter is found, a null encounter is returned.
  • GetPriorEncounter(encounterDate) – returns the encounter in the collection that precedes the encounter with the specified date. If no encounter is found, a null encounter is returned.
  • GetPriorEncounter(encounterDateString) – attempts to convert the string to a date and then returns the encounter in the collection that precedes the encounter with the specified date. If no encounter is found, a null encounter is returned.
  • IndexOf(encounterObject) – returns the index of the specified encounter object. If no encounter is found, a null encounter is returned.
  • IndexOf(encounterDate) – returns the index of the first encounter with the specified encounterDate. If no encounter is found, a null encounter is returned.
  • IndexOf(encounterDateString) – attempts to convert the string to a date and then returns the index of the first encounter with the specified encounterDate. If no encounter is found, a null encounter is returned.
  • MaxEncounter(variableId) – returns the first encounter in the collection containing the max value for the specified variableId. If no encounter is found, a null encounter is returned.
  • MaxValue(variableId) – return the max value for the specified variableId. An empty string is returned if no values are found.
  • MinEncounter(variableId) – returns the first encounter in the collection containing the min value for the specified variableId. If no encounter is found, a null encounter is returned.
  • MinValue(variableId) – return the min value for the specified variableId. An empty string is returned if no values are found.
  • Offset(encounter, offset) – returns the encounter that is offset positions away from the specified encounter. If no encounter is found, a null encounter is returned. Offset can be negative. Ex.
    // returns the second to last encounter.
    ENCOUNTERS.Offset(ENCOUNTERS.LastEncounter, -1)* Offset(encounterDate, offset) – returns the encounter that is offset positions away from the encounter with the specified Date. If no encounter is found, a null encounter is returned. Offset can be negative.
  • Offset(encounterDateString, offset) – attempts to convert the string to a date and then returns the encounter that is offset positions away from the encounter with the specified Date. If no encounter is found, a null encounter is returned. Offset can be negative.
  • Sort(variableId, ascending) – returns a collection of encounters sorted by the values of the specified variableId. If ascending is true, the collection will be sorted in ascending order, otherwise it will be sorted in descending order.
    • Example: var encountersSorted = ENCOUNTERS.Sort(#EncounterDate.ID, true);
      • The ENCOUNTERS collection is sorted by Encounter Date in ascending order

Medication Object

Properties

...