Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Javascript API for Rules and Transformations to DHIS 2 (1.1)

Volker edited this page Jun 13, 2019 · 3 revisions

The JavaScript library for rules and transformations from FHIR to DHIS 2 can be used as a reference or also included in a JavaScript editor for code completion. The FHIR resources that are used by this API are exposed by HAPI FHIR 3.7.0 API. For FHIR version DSTU3 the HAPI FHIR Model API for DSTU3 and for FHIR version R4 the HAPI FHIR Model API for R4 is used. The Adapter generates it automatically and it can be accessed from the following endpoint: http://localhost:8081/scripts/to-dhis2-all-mapping.js.

/*
 * Copyright (c) 2004-2019, University of Oslo
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * * Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * * Neither the name of the HISP project nor the names of its contributors may
 *   be used to endorse or promote products derived from this software without
 *   specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
 * Utilities to handle FHIR to DHIS2 transformations of human names.
 */
var HumanNameUtils = (function ()
{
  function HumanNameUtils()
  {
  }

  /**
   * Return the first single given name from the specified FHIR human name.
   * 
   * @param humanName The human name from which the first given name should be extracted.
   * @return The extracted first given name.
   */
  HumanNameUtils.prototype.getFirstGiven = function (humanName) {};

  /**
   * Extracts the name of the list of names that seems to be the most appropriate
   * name.
   * 
   * @param names The list of names from which one name should be extracted.
   * @return The extracted primary name.
   */
  HumanNameUtils.prototype.getPrimaryName = function (names) {};

  /**
   * Return the second single given name from the specified FHIR human name.
   * 
   * @param humanName The human name from which the second given name should be
   *                  extracted.
   * @return The extracted second given name.
   */
  HumanNameUtils.prototype.getSecondGiven = function (humanName) {};

  /**
   * Return a single given name from the specified FHIR human name. If the human name
   * contains multiple given names these are separated by space characters.
   * 
   * @param humanName The human name from which the single given name should be
   *                  extracted.
   * @return The extracted single given name.
   */
  HumanNameUtils.prototype.getSingleGiven = function (humanName) {};

  return HumanNameUtils;
}());
var humanNameUtils = new HumanNameUtils();

/**
 * Point geometry with a longitude and latitude.
 */
var Location = (function ()
{
  function Location()
  {
    /**
     * Returns the latitude of the point geometry.
     */
    this.latitude = null;

    /**
     * Returns the longitude of the point geometry.
     */
    this.longitude = null;

  }

  /**
   * @param o 
   * @return 
   */
  Location.prototype.equals = function (o) {};

  /**
   * Returns the latitude of the point geometry.
   * 
   * @return Returns the latitude of the point geometry.
   */
  Location.prototype.getLatitude = function () {};

  /**
   * Returns the longitude of the point geometry.
   * 
   * @return Returns the longitude of the point geometry.
   */
  Location.prototype.getLongitude = function () {};

  return Location;
}());

/**
 * Utilities to handle FHIR to DHIS2 transformations of FHIR resources.
 */
var FhirResourceUtils = (function ()
{
  function FhirResourceUtils()
  {
  }

  /**
   * Creates the FHIR resource (HAPI FHIR) with the specified resource type name.
   * 
   * @param resourceType The FHIR resource type name of the resource to be created (e.g.
   *                     Patient).
   * @return The created FHIR resource.
   */
  FhirResourceUtils.prototype.createResource = function (resourceType) {};

  /**
   * Returns the adapter reference by ID, code or name for the specified FHIR
   * reference (if this can be resolved).
   * 
   * @param reference    The FHIR reference for which the adapter reference should be
   *                     returned.
   * @param resourceType The FHIR resource type of the resource.
   * @return The adapter reference for the specified reference or null if it cannot
   *         be resolved.
   */
  FhirResourceUtils.prototype.getAdapterReference = function (reference, resourceType) {};

  /**
   * Returns the identified FHIR reference for the specified resource type for the
   * specified FHIR reference. The identified FHIR reference contains sufficient
   * information to lookup the resource in the current context but may not include
   * more information.
   * 
   * @param reference    The FHIR reference for which the identified should be returned.
   * @param resourceType The FHIR resource type of the resource.
   * @return The identified FHIR resource for the specified reference.
   */
  FhirResourceUtils.prototype.getIdentifiedReference = function (reference, resourceType) {};

  /**
   * Returns the identified FHIR resource with the specified resource type for the
   * specified FHIR reference. The identified FHIR resource contains sufficient
   * information to lookup the resource in the current context but may not include
   * more information.
   * 
   * @param reference    The FHIR reference for which the resource should be returned.
   * @param resourceType The FHIR resource type of the resource.
   * @return The identified FHIR resource for the specified reference.
   */
  FhirResourceUtils.prototype.getIdentifiedResource = function (reference, resourceType) {};

  /**
   * Returns the adapter reference by ID, code or name for the specified FHIR
   * reference (if this can be resolved).
   * 
   * @param resource     The FHIR resource for which the adapter reference should be
   *                     returned.
   * @param resourceType The FHIR resource type of the resource.
   * @return The adapter reference for the specified reference or null if it cannot
   *         be resolved.
   */
  FhirResourceUtils.prototype.getResourceAdapterReference = function (resource, resourceType) {};

  /**
   * Resolves the enumeration value for a specific property path of an object.
   * 
   * @param object        The object that has the enumeration property at the specified
   *                      property path.
   * @param propertyPath  The property path on the specified object that contains the
   *                      enum property.
   * @param enumValueName The name of the enumeration value for which the enumeration
   *                      value should be resolved.
   * @return The resolved enumeration value.
   */
  FhirResourceUtils.prototype.resolveEnumValue = function (object, propertyPath, enumValueName) {};

  return FhirResourceUtils;
}());
var fhirResourceUtils = new FhirResourceUtils();

/**
 * Reference to an entry that is stored on DHIS2 (by ID, unique name or unique
 * code).
 */
var Reference = (function ()
{
  function Reference()
  {
    /**
     * Returns the type of the reference (the ID, unique code or unique name).
     */
    this.type = null;

    /**
     * Returns the value of the reference (ID, unique code or unique name).
     */
    this.value = null;

  }

  /**
   * @param o 
   * @return 
   */
  Reference.prototype.equals = function (o) {};

  /**
   * Returns the type of the reference (the ID, unique code or unique name).
   * 
   * @return Returns the type of the reference (the ID, unique code or unique name).
   */
  Reference.prototype.getType = function () {};

  /**
   * Returns the value of the reference (ID, unique code or unique name).
   * 
   * @return Returns the value of the reference (ID, unique code or unique name).
   */
  Reference.prototype.getValue = function () {};

  /**
   * Returns the string representation of the reference (type and value separated by
   * colon character).
   * 
   * @return 
   */
  Reference.prototype.toString = function () {};

  return Reference;
}());

/**
 * Utilities to handle FHIR to DHIS2 transformations for codes (either code
 * mappings or extracting of codes from FHIR codeable concepts).
 */
var CodeUtils = (function ()
{
  function CodeUtils()
  {
  }

  /**
   * Returns if the specified codeable concept contains any combination of the
   * specified list of system code values (type SystemCodeValue).
   * 
   * @param codeableConcept  The codeable concept that should be checked.
   * @param systemCodeValues List of system code values that should be used for the check
   *                         (type SystemCodeValue).
   * @return Returns if any system code value is included.
   */
  CodeUtils.prototype.containsAnyCode = function (codeableConcept, systemCodeValues) {};

  /**
   * Returns if the specified codeable concept contains any combination of the
   * specified system URI and the specified code.
   * 
   * @param codeableConcept The codeable concept that should be checked.
   * @param system          The system URI that must be included in combination with the
   *                        specified code.
   * @param code            The code that must be included in combination with the
   *                        specified system URI.
   * @return Returns if the code is included.
   */
  CodeUtils.prototype.containsCode = function (codeableConcept, system, code) {};

  /**
   * Returns if the specified FHIR codeable concept contains any enabled mapping for
   * the specified mapping codes defined for the adapter.
   * 
   * @param codeableConcept The codeable concept that should be checked.
   * @param mappingCodes    Array of mapping codes that have been defined for the adapter
   *                        (field code of adapter resource codes).
   * @return Returns if the mapping code is included.
   */
  CodeUtils.prototype.containsMappingCode = function (codeableConcept, mappingCodes) {};

  /**
   * Returns the code that is included in the specified codeable concept for the
   * specified system URI.
   * 
   * @param codeableConcept The codeable concept from which the code should be extracted.
   * @param system          The system URI to which the returned code must be assigned
   *                        to.
   * @return Returns the corresponding code.
   */
  CodeUtils.prototype.getCode = function (codeableConcept, system) {};

  /**
   * Returns the mapped code (field code or if available field mappedCode of adapter
   * resource code) for the specified FHIR resource type dependent code. As system
   * URI the value associated with the FHIR resource type of the FHIR client system
   * (adapter resource fhirClientSystems) of the current transformation context is
   * used.
   * 
   * @param code             The code in context of the system URI for the specified FHIR
   *                         resource type.
   * @param fhirResourceType The FHIR resource type (upper case letters, separated by
   *                         underscores) from which the associated system URI should be
   *                         taken.
   * @return The associated mapped code.
   */
  CodeUtils.prototype.getMappedCode = function (code, fhirResourceType) {};

  /**
   * Returns the mapped value set code for the specified codeable concept.
   * 
   * @param codeSetCode     The code of the code set to which the codeable concept must
   *                        belong to.
   * @param codeableConcept The codeable concept to which the code is mapped.
   * @return The associated mapped code (may be null).
   */
  CodeUtils.prototype.getMappedValueSetCode = function (codeSetCode, codeableConcept) {};

  /**
   * Extracts all system code values (type SystemCodeValue) for the codes that
   * identify the purpose of the specified FHIR resource (e.g. observation or vaccine
   * codes).
   * 
   * @param resource The FHIR resource from which the codes should be returned.
   * @return Returns a list of system code values (type SystemCodeValue).
   */
  CodeUtils.prototype.getResourceCodes = function (resource) {};

  /**
   * Returns all system code values that are included in the specified FHIR codeable
   * concept.
   * 
   * @param codeableConcept The FHIR codeable concept from which the system code values
   *                        should be extracted.
   * @return Returns a list that contains all corresponding system codes values (type
   *         SystemCodeValue).
   */
  CodeUtils.prototype.getSystemCodeValues = function (codeableConcept) {};

  /**
   * Returns a map where the key is each specified mapping code and the value is a
   * list of system code values (type SystemCodeValue). The mapping codes are
   * included in field code of adapter resource codes. All specified mapping codes
   * are returned (even if there is no corresponding system code value available).
   * 
   * @param mappingCodes The mapping codes for which the system code values should be
   *                     returned.
   * @return Returns a map where the key is each specified mapping code and the value
   *         is a list of system code values (type SystemCodeValue).
   */
  CodeUtils.prototype.getSystemCodeValuesByMappingCodes = function (mappingCodes) {};

  return CodeUtils;
}());
var codeUtils = new CodeUtils();

/**
 * Utilities for GEO information handling.
 */
var GeoUtils = (function ()
{
  function GeoUtils()
  {
  }

  /**
   * Creates a location object (type Location) from the specified longitude and
   * latitude.
   * 
   * @param longitude The longitude of the GEO point.
   * @param latitude  The latitude of the GEO point.
   * @return The created location object.
   */
  GeoUtils.prototype.create = function (longitude, latitude) {};

  /**
   * Returns the location from the FHIR element address (FHIR extension
   * http://hl7.org/fhir/StructureDefinition/geolocation).
   * 
   * @param element The FHIR element address from which the location should be returned.
   * @return The location (type Location) that is included in the specified element
   *         or null if no location is included.
   */
  GeoUtils.prototype.getLocation = function (element) {};

  /**
   * Returns if the specified string representation of coordinates is a location.
   * 
   * @param coordinates The coordinate string representation that should be checked.
   * @return If the specified coordinates represent the string representation of a
   *         location.
   */
  GeoUtils.prototype.isLocation = function (coordinates) {};

  return GeoUtils;
}());
var geoUtils = new GeoUtils();

/**
 * Organization unit.
 */
var OrganizationUnit = (function ()
{
  function OrganizationUnit()
  {
    /**
     * Returns the date and time when the resource has been updated the last time or
     * null if this is a new resource.
     */
    this.lastUpdated = null;

  }

  /**
   * Returns the date and time when the resource has been updated the last time or
   * null if this is a new resource.
   * 
   * @return Returns the date and time when the resource has been updated the last
   *         time or null if this is a new resource.
   */
  OrganizationUnit.prototype.getLastUpdated = function () {};

  return OrganizationUnit;
}());

/**
 * Utilities for date and time handling.
 */
var DateTimeUtils = (function ()
{
  function DateTimeUtils()
  {
  }

  /**
   * Returns the age relative to the current date/time in the specified unit.
   * 
   * @param dateTime The date/time value for which the age should be calculated.
   * @param dateUnit The unit of the returned age (YEARS, MONTHS, DAYS).
   * @return The age in the specified unit.
   */
  DateTimeUtils.prototype.getAge = function (dateTime, dateUnit) {};

  /**
   * Returns a date/time value for the specified date/time element value when it has
   * at least day precision. A date/time element value may have only year or month
   * precision.
   * 
   * @param dateTime The date/time element value for which the evaluation should be
   *                 performed.
   * @return Returns if the specified date/time element as date/time value or null
   *         when it has not at least day precision.
   */
  DateTimeUtils.prototype.getPreciseDate = function (dateTime) {};

  /**
   * Returns a date/time value for the specified date/time element value when it has
   * at least day precision and is in the past. A date/time element value may have
   * only year or month precision.
   * 
   * @param dateTime The date/time element value for which the evaluation should be
   *                 performed.
   * @return Returns if the specified date/time element as date/time value or null
   *         when it has not at least day precision or is in the future.
   */
  DateTimeUtils.prototype.getPrecisePastDate = function (dateTime) {};

  /**
   * Returns if the specified date/time element value has at least day precision. A
   * date/time element value may have only year or month precision.
   * 
   * @param dateTime The date/time element value for which the evaluation should be
   *                 performed.
   * @return Returns if the specified date/time element has at least day precision.
   */
  DateTimeUtils.prototype.hasDayPrecision = function (dateTime) {};

  /**
   * Returns if the age relative to the current date/time in the specified unit is
   * older than the specified amount.
   * 
   * @param dateTime The date/time value for which the age up to the current date/time
   *                 value should be calculated.
   * @param amount   The minimum age (exclusive).
   * @param dateUnit The unit of the returned age (YEARS, MONTHS, DAYS).
   * @return If the age is greater than the specified amount.
   */
  DateTimeUtils.prototype.isOlderThan = function (dateTime, amount, dateUnit) {};

  /**
   * Returns if the specified FHIR period is valid now. It is regarded as being
   * valid, if the end has not yet been reached. The begin date/time will not be
   * checked.
   * 
   * @param period The FHIR period for which it should be checked if the current
   *               date/time is included.
   * @return Returns if the current date/time is included in the specified period.
   *         Returns true if the specified period is null.
   */
  DateTimeUtils.prototype.isValidNow = function (period) {};

  /**
   * Returns if the age relative to the current date/time in the specified unit is
   * younger than the specified amount.
   * 
   * @param dateTime The date/time value for which the age up to the current date/time
   *                 value should be calculated.
   * @param amount   The maximum age (exclusive).
   * @param dateUnit The unit of the returned age (YEARS, MONTHS, DAYS).
   * @return If the age is less than the specified amount.
   */
  DateTimeUtils.prototype.isYoungerThan = function (dateTime, amount, dateUnit) {};

  return DateTimeUtils;
}());
var dateTimeUtils = new DateTimeUtils();

/**
 * Utilities for handling FHIR observations.
 */
var ObservationUtils = (function ()
{
  function ObservationUtils()
  {
    /**
     * Returns the name of the observation FHIR resource.
     */
    this.resourceName = null;

  }

  /**
   * Returns the backbone element with the specified system URI and code from the
   * specified FHIR observation resource.
   * 
   * @param backboneElements The list of backbone elements from the FHIR observation
   *                         resource.
   * @param system           The system URI for which the backbone element should be
   *                         returned.
   * @param code             The code (in combination with the system URI) for which the
   *                         backbone element should be returned.
   * @return The matching back bone element.
   */
  ObservationUtils.prototype.getBackboneElement = function (backboneElements, system, code) {};

  /**
   * Returns the composite type with the codes that are included in the FHIR
   * observation resource.
   * 
   * @param resource The FHIR observation resource from which the codes should be
   *                 returned.
   * @return The composite type with the codes.
   */
  ObservationUtils.prototype.getCodes = function (resource) {};

  /**
   * Returns combined string value component text of the specified FHIR observation
   * resource.
   * 
   * @param resource The FHIR observation resource from which the component text should
   *                 be returned.
   * @return The combined string value component text.
   */
  ObservationUtils.prototype.getComponentText = function (resource) {};

  /**
   * Returns the name of the observation FHIR resource.
   * 
   * @return The name of the observation FHIR resource.
   */
  ObservationUtils.prototype.getResourceName = function () {};

  /**
   * Returns the latest FHIR observation resource (based on last updated timestamp of
   * resource) that match the specified criteria. The specified mapped codes are
   * evaluated in the specified order. Even if a found FHIR observation resource is
   * older than another found resource, the order of the specified mapped codes is
   * evaluated first. If the older resource matches the first mapped code and the
   * latest resource matches the second mapped code, then the older resource is
   * taken.
   * 
   * @param referencedResourceParameter The FHIR resource search parameter that contains
   *                                    the referenced resource (e.g. subject).
   * @param referencedResourceType      The FHIR resource type of the referenced resource
   *                                    (e.g. Patient).
   * @param referencedResourceId        The FHIR resource ID (ID element) of the
   *                                    reference resource.
   * @param mappedCodes                 The maximum latest FHIR observations with the
   *                                    specified criteria that are checked for the
   *                                    specified order of the mapped codes.
   * @param maxCount                    The mapped codes (non-system dependent codes) on
   *                                    which observations are filtered.
   * @param filter                      Optional further filter argument pairs (variable
   *                                    arguments). The first value is the filtered
   *                                    parameter and the second is the value.
   * @return The latest FHIR resource that matches the specified criteria and the
   *         order of the mapped codes.
   */
  ObservationUtils.prototype.queryLatestPrioritizedByMappedCodes = function (referencedResourceParameter, referencedResourceType, referencedResourceId, mappedCodes, maxCount, filter) {};

  return ObservationUtils;
}());
var observationUtils = new ObservationUtils();

/**
 * Program instance (aka enrollment). If enrollment is not new and will be
 * modified, it will be persisted.
 */
var Enrollment = (function ()
{
  function Enrollment()
  {
    /**
     * Returns the coordinates (normally longitude and latitude) of the enrollment.
     */
    this.coordinate = null;

    /**
     * Returns the date and time when the enrollment took place.
     */
    this.enrollmentDate = null;

    /**
     * Returns the ID of the event on DHIS2. Return null if the instance is new.
     */
    this.id = null;

    /**
     * Returns the date and time when the incident took place.
     */
    this.incidentDate = null;

    /**
     * Returns the date and time when the resource has been updated the last time or
     * null if this is a new resource.
     */
    this.lastUpdated = null;

    /**
     * Returns if the event is new ans has not yet been saved on DHIS2.
     */
    this.newResource = null;

    /**
     * Returns the ID of the organisation unit on DHIS2 where this event has been
     * registered.
     */
    this.organizationUnitId = null;

    /**
     * Returns the tracked entity instance to which this event belongs to.
     */
    this.trackedEntityInstance = null;

  }

  /**
   * Returns the coordinates (normally longitude and latitude) of the enrollment.
   * 
   * @return Returns the coordinates (normally longitude and latitude) of the
   *         enrollment.
   */
  Enrollment.prototype.getCoordinate = function () {};

  /**
   * Returns the date and time when the enrollment took place.
   * 
   * @return Returns the date and time when the enrollment took place.
   */
  Enrollment.prototype.getEnrollmentDate = function () {};

  /**
   * Returns the ID of the event on DHIS2. Return null if the instance is new.
   * 
   * @return Returns the ID of the event on DHIS2. Return null if the instance is
   *         new.
   */
  Enrollment.prototype.getId = function () {};

  /**
   * Returns the date and time when the incident took place.
   * 
   * @return Returns the date and time when the incident took place.
   */
  Enrollment.prototype.getIncidentDate = function () {};

  /**
   * Returns the date and time when the resource has been updated the last time or
   * null if this is a new resource.
   * 
   * @return Returns the date and time when the resource has been updated the last
   *         time or null if this is a new resource.
   */
  Enrollment.prototype.getLastUpdated = function () {};

  /**
   * Returns the ID of the organisation unit on DHIS2 where this event has been
   * registered.
   * 
   * @return Returns the ID of the organisation unit on DHIS2 where this event has
   *         been registered.
   */
  Enrollment.prototype.getOrganizationUnitId = function () {};

  /**
   * Returns the tracked entity instance to which this event belongs to.
   * 
   * @return Returns the tracked entity instance to which this event belongs to.
   */
  Enrollment.prototype.getTrackedEntityInstance = function () {};

  /**
   * Returns if the event is new ans has not yet been saved on DHIS2.
   * 
   * @return Returns if the event is new ans has not yet been saved on DHIS2.
   */
  Enrollment.prototype.isNewResource = function () {};

  /**
   * Sets the coordinates of the enrollment. This might be a string representation of
   * the coordinates or a location object.
   * 
   * @param coordinate The coordinates as string representation, location object or null.
   * @return Returns true each time (at end of script return of true can be avoided).
   */
  Enrollment.prototype.setCoordinate = function (coordinate) {};

  /**
   * Sets the date and time when the enrollment took place.
   * 
   * @param enrollmentDate The date and time when the enrollment took place.
   * @return Returns if the event specified enrollment date was non-null.
   */
  Enrollment.prototype.setEnrollmentDate = function (enrollmentDate) {};

  /**
   * Sets the date and time when the incident took place.
   * 
   * @param incidentDate The date and time when the incident took place.
   * @return Returns if the event specified incident date was non-null.
   */
  Enrollment.prototype.setIncidentDate = function (incidentDate) {};

  /**
   * Validates the content of the enrollment and throws an exception if the content
   * is invalid.
   */
  Enrollment.prototype.validate = function () {};

  return Enrollment;
}());
var enrollment = new Enrollment();

/**
 * The current FHIR request that caused the execution of the transformation.
 */
var FhirRequest = (function ()
{
  function FhirRequest()
  {
    /**
     * Returns if the FHIR resources contains DHIS2 IDs. Otherwise FHIR resources
     * contain IDs of the remote system.
     */
    this.dhisFhirId = null;

    /**
     * Returns the ID of the DHIS2 resource that should be processed or null if this
     * must be evaluated by rules.
     */
    this.dhisResourceId = null;

    /**
     * Returns the resource type of the DHIS2 resource (the resource type that defines
     * the rule).
     */
    this.dhisResourceType = null;

    /**
     * Returns the code of the FHIR client that caused the execution of the current
     * transformation.
     */
    this.fhirClientCode = null;

    /**
     * Returns if only the first matching rule is applied and no further rules
     * afterwards.
     */
    this.firstRuleOnly = null;

    /**
     * Returns the timestamp when the processed FHIR resource has been updated the last
     * time.
     */
    this.lastUpdated = null;

    /**
     * Returns the FHIR resource ID of the request.
     */
    this.resourceId = null;

    /**
     * Returns the processed FHIR resource type as Java enumeration (e.g.
     * RELATED_PERSON as enum constant).
     */
    this.resourceType = null;

    /**
     * Returns the FHIR resource version ID of the request (versioning may not be
     * supported).
     */
    this.resourceVersionId = null;

    /**
     * Returns the ID of the rule that should be applied or null if normal rule
     * processing should take place.
     */
    this.ruleId = null;

    /**
     * Returns the FHIR version of the processed FHIR resource as Java enumeration
     * (e.g. DSTU3 as enum constant).
     */
    this.version = null;

  }

  /**
   * Returns the ID of the DHIS2 resource that should be processed or null if this
   * must be evaluated by rules.
   * 
   * @return Returns the ID of the DHIS2 resource that should be processed or null if
   *         this must be evaluated by rules.
   */
  FhirRequest.prototype.getDhisResourceId = function () {};

  /**
   * Returns the resource type of the DHIS2 resource (the resource type that defines
   * the rule).
   * 
   * @return Returns the resource type of the DHIS2 resource (the resource type that
   *         defines the rule).
   */
  FhirRequest.prototype.getDhisResourceType = function () {};

  /**
   * Returns the code of the FHIR client that caused the execution of the current
   * transformation.
   * 
   * @return Returns the code of the FHIR client that caused the execution of the
   *         current transformation.
   */
  FhirRequest.prototype.getFhirClientCode = function () {};

  /**
   * Returns the timestamp when the processed FHIR resource has been updated the last
   * time.
   * 
   * @return Returns the timestamp when the processed FHIR resource has been updated
   *         the last time.
   */
  FhirRequest.prototype.getLastUpdated = function () {};

  /**
   * Returns the FHIR resource ID of the request.
   * 
   * @return Returns the FHIR resource ID of the request.
   */
  FhirRequest.prototype.getResourceId = function () {};

  /**
   * Returns the processed FHIR resource type as Java enumeration (e.g.
   * RELATED_PERSON as enum constant).
   * 
   * @return Returns the processed FHIR resource type as Java enumeration (e.g.
   *         RELATED_PERSON as enum constant).
   */
  FhirRequest.prototype.getResourceType = function () {};

  /**
   * Returns the FHIR resource version ID of the request (versioning may not be
   * supported).
   * 
   * @return Returns the FHIR resource version ID of the request (versioning may not
   *         be supported).
   */
  FhirRequest.prototype.getResourceVersionId = function () {};

  /**
   * Returns the ID of the rule that should be applied or null if normal rule
   * processing should take place.
   * 
   * @return Returns the ID of the rule that should be applied or null if normal rule
   *         processing should take place.
   */
  FhirRequest.prototype.getRuleId = function () {};

  /**
   * Returns the FHIR version of the processed FHIR resource as Java enumeration
   * (e.g. DSTU3 as enum constant).
   * 
   * @return Returns the FHIR version of the processed FHIR resource as Java
   *         enumeration (e.g. DSTU3 as enum constant).
   */
  FhirRequest.prototype.getVersion = function () {};

  /**
   * Returns if the FHIR resources contains DHIS2 IDs. Otherwise FHIR resources
   * contain IDs of the remote system.
   * 
   * @return Returns if the FHIR resources contains DHIS2 IDs. Otherwise FHIR
   *         resources contain IDs of the remote system.
   */
  FhirRequest.prototype.isDhisFhirId = function () {};

  /**
   * Returns if only the first matching rule is applied and no further rules
   * afterwards.
   * 
   * @return Returns if only the first matching rule is applied and no further rules
   *         afterwards.
   */
  FhirRequest.prototype.isFirstRuleOnly = function () {};

  return FhirRequest;
}());

/**
 * Utilities for handling FHIR immunizations.
 */
var ImmunizationUtils = (function ()
{
  function ImmunizationUtils()
  {
  }

  /**
   * Returns the maximum dose sequence from the specified FHIR immunization resource.
   * 
   * @param immunization The FHIR immunization resource from which the maximum included
   *                     dose sequence should be returned.
   * @return Maximum dose sequence (0 if no dose sequence is included).
   */
  ImmunizationUtils.prototype.getMaxDoseSequence = function (immunization) {};

  return ImmunizationUtils;
}());
var immunizationUtils = new ImmunizationUtils();

/**
 * Utilities to resolveRule FHIR Reference to FHIR Resources when handling FHIR to
 * DHIS2 transformations.
 */
var ReferenceUtils = (function ()
{
  function ReferenceUtils()
  {
  }

  /**
   * Returns the FHIR resource with the specified resource type for the specified
   * FHIR reference.
   * 
   * @param reference    The FHIR reference for which the resource should be returned.
   * @param resourceType The FHIR resource type of the resource (upper case with under
   *                     scores, e.g. RELATED_PERSON). If this is not specified the
   *                     resource type must be included in the reference. If this is
   *                     specified and the resource type is also included in the
   *                     reference, then both must match.
   * @param refreshed    Specifies if the latest version of the resource should be
   *                     returned. If this is set to false, a cached version may be
   *                     returned.
   * @return The FHIR resource for the specified reference.
   */
  ReferenceUtils.prototype.getResource = function (reference, resourceType, refreshed) {};

  return ReferenceUtils;
}());
var referenceUtils = new ReferenceUtils();

/**
 * Utilities to handle FHIR to DHIS2 transformations of FHIR locations.
 */
var LocationUtils = (function ()
{
  function LocationUtils()
  {
  }

  /**
   * Checks if the specified DHIS2 organization unit code exists on DHIS2.
   * 
   * @param code The DHIS2 organization unit code that should be checked.
   * @return If the specified DHIS2 organization unit code exists.
   */
  LocationUtils.prototype.exists = function (code) {};

  /**
   * Checks if the specified DHIS2 organization unit code exists on DHIS2 with the
   * code prefix that is defined for organizations of the FHIR client of the current
   * transformation context.
   * 
   * @param code The DHIS2 organization unit code (without prefix) that should be
   *             checked.
   * @return The DHIS2 organization unit code (includin prefix, as it exists on
   *         DHIS2) or null if it does not exist.
   */
  LocationUtils.prototype.existsWithPrefix = function (code) {};

  /**
   * Return a list with all FHIR locations from the specified organization reference
   * until the root FHIR location. The first list item is the location resource that
   * is referenced by the specified reference.
   * 
   * @param childReference The reference to a FHIR location resource for which all
   *                       parents should be returned (including the specified child).
   * @return List of FHIR resources in the hierarchy up to the root location.
   */
  LocationUtils.prototype.findHierarchy = function (childReference) {};

  return LocationUtils;
}());
var locationUtils = new LocationUtils();

/**
 * Utilities to handle FHIR to DHIS2 transformations of FHIR identifiers.
 */
var IdentifierUtils = (function ()
{
  function IdentifierUtils()
  {
  }

  /**
   * Returns the business identifier from the specified referenced FHIR resource with
   * the specified FHIR resource type. If the resource type does not match null is
   * returned. The system URI of the corresponding FHIR client system of the current
   * transformation context is used (e.g. the system URI of a Patient of the FHIR
   * client from which the resource has been retrieved).
   * 
   * @param reference        The FHIR reference of a domain resource from which the
   *                         identifier should be extracted.
   * @param fhirResourceType The FHIR resource type (upper case with underscores, e.g.
   *                         RELATED_PERSON) of the specified domain resource.
   * @return The corresponding business identifier.
   */
  IdentifierUtils.prototype.getReferenceIdentifier = function (reference, fhirResourceType) {};

  /**
   * Returns the business identifier with the specified system URI from the specified
   * domain resource with the specified FHIR resource type. If the resource type does
   * not match null is returned.
   * 
   * @param resource         The FHIR domain resource from which the identifier should be
   *                         extracted.
   * @param fhirResourceType The FHIR resource type (upper case with underscores, e.g.
   *                         RELATED_PERSON) of the specified domain resource.
   * @param system           The system URI for which the identifier is returned.
   * @return The corresponding business identifier.
   */
  IdentifierUtils.prototype.getResourceIdentifier = function (resource, fhirResourceType, system) {};

  return IdentifierUtils;
}());
var identifierUtils = new IdentifierUtils();

/**
 * Utilities for retrieving data from a FHIR client.
 */
var FhirClientUtils = (function ()
{
  function FhirClientUtils()
  {
  }

  /**
   * Returns the latest FHIR resource (based on last updated timestamp of resource)
   * that match the specified criteria.
   * 
   * @param resourceName                The name of the FHIR resource that should be
   *                                    searched for (e.g. Observation).
   * @param referencedResourceParameter The FHIR resource search parameter that contains
   *                                    the referenced resource (e.g. subject).
   * @param referencedResourceType      The FHIR resource type of the referenced resource
   *                                    (e.g. Patient).
   * @param referencedResourceId        The FHIR resource ID (ID element) of the
   *                                    reference resource.
   * @param filter                      Optional further filter argument pairs (variable
   *                                    arguments). The first value is the filtered
   *                                    parameter and the second is the value.
   * @return The latest FHIR resource that matches the specified criteria.
   */
  FhirClientUtils.prototype.queryLatest = function (resourceName, referencedResourceParameter, referencedResourceType, referencedResourceId, filter) {};

  return FhirClientUtils;
}());
var fhirClientUtils = new FhirClientUtils();

/**
 * Utilities to handle FHIR to DHIS2 transformations of addresses.
 */
var AddressUtils = (function ()
{
  function AddressUtils()
  {
  }

  /**
   * Returns a constructed text of the address that contains the address lines, the
   * postal code, the city and the state (if available).
   * 
   * @param address   The FHIR address from which the address components should be used.
   * @param delimiter The delimiter that should be used to separated the lines (e.g.
   *                  space character).
   * @return The constructed address text.
   */
  AddressUtils.prototype.getConstructedText = function (address, delimiter) {};

  /**
   * Returns a single address line for the adress lines includes in the specified
   * FHIR address. A space is used to separate the lines.
   * 
   * @param address The FHIR address from which the address lines should be used.
   * @return A single line for the included address lines.
   */
  AddressUtils.prototype.getSingleLine = function (address) {};

  /**
   * Returns the text representation (if included) of the address.
   * 
   * @param address The FHIR address from which the text should be returned.
   * @return 
   */
  AddressUtils.prototype.getText = function (address) {};

  return AddressUtils;
}());
var addressUtils = new AddressUtils();

/**
 * Utilities to handle FHIR to DHIS2 transformations for FHIR contact points.
 */
var ContactPointUtils = (function ()
{
  function ContactPointUtils()
  {
  }

  /**
   * Returns the phone number contact point from the specified list of contact
   * points. If there are multiple contact points that include a phone number then it
   * is tried to find the most appropriate contact point.
   * 
   * @param contactPoints List of FHIR contact points from which a phone contact point
   *                      should be extracted.
   * @return An included phone number.
   */
  ContactPointUtils.prototype.getPhoneContactPointValue = function (contactPoints) {};

  return ContactPointUtils;
}());
var contactPointUtils = new ContactPointUtils();

/**
 * Program stage instance (aka event). If event is not new and will be modified, it
 * will be persisted.
 */
var Event = (function ()
{
  function Event()
  {
    /**
     * Returns the coordinates (normally longitude and latitude) of the event.
     */
    this.coordinate = null;

    /**
     * Returns the due date and time of the event.
     */
    this.dueDate = null;

    /**
     * Returns the ID of the enrollment on DHIS2 to which this event belongs to.
     */
    this.enrollmentId = null;

    /**
     * Returns the date and time when the event took place.
     */
    this.eventDate = null;

    /**
     * Returns the ID of the event on DHIS2. Return null if the instance is new.
     */
    this.id = null;

    /**
     * Returns the date and time when the resource has been updated the last time or
     * null if this is a new resource.
     */
    this.lastUpdated = null;

    /**
     * Returns if the event is new ans has not yet been saved on DHIS2.
     */
    this.newResource = null;

    /**
     * Returns the ID of the organisation unit on DHIS2 where this event has been
     * registered.
     */
    this.organizationUnitId = null;

    /**
     * Returns the status of the event.
     */
    this.status = null;

    /**
     * Returns the tracked entity instance to which this event belongs to.
     */
    this.trackedEntityInstance = null;

  }

  /**
   * Returns the value of a data element as a big decimal value.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.getBigDecimalValue = function (dataElementReference) {};

  /**
   * Returns the value of a data element as a boolean value.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.getBooleanValue = function (dataElementReference) {};

  /**
   * Returns the coordinates (normally longitude and latitude) of the event.
   * 
   * @return Returns the coordinates (normally longitude and latitude) of the event.
   */
  Event.prototype.getCoordinate = function () {};

  /**
   * Returns the due date and time of the event.
   * 
   * @return Returns the due date and time of the event.
   */
  Event.prototype.getDueDate = function () {};

  /**
   * Returns the ID of the enrollment on DHIS2 to which this event belongs to.
   * 
   * @return Returns the ID of the enrollment on DHIS2 to which this event belongs
   *         to.
   */
  Event.prototype.getEnrollmentId = function () {};

  /**
   * Returns the date and time when the event took place.
   * 
   * @return Returns the date and time when the event took place.
   */
  Event.prototype.getEventDate = function () {};

  /**
   * Returns the ID of the event on DHIS2. Return null if the instance is new.
   * 
   * @return Returns the ID of the event on DHIS2. Return null if the instance is
   *         new.
   */
  Event.prototype.getId = function () {};

  /**
   * Returns the value of a data element as an integer value. The data element must
   * be an option set. The index of the option (ordered by the integer value defined
   * by the option code) plus the specified value base is returned. The values of the
   * option set can be filtered by specifying a value pattern that returns the an
   * integer value as grouping value. Otherwise the option code must be an integer
   * value that is used for sorting the option set.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @param valueBase            The base of the returned value. This will be added to
   *                             the index that is extracted from the option code.
   * @param optionValuePattern   Optional regular expression to filter option set values
   *                             and extract the integer based order value. E.g.: Dose
   *                             (\d+)
   * @return 
   */
  Event.prototype.getIntegerOptionValue = function (dataElementReference, valueBase, optionValuePattern) {};

  /**
   * Returns the value of a data element as an integer value.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.getIntegerValue = function (dataElementReference) {};

  /**
   * Returns the date and time when the resource has been updated the last time or
   * null if this is a new resource.
   * 
   * @return Returns the date and time when the resource has been updated the last
   *         time or null if this is a new resource.
   */
  Event.prototype.getLastUpdated = function () {};

  /**
   * Returns the ID of the organisation unit on DHIS2 where this event has been
   * registered.
   * 
   * @return Returns the ID of the organisation unit on DHIS2 where this event has
   *         been registered.
   */
  Event.prototype.getOrganizationUnitId = function () {};

  /**
   * Returns the status of the event.
   * 
   * @return Returns the status of the event.
   */
  Event.prototype.getStatus = function () {};

  /**
   * Returns the value of a data element as a string value.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.getStringValue = function (dataElementReference) {};

  /**
   * Returns the tracked entity instance to which this event belongs to.
   * 
   * @return Returns the tracked entity instance to which this event belongs to.
   */
  Event.prototype.getTrackedEntityInstance = function () {};

  /**
   * Returns the value of a data element.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.getValue = function (dataElementReference) {};

  /**
   * Returns if the event is new ans has not yet been saved on DHIS2.
   * 
   * @return Returns if the event is new ans has not yet been saved on DHIS2.
   */
  Event.prototype.isNewResource = function () {};

  /**
   * Returns if the value of the data element has been provided elsewhere.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @return 
   */
  Event.prototype.isProvidedElsewhere = function (dataElementReference) {};

  /**
   * Sets the coordinates of the event. This might be a string representation of the
   * coordinates or a location object.
   * 
   * @param coordinate The coordinates as string representation, location object or null.
   * @return Returns true each time (at end of script return of true can be avoided).
   */
  Event.prototype.setCoordinate = function (coordinate) {};

  /**
   * Sets the due date and time of the event.
   * 
   * @param dueDate The due date and time of the event.
   * @return Returns if the event specified due date was non-null.
   */
  Event.prototype.setDueDate = function (dueDate) {};

  /**
   * Sets the date and time when the event took place.
   * 
   * @param eventDate The date and time when the event took place.
   * @return Returns if the event specified event date was non-null.
   */
  Event.prototype.setEventDate = function (eventDate) {};

  /**
   * Sets the value of an option set based data element to an index based value.
   * 
   * @param dataElementReference The reference object to the data element of the event.
   * @param value                The value that should be set. The value refers to the
   *                             integer value of the option code minus the specified
   *                             value base.
   * @param valueBase            The base of the returned value. This will be subtracted
   *                             from the integer value of the selected option code.
   * @param decrementAllowed     Boolean value that specifies if an existing value of the
   *                             data element can be decremented (e.g. 6 can be set to
   *                             4).
   * @param optionValuePattern   Optional regular expression to filter option set values
   *                             and extract the integer based order value. E.g.: Dose
   *                             (\d+)
   * @param providedElsewhere    Boolean value (or null) that indicates if the value of
   *                             the data element has been provided elsewhere.
   * @return Returns true if the value has been set.
   */
  Event.prototype.setIntegerOptionValue = function (dataElementReference, value, valueBase, decrementAllowed, optionValuePattern, providedElsewhere) {};

  /**
   * Sets status of the event.
   * 
   * @param status The status of the event.
   * @return Returns true each time (at end of script return of true can be avoided).
   */
  Event.prototype.setStatus = function (status) {};

  /**
   * Sets the value of a data element.
   * 
   * @param dataElementReference The reference object to the data element attribute.
   * @param value                The value that should be set. The value will be
   *                             converted to the required type automatically (if
   *                             possible).
   * @param providedElsewhere    Boolean value (or null) that indicates if the value of
   *                             the data element has been provided elsewhere.
   * @return Returns true each time (at end of script return of true can be avoided).
   */
  Event.prototype.setValue = function (dataElementReference, value, providedElsewhere) {};

  /**
   * Validates the content of the event and throws an exception if the content is
   * invalid.
   */
  Event.prototype.validate = function () {};

  return Event;
}());
var event = new Event();

/**
 * Utilities to handle FHIR to DHIS2 transformations of FHIR patients.
 */
var PatientUtils = (function ()
{
  function PatientUtils()
  {
  }

  /**
   * Returns the FHIR address that contains the birth place. The FHIR extension
   * http://hl7.org/fhir/StructureDefinition/birthPlace is used to extract the
   * address.
   * 
   * @param patient The patient resource from which the birth place address should be
   *                extracted.
   * @return The extracted birth place address.
   */
  PatientUtils.prototype.getBirthPlaceAddress = function (patient) {};

  return PatientUtils;
}());
var patientUtils = new PatientUtils();

/**
 * Utilities to handle FHIR to DHIS2 transformations of FHIR organizations.
 */
var OrganizationUtils = (function ()
{
  function OrganizationUtils()
  {
  }

  /**
   * Checks if the specified DHIS2 organization unit code exists on DHIS2.
   * 
   * @param code The DHIS2 organization unit code that should be checked.
   * @return If the specified DHIS2 organization unit code exists.
   */
  OrganizationUtils.prototype.exists = function (code) {};

  /**
   * Checks if the specified DHIS2 organization unit code exists on DHIS2 with the
   * code prefix that is defined for organizations of the FHIR client of the current
   * transformation context.
   * 
   * @param code The DHIS2 organization unit code (without prefix) that should be
   *             checked.
   * @return The DHIS2 organization unit code (includin prefix, as it exists on
   *         DHIS2) or null if it does not exist.
   */
  OrganizationUtils.prototype.existsWithPrefix = function (code) {};

  /**
   * Return a list with all FHIR organizations from the specified organization
   * reference until the root FHIR organization. The first list item is the
   * organization resource that is referenced by the specified reference.
   * 
   * @param childReference The reference to a FHIR organization resource for which all
   *                       parents should be returned (including the specified child).
   * @return List of FHIR resources in the hierarchy up to the root organization.
   */
  OrganizationUtils.prototype.findHierarchy = function (childReference) {};

  return OrganizationUtils;
}());
var organizationUtils = new OrganizationUtils();

/**
 * Utilities for handling vital sign observations.
 */
var VitalSignUtils = (function ()
{
  function VitalSignUtils()
  {
  }

  /**
   * Returns the height with the specified height unit from the specified composite
   * value of a FHIR observation.
   * 
   * @param value      The composite value that includes the height.
   * @param heightUnit The height unit in which the height should be returned.
   * @param round      Specifies if the returned value should be rounded.
   * @return Returns the included height with the specified height unit.
   */
  VitalSignUtils.prototype.getHeight = function (value, heightUnit, round) {};

  /**
   * Returns the weight with the specified weight unit from the specified composite
   * value of a FHIR observation.
   * 
   * @param value      The composite value that includes the weight.
   * @param weightUnit The weight unit in which the weight should be returned.
   * @param round      Specifies if the returned value should be rounded.
   * @return Returns the included weight with the specified weight unit.
   */
  VitalSignUtils.prototype.getWeight = function (value, weightUnit, round) {};

  return VitalSignUtils;
}());
var vitalSignUtils = new VitalSignUtils();

/**
 * The context of the current transformation.
 */
var FhirContext = (function ()
{
  function FhirContext()
  {
    /**
     * Returns the FHIR request (type FhirRequest) that causes the current
     * transformation execution.
     */
    this.fhirRequest = null;

  }

  /**
   * Returns a reference to a DHIS2 entry (type Reference).
   * 
   * @param value         The value of the reference (the ID, unique code or unique name
   *                      of the DHIS2 entry).
   * @param referenceType The reference type (ID, CODE, NAME).
   * @return The created reference.
   */
  FhirContext.prototype.createReference = function (value, referenceType) {};

  /**
   * Extracts the DHIS2 ID from a FHIR ID element. In order to extract the DHIS2 ID
   * the FHIR request must use DHIS2 FHIR IDs.
   * 
   * @param idElement The ID element from which the DHIS2 ID should be extracted.
   * @return The DHIS2 ID of the corresponding DHIS2 resource.
   */
  FhirContext.prototype.extractDhisId = function (idElement) {};

  /**
   * Causes that the current transformation will fail with the specified message due
   * to invalid data.
   * 
   * @param message The reason that specifies why the transformation data is invalid.
   */
  FhirContext.prototype.fail = function (message) {};

  /**
   * Returns the FHIR request (type FhirRequest) that causes the current
   * transformation execution.
   * 
   * @return Returns the FHIR request (type FhirRequest) that causes the current
   *         transformation execution.
   */
  FhirContext.prototype.getFhirRequest = function () {};

  /**
   * Returns the current timestamp as date/time.
   * 
   * @return The current timestamp as date/time.
   */
  FhirContext.prototype.now = function () {};

  return FhirContext;
}());
var context = new FhirContext();

/**
 * Utilities for program stage handling.
 */
var ProgramStageUtils = (function ()
{
  function ProgramStageUtils()
  {
  }

  /**
   * Returns if the specified events contain an event with the specified event date
   * (day precision is used).
   * 
   * @param events The events that should be checked.
   * @param date   The date that should be checked.
   * @return Returns if the specified events contain an event with the specified
   *         event date.
   */
  ProgramStageUtils.prototype.containsEventDay = function (events, date) {};

  return ProgramStageUtils;
}());
var programStageUtils = new ProgramStageUtils();

/**
 * Tracked entity instance. If tracked entity instance is not new and will be
 * modified, it will be persisted.
 */
var TrackedEntityInstance = (function ()
{
  function TrackedEntityInstance()
  {
    /**
     * Returns the coordinates (normally longitude and latitude) of the tracked entity
     * instance.
     */
    this.coordinates = null;

    /**
     * Returns the ID of the tracked entity instance on DHIS2. Return null if the
     * instance is new.
     */
    this.id = null;

    /**
     * Returns the national identifier of the tracked entity instance.
     */
    this.identifier = null;

    /**
     * Returns the date and time when the resource has been updated the last time or
     * null if this is a new resource.
     */
    this.lastUpdated = null;

    /**
     * Returns if the tracked entity instance is new ans has not yet been saved on
     * DHIS2.
     */
    this.newResource = null;

    /**
     * Returns the organization unit ID of the organization unit to which this tracked
     * entity instance belongs to on DHIS2.
     */
    this.organizationUnitId = null;

    /**
     * Returns the ID of the tracked entity type to which this tracked entity instance
     * belongs to on DHIS2.
     */
    this.typeId = null;

  }

  /**
   * Returns the coordinates (normally longitude and latitude) of the tracked entity
   * instance.
   * 
   * @return Returns the coordinates (normally longitude and latitude) of the tracked
   *         entity instance.
   */
  TrackedEntityInstance.prototype.getCoordinates = function () {};

  /**
   * Returns the ID of the tracked entity instance on DHIS2. Return null if the
   * instance is new.
   * 
   * @return Returns the ID of the tracked entity instance on DHIS2. Return null if
   *         the instance is new.
   */
  TrackedEntityInstance.prototype.getId = function () {};

  /**
   * Returns the national identifier of the tracked entity instance.
   * 
   * @return Returns the national identifier of the tracked entity instance.
   */
  TrackedEntityInstance.prototype.getIdentifier = function () {};

  /**
   * Returns the date and time when the resource has been updated the last time or
   * null if this is a new resource.
   * 
   * @return Returns the date and time when the resource has been updated the last
   *         time or null if this is a new resource.
   */
  TrackedEntityInstance.prototype.getLastUpdated = function () {};

  /**
   * Returns the organization unit ID of the organization unit to which this tracked
   * entity instance belongs to on DHIS2.
   * 
   * @return Returns the organization unit ID of the organization unit to which this
   *         tracked entity instance belongs to on DHIS2.
   */
  TrackedEntityInstance.prototype.getOrganizationUnitId = function () {};

  /**
   * Returns the string representation of the value of a tracked entity instance
   * attribute.
   * 
   * @param attributeReference The referenced string to the tracked entity attribute.
   * @return 
   */
  TrackedEntityInstance.prototype.getStringValue = function (attributeReference) {};

  /**
   * Returns the ID of the tracked entity type to which this tracked entity instance
   * belongs to on DHIS2.
   * 
   * @return Returns the ID of the tracked entity type to which this tracked entity
   *         instance belongs to on DHIS2.
   */
  TrackedEntityInstance.prototype.getTypeId = function () {};

  /**
   * Returns the value of a tracked entity instance attribute.
   * 
   * @param attributeReference The referenced object to the tracked entity attribute.
   * @return 
   */
  TrackedEntityInstance.prototype.getValue = function (attributeReference) {};

  /**
   * Returns if the tracked entity instance is new ans has not yet been saved on
   * DHIS2.
   * 
   * @return Returns if the tracked entity instance is new ans has not yet been saved
   *         on DHIS2.
   */
  TrackedEntityInstance.prototype.isNewResource = function () {};

  /**
   * Sets the coordinates of the tracked entity instance. This might be a string
   * representation of the coordinates or a location object.
   * 
   * @param coordinates The coordinates as string representation, location object or
   *                    null.
   * @return Returns true each time (at end of script return of true can be avoided).
   */
  TrackedEntityInstance.prototype.setCoordinates = function (coordinates) {};

  /**
   * Sets the value of a tracked entity attribute. If the specified attribute
   * reference is null, nothing will be done. This will be skipped when the specified
   * last updated date is before the current last updated data and the user which has
   * last modified the tracked entity was not the adapter itself.
   * 
   * @param attributeReference The reference object to the tracked entity attribute (can
   *                           be null).
   * @param value              The value that should be set. The value will be converted
   *                           to the required type automatically (if possible).
   * @param lastUpdated        The last updated timestamp of the data that should be
   *                           assigned to the tracked entity. This value can be null if
   *                           check should not be made.
   * @return Returns only true if updating the value has not been skipped since the
   *         specified last updated date is before the current last updated date.
   */
  TrackedEntityInstance.prototype.setOptionalValue = function (attributeReference, value, lastUpdated) {};

  /**
   * Sets the organization unit ID of the organization unit to which this tracked
   * entity instance belongs to on DHIS2 (must not be null).
   * 
   * @param id Sets the organization unit ID of the organization unit to which this
   *           tracked entity instance belongs to on DHIS2 (must not be null).
   * @return Sets the organization unit ID of the organization unit to which this
   *         tracked entity instance belongs to on DHIS2 (must not be null).
   */
  TrackedEntityInstance.prototype.setOrganizationUnitId = function (id) {};

  /**
   * Sets the value of a tracked entity attribute. This will be skipped when the
   * specified last updated date is before the current last updated data and the user
   * which has last modified the tracked entity was not the adapter itself.
   * 
   * @param attributeReference The reference object to the tracked entity attribute.
   * @param value              The value that should be set. The value will be converted
   *                           to the required type automatically (if possible).
   * @param lastUpdated        The last updated timestamp of the data that should be
   *                           assigned to the tracked entity. This value can be null if
   *                           check should not be made.
   * @return Returns only true if updating the value has not been skipped since the
   *         specified last updated date is before the current last updated date.
   */
  TrackedEntityInstance.prototype.setValue = function (attributeReference, value, lastUpdated) {};

  /**
   * Validates the content of the tracked entity instance and throws an exception if
   * the content is invalid.
   */
  TrackedEntityInstance.prototype.validate = function () {};

  return TrackedEntityInstance;
}());
var trackedEntityInstance = new TrackedEntityInstance();

/**
 * Contains the combination of system URI and code.
 */
var SystemCodeValue = (function ()
{
  function SystemCodeValue()
  {
    /**
     * Returns the code.
     */
    this.code = null;

    /**
     * Returns the display name that is not available in all contexts.
     */
    this.displayName = null;

    /**
     * Returns the system URI.
     */
    this.system = null;

  }

  /**
   * @param o 
   * @return 
   */
  SystemCodeValue.prototype.equals = function (o) {};

  /**
   * Returns the code.
   * 
   * @return Returns the code.
   */
  SystemCodeValue.prototype.getCode = function () {};

  /**
   * Returns the display name that is not available in all contexts.
   * 
   * @return Returns the display name that is not available in all contexts.
   */
  SystemCodeValue.prototype.getDisplayName = function () {};

  /**
   * Returns the system URI.
   * 
   * @return Returns the system URI.
   */
  SystemCodeValue.prototype.getSystem = function () {};

  /**
   * Returns the string representation of system URI and code. The string
   * representation contains the system URI and the code separated by a pipe
   * character (as used by FHIR searches).
   * 
   * @return 
   */
  SystemCodeValue.prototype.toString = function () {};

  return SystemCodeValue;
}());
Clone this wiki locally