-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for trackedEntities analytics requests (DHIS2-16023) (
#1594) implement Analytics class for tracked entities request add support for the new trackedEntity/query endpoint adjust dimension id formatting
- Loading branch information
Showing
15 changed files
with
174 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import AnalyticsBase from './AnalyticsBase.js' | ||
|
||
/** | ||
* @extends module:analytics.AnalyticsBase | ||
* | ||
* @description | ||
* Analytics tracked entities class used to request analytics tracked entities data from Web API. | ||
* | ||
* @memberof module:analytics | ||
*/ | ||
class AnalyticsTrackedEntities extends AnalyticsBase { | ||
/** | ||
* @param {!AnalyticsRequest} req Request object | ||
* | ||
* @returns {Promise} Promise that resolves with the analytics query data from the api. | ||
* | ||
* @example | ||
// TODO: provide working example | ||
*/ | ||
getQuery(req) { | ||
return this.fetch(req.withPath('trackedEntities/query')) | ||
} | ||
} | ||
|
||
export default AnalyticsTrackedEntities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { AXIS } from './axis.js' | ||
import { dimensionGetId } from './dimensionGetId.js' | ||
|
||
export const axisGetDimensionIds = (axis) => | ||
export const axisGetDimensionIds = (axis, outputType) => | ||
AXIS.isValid(axis) | ||
? axis.map((dimension) => dimensionGetId(dimension)) | ||
? axis.map((dimension) => dimensionGetId(dimension, outputType)) | ||
: AXIS.defaultValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { DIMENSION_PROP_ID, DIMENSION_PROP_PROGRAM_STAGE } from './dimension.js' | ||
import { formatDimension } from '../../api/analytics/utils.js' | ||
import { | ||
DIMENSION_PROP_ID, | ||
DIMENSION_PROP_PROGRAM_STAGE, | ||
DIMENSION_PROP_PROGRAM, | ||
} from './dimension.js' | ||
|
||
export const dimensionGetId = (dimension) => | ||
dimension[DIMENSION_PROP_PROGRAM_STAGE.name]?.id | ||
? `${dimension[DIMENSION_PROP_PROGRAM_STAGE.name].id}.${ | ||
dimension[DIMENSION_PROP_ID.name] | ||
}` | ||
: dimension[DIMENSION_PROP_ID.name] | ||
export const dimensionGetId = (dimension, outputType) => | ||
formatDimension({ | ||
dimension: dimension[DIMENSION_PROP_ID.name], | ||
programId: dimension[DIMENSION_PROP_PROGRAM.name]?.id, | ||
programStageId: dimension[DIMENSION_PROP_PROGRAM_STAGE.name]?.id, | ||
outputType, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.