new Observation()
Methods
-
getAttributes()
-
Returns the attribute values for this observation, as an array of data.DataSetCode
Returns:
- Type
- Array.<data.DataSetCode>
-
getAttributeValueById()
-
Returns the reported value for the Attribute as a DataSetCode. Returns null if there is no reported value for this attribute.
Returns:
- Type
- data.DataSetCode
Example
var attr = matrixObs.getAttributeValueById('OBS_STATUS'); var codeId = attr.getId(); //Returns a code value for OBS_STATUS e.g A var codeName = attr.getName(); //Returns the code name e.g Normal
-
getDataSet()
-
Returns the DataSet that this Observation belongs to.
Returns:
- Type
- data.DataSet
-
getDimensionValueByDimId(dimId)
-
Returns the reported Dimension Value for this Observations as a DataSetCode.
Returns null if no such observation value exists.
Parameters:
Name Type Description dimId
string dimension id obtained from the data.DataSetComponent#getId
Returns:
- Type
- data.DataSetCode
Example
var dimCode = obs.getDimensionValueByDimId('FREQ'); var codeId = dimCode.getId(); //Returns a code value for FREQ e.g A var codeName = dimCode.getName(); //Returns the code name e.g Annual
-
getDimensionValueByDimIdx(dimIdx)
-
Returns the reported Dimension Value as a DataSetCode for the given Dimension Index (zero indexed).
Parameters:
Name Type Description dimIdx
number refers to the position of the data.DataSetComponent as defined by the data.DataSet#getDimensions method.
Returns:
- Type
- data.DataSetCode
Example
var dimCode = obs.getDimensionValueByDimIdx(0); var dimId = dimCode.getId(); //Returns a code value for FREQ e.g A var dimValue = dimCode.getName(); //Returns the code name e.g Annual
-
getMetadata(callback)
-
Returns the fully resolved array of metadata.ReferenceMetadata
Parameters:
Name Type Description callback
function -
getMetadataDefs()
-
Returns an array of metadata.ReferenceMetadataLink, or an empty array if there are none
Returns:
-
getObsValue()
-
Returns the observation value
Returns:
- Type
- string
-
getRevisions()
-
Returns all the revisions for this observation. If there are no revisions, or if this observation is itself a revision then this will return null
Returns:
data.Observation[]
-
getShortCode()
-
Returns a short code for this Observation.
The short code is a colon separated string of coded dimension values in the order that the dimensions are specified for example A:UK:FR:INFL:2008
NOTE: The short code for any revisions to this observation will also be the same, whereas the data.Observation#getUid will always return a unique identifier
Returns:
- Type
- string
-
getUid()
-
Returns a unique identifier for this Observation. The unique identifier will uniquely identify this observation in the data.DataSet.
The UID for an observation is a concatenation of the data.Observation#getShortCode and the dataset index, as the DataSet may contain revised observations.
Returns:
- Type
- string
-
getValidFrom()
-
Returns the valid from date for this Observation.
This does not refer to the observation date, but instead the date that the Observation was published.
Returns:
- Type
- date
-
hasMetadata()
-
Returns true if there are metadata.ReferenceMetadataLink attached to this object
Returns:
- Type
- boolean
-
hasRevisions()
-
Returns true if the observation has revisions, i.e there were previous observations reported which were subsequently updated by this Observation
Returns:
- Type
- boolean
-
isDelete()
-
Returns true if this is an observation that was deleted. This will only occur if the data query request included revisions
Returns:
- Type
- boolean
-
isLatestRevision()
-
Returns true if the Observation is the latest revision, if false then it has subsequently been revised
Returns:
- Type
- boolean