Unify Monthly Data

From Fusion Registry Wiki
Jump to navigation Jump to search

Overview

The Registry has the ability to unify monthly data so that the formats: yyyy-mm and yyyy-Mmm are considered the same on a data input. By default the Registry will treat the dates 2000-01 and 2000-M01 as different observation times. If you wish these to be represented as the same format (either with or without the "M" character) this can be enabled in the Registry. In Registry version 10.5.7 there is no User Interface for this feature and it must be enabled by invoking a Web Service.

There are 3 modes that the Registry can be in:

  • Default mode: 2001-01 and 2001-M01 are considered different observation times
  • Include the "M" Character: when data is read or output by the system yyyy-mm values are converted into yyyy-Mmm. 2001-01 would be output as 2001-M01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.
  • Excluding the "M" Character: when data is read or output by the system yyyy-Mmm values are converted into yyyy-mm. 2001-M01 would be output as 2001-01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.

Web Services

There are two Web Services: one for setting the way the Registry interprets monthly dates and the other for returning the current way that the Registry is set up.

Setting the Monthly Format

Issue a POST request to the URL: <registry location>/ws/secure/settings/setDataFrequencyFormat

This is a secure Web Service, so Authentication Credentials must be provided.

The Web Service takes a JSON Object which has a single field "MonthlyDataFormat". Valid values for this are: "", "INCLUDE_M_CHARACTER", "EXCLUDE_M_CHARACTER"

An example of Valid JSON:

{
  "MonthlyDataFormat": "INCLUDE_M_CHARACTER"
}

Getting the Current Monthly Format

Issue a GET request to the URL: <registry location>/ws/secure/settings/getDataFrequencyFormat

This is a secure Web Service, so Authentication Credentials must be provided.

A JSON Object will be returned which will state how the Registry has been configured. An example:

{
  "MonthlyDataFormat": "EXCLUDE_M_CHARACTER"
}

Examples

POST requests cannot be made from a Web Browser (whereas GET requests can). A tool such as POSTMAN or curl can be used.

This is an example curl command that can be used to set the Registry to unify the dates so that the "M" character is always output. The username is "admin", the password is "pwd" and the Registry has been deployed to MyServer.com

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"MonthlyDataFormat": "INCLUDE_M_CHARACTER"}' \
  --user admin:pwd \
  http://MyServer.com/ws/secure/settings/setDataFrequencyFormat