This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Javascript API for Rules and Transformations from DHIS 2 (1.1)
Volker edited this page Mar 13, 2019
·
2 revisions
The JavaScript library for rules and transformations from DHIS 2 to FHIR 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/from-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.
*/
/**
* 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;
}());
/**
* The current DHIS 2 request (created or updated resource) that caused the
* execution of the transformation.
*/
var DhisRequest = (function ()
{
function DhisRequest()
{
/**
* Returns if complete transformation should be performed. Otherwise just the
* resource specific data will be transformed.
*/
this.completeTransformation = null;
/**
* Returns if the request uses DHIS FHIR IDs instead of FHIR IDs of a remote FHIR
* system.
*/
this.dhisFhirId = null;
/**
* Returns if the resulting FHIR resource should contain to other resources.
*/
this.includeReferences = null;
/**
* Returns the timestamp when the processed DHIS 2 resource has been updated the
* last time.
*/
this.lastUpdated = null;
/**
* Returns the processed DHIS 2 resource type as Java enumeration (e.g.
* TRACKED_ENTITY as enum constant).
*/
this.resourceType = null;
}
/**
* Returns the timestamp when the processed DHIS 2 resource has been updated the
* last time.
*
* @return Returns the timestamp when the processed DHIS 2 resource has been
* updated the last time.
*/
DhisRequest.prototype.getLastUpdated = function () {};
/**
* Returns the processed DHIS 2 resource type as Java enumeration (e.g.
* TRACKED_ENTITY as enum constant).
*
* @return Returns the processed DHIS 2 resource type as Java enumeration (e.g.
* TRACKED_ENTITY as enum constant).
*/
DhisRequest.prototype.getResourceType = function () {};
/**
* Returns if complete transformation should be performed. Otherwise just the
* resource specific data will be transformed.
*
* @return Returns if complete transformation should be performed. Otherwise just
* the resource specific data will be transformed.
*/
DhisRequest.prototype.isCompleteTransformation = function () {};
/**
* Returns if the request uses DHIS FHIR IDs instead of FHIR IDs of a remote FHIR
* system.
*
* @return Returns if the request uses DHIS FHIR IDs instead of FHIR IDs of a
* remote FHIR system.
*/
DhisRequest.prototype.isDhisFhirId = function () {};
/**
* Returns if the resulting FHIR resource should contain to other resources.
*
* @return Returns if the resulting FHIR resource should contain to other
* resources.
*/
DhisRequest.prototype.isIncludeReferences = function () {};
return DhisRequest;
}());
/**
* 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;
}());
/**
* The context of the current transformation.
*/
var DhisContext = (function ()
{
function DhisContext()
{
/**
* Returns the DHIS request (type DhisRequest) that causes the current
* transformation execution.
*/
this.dhisRequest = null;
/**
* Returns the code of the FHIR client that is associated with the execution of the
* current transformation.
*/
this.fhirClientCode = null;
/**
* Returns if the current transformation groups FHIR resources.
*/
this.grouping = null;
/**
* Returns if the adapter should add an adapter specific identifier when creating
* or updating resources.
*/
this.useAdapterIdentifier = null;
/**
* Returns the FHIR version of the processed FHIR resource as Java enumeration
* (e.g. DSTU3 as enum constant).
*/
this.version = null;
}
/**
* 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.
*/
DhisContext.prototype.fail = function (message) {};
/**
* Returns the DHIS FHIR resource reference for the specified DHIS resource.
* Optionally the FHIR resource types can be limited to the specified FHIR resource
* types.
*
* @param dhisResource The DHIS resource for which a FHIR resource reference
* should be returned.
* @param fhirResourceTypes Zero or more FHIR resource types of the returned reference.
* If no resource type is specified any FHIR resource type may
* be returned in the reference.
* @return Returns the DHIS FHIR resource reference for the DHIS resource or null
* if no matching rule can be found.
*/
DhisContext.prototype.getDhisFhirResourceReference = function (dhisResource, fhirResourceTypes) {};
/**
* Returns the DHIS FHIR resource references for the specified DHIS resource.
* Optionally the FHIR resource types can be limited to the specified FHIR resource
* types.
*
* @param dhisResource The DHIS resource for which a FHIR resource reference
* should be returned.
* @param fhirResourceTypes Zero or more FHIR resource types of the returned reference.
* If no resource type is specified any FHIR resource type may
* be returned in the reference.
* @return Returns the DHIS FHIR resource references for the DHIS resource or an
* empty list if no matching rule can be found.
*/
DhisContext.prototype.getDhisFhirResourceReferences = function (dhisResource, fhirResourceTypes) {};
/**
* Returns the DHIS request (type DhisRequest) that causes the current
* transformation execution.
*
* @return Returns the DHIS request (type DhisRequest) that causes the current
* transformation execution.
*/
DhisContext.prototype.getDhisRequest = function () {};
/**
* Returns the code of the FHIR client that is associated with the execution of the
* current transformation.
*
* @return Returns the code of the FHIR client that is associated with the
* execution of the current transformation.
*/
DhisContext.prototype.getFhirClientCode = 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).
*/
DhisContext.prototype.getVersion = function () {};
/**
* Returns if the current transformation groups FHIR resources.
*
* @return Returns if the current transformation groups FHIR resources.
*/
DhisContext.prototype.isGrouping = function () {};
/**
* Returns if the adapter should add an adapter specific identifier when creating
* or updating resources.
*
* @return Returns if the adapter should add an adapter specific identifier when
* creating or updating resources.
*/
DhisContext.prototype.isUseAdapterIdentifier = function () {};
/**
* Causes that the current transformation will fail due to the specified missing
* resource. It will be tried to create the missing resource.
*
* @param dhisResourceId The DHIS resource ID that is missing.
*/
DhisContext.prototype.missingDhisResource = function (dhisResourceId) {};
/**
* Returns the current timestamp as date/time.
*
* @return The current timestamp as date/time.
*/
DhisContext.prototype.now = function () {};
return DhisContext;
}());
var context = new DhisContext();
/**
* Utilities to handle DHIS2 to FHIR transformations of FHIR encounters.
*/
var EncounterUtils = (function ()
{
function EncounterUtils()
{
}
/**
* Returns the encounter status for the specified code.
*
* @param code The code for which a encounter status should be returned.
* @return The encounter status for the specified code.
*/
EncounterUtils.prototype.getEncounterStatus = function (code) {};
return EncounterUtils;
}());
var encounterUtils = new EncounterUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of FHIR locations.
*/
var LocationUtils = (function ()
{
function LocationUtils()
{
}
/**
* Returns the location status for the specified code.
*
* @param code The code for which a location status should be returned.
* @return The location status for the specified code.
*/
LocationUtils.prototype.getLocationStatus = function (code) {};
return LocationUtils;
}());
var locationUtils = new LocationUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of date time value.
*/
var DateTimeUtils = (function ()
{
function DateTimeUtils()
{
}
/**
* Returns a date/time element for the specified date/time value.
*
* @param dateTime The date/time value that should be converted.
* @return Returns if the specified date/time value as date/time element.
*/
DateTimeUtils.prototype.getDateTimeElement = function (dateTime) {};
/**
* Returns a date/time element for the specified date/time value with day
* precision.
*
* @param dateTime The date/time value that should be converted.
* @return Returns if the specified date/time value as date/time element with day
* precision.
*/
DateTimeUtils.prototype.getDayDateTimeElement = function (dateTime) {};
/**
* Returns a date/time element for the specified date/time 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 value for which the evaluation should be performed.
* @return Returns if the specified date/time value as date/time element or null
* when it has not at least day precision.
*/
DateTimeUtils.prototype.getPreciseDateElement = function (dateTime) {};
return DateTimeUtils;
}());
var dateTimeUtils = new DateTimeUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of vital signs.
*/
var VitalSignUtils = (function ()
{
function VitalSignUtils()
{
}
return VitalSignUtils;
}());
var vitalSignUtils = new VitalSignUtils();
/**
* Utilities for GEO information handling.
*/
var GeoUtils = (function ()
{
function GeoUtils()
{
}
/**
* Creates the location position from the specified coordinates (latitude and
* longitude).
*
* @param coordinates The coordinates (must be a single point as location) that should
* be set as GEO location extension in the address.
* @return Returns the coordinates as location position with latitude and longitude
* or null if the coordinates do not specify a position.
*/
GeoUtils.prototype.createLocationPosition = function (coordinates) {};
/**
* 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) {};
/**
* 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.
* @param coordinates The coordinates (must be a single point as location) that should
* be set as GEO location extension in the address.
*/
GeoUtils.prototype.updateAddress = function (element, coordinates) {};
return GeoUtils;
}());
var geoUtils = new GeoUtils();
/**
* Utilities for retrieving data from a client FHIR service.
*/
var FhirClientUtils = (function ()
{
function FhirClientUtils()
{
}
return FhirClientUtils;
}());
var fhirClientUtils = new FhirClientUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of FHIR resources.
*/
var FhirResourceUtils = (function ()
{
function FhirResourceUtils()
{
}
/**
* Returns if the specified string value is included in the specified string type
* list.
*
* @param stringList The list of string type values.
* @param value The value that should be checked in the string type list.
* @return
*/
FhirResourceUtils.prototype.containsString = function (stringList, value) {};
/**
* Creates a FHIR codeable concept.
*
* @return The created FHIR codeable concept.
*/
FhirResourceUtils.prototype.createCodeableConcept = function () {};
/**
* Returns the created reference for the specified resource.
*
* @param resource The FHIR Resource for which the reference should be created.
* @return
*/
FhirResourceUtils.prototype.createReference = function (resource) {};
/**
* 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) {};
/**
* 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();
/**
* Utilities to handle DHIS2 to FHIR transformations of human names.
*/
var HumanNameUtils = (function ()
{
function HumanNameUtils()
{
}
/**
* Updates the given name of the human name with the components if the specified
* first name (separated by space).
*
* @param humanName The FHIR human name on which the given name should be updated.
* @param firstName All first names separated by space characters.
*/
HumanNameUtils.prototype.updateGiven = function (humanName, firstName) {};
return HumanNameUtils;
}());
var humanNameUtils = new HumanNameUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of administrative gender.
*/
var GenderUtils = (function ()
{
function GenderUtils()
{
}
/**
* Returns the administrative gender for the specified DHIS option value.
*
* @param optionValue The DHIS option value for the gender.
* @return
*/
GenderUtils.prototype.getAdministrativeGender = function (optionValue) {};
return GenderUtils;
}());
var genderUtils = new GenderUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations for codes (either code
* mappings or converting to codes from FHIR codeable concepts and identifiers).
*/
var CodeUtils = (function ()
{
function CodeUtils()
{
/**
* Returns the FHIR codeable concept that is associated with this rule. Only codes
* that are preferred for export are included.
*/
this.ruleCodeableConcept = null;
}
/**
* 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 mappedCode The code in context of mapped code for 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 code that belongs to the specified mapped code.
*/
CodeUtils.prototype.getByMappedCode = function (mappedCode, fhirResourceType) {};
/**
* Returns the specified code without the code prefix that has been defined for the
* specified resource type of the currently used FHIR client.
*
* @param code The code with our without a prefix that should be returned
* without a code prefix.
* @param fhirResourceType The FHIR resource type (upper case letters, separated by
* underscores) from which the associated system URI should be
* taken.
* @return The code without the code prefix that has been defined for the resource
* type.
*/
CodeUtils.prototype.getCodeWithoutPrefix = function (code, fhirResourceType) {};
/**
* Returns the FHIR codeable concept that is associated with this rule. Only codes
* that are preferred for export are included.
*
* @return The codeable concept that is associated with the rule for which the
* script is executed. If no code set is attached to the rule, null is
* returned.
*/
CodeUtils.prototype.getRuleCodeableConcept = function () {};
return CodeUtils;
}());
var codeUtils = new CodeUtils();
/**
* 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();
/**
* Utilities to handle DHIS2 to FHIR transformations of FHIR observations.
*/
var ObservationUtils = (function ()
{
function ObservationUtils()
{
}
/**
* Returns the observation status for the specified code.
*
* @param code The code for which a observation status should be returned.
* @return The observation status for the specified code.
*/
ObservationUtils.prototype.getObservationStatus = function (code) {};
return ObservationUtils;
}());
var observationUtils = new ObservationUtils();
/**
* Utilities to handle DHIS2 to FHIR transformations of FHIR identifiers.
*/
var IdentifierUtils = (function ()
{
function IdentifierUtils()
{
}
/**
* Adds or updated the identifier with the specified system URI on the specified
* FHIR resource. An error occurs if the specified FHIR resource does not support
* identifiers.
*
* @param resource The FHIR resource on which the identifier should be set or updated.
* @param system The system URI of the identifier that should be set or updated.
* @param value The identifier value itself that should be set or updated (in
* context of the system URI).
*/
IdentifierUtils.prototype.addOrUpdateIdentifier = function (resource, system, value) {};
return IdentifierUtils;
}());
var identifierUtils = new IdentifierUtils();
/**
* 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;
}());
/**
* 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 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();
/**
* 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;
}());
/**
* 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();
/**
* Utilities to access information of data elements that are associated with the
* transformation of DHIS2 events.
*/
var DataElementUtils = (function ()
{
function DataElementUtils()
{
}
/**
* Returns the name of the references data element.
*
* @param dataElementReference The reference of the data element for which the name
* should be returned.
* @return The name of the referenced data element.
*/
DataElementUtils.prototype.getDataElementName = function (dataElementReference) {};
return DataElementUtils;
}());
var dataElementUtils = new DataElementUtils();
Copyright (c) 2004-2019, University of Oslo. All rights reserved.
- Default FHIR Patient to DHIS 2 Tracked Entity Instance Mapping
- FHIR Administrative Gender to DHIS 2 Code Set Code
- Initial Setup
- Excel Import of Mappings
- FHIR REST Interfaces
- Connect a new FHIR Server
- Constants
- Coding Systems
- Configure FHIR Resources
- Export and Import
- Limitations
- REST API for Administration and Mapping
- Javascript API for Rules and Transformations to DHIS 2
- Javascript API for Rules and Transformations from DHIS 2
- Connect HAPI FHIR JPA Server
- Connect Jembi HEARTH FHIR Server
- Direct FHIR Import from OpenMRS
- Default FHIR Patient to DHIS 2 Tracked Entity Instance Mapping
- FHIR Administrative Gender to DHIS 2 Code Set Code
- Create Tracker Program with Vital Sign
- Add SNOMED CT Code for Vital Sign
- Export Organizations and Locations to FHIR Server
- Export Patients to FHIR Server
- Handle custom Tracked Entity Instance with no Attributes
- Mapping of Organizations