Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace FhirPathFunction documentation string with a class #281

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.tofhir.common.util

import io.onfhir.path.annotation.FhirPathFunction
import io.onfhir.api.FHIR_DATA_TYPES
import io.onfhir.path.annotation.{FhirPathFunction, FhirPathFunctionDocumentation, FhirPathFunctionParameter, FhirPathFunctionReturn}
import io.onfhir.path.grammar.FhirPathExprParser.ExpressionContext
import io.onfhir.path.{AbstractFhirPathFunctionLibrary, FhirPathEnvironment, FhirPathException, FhirPathExpressionEvaluator, FhirPathResult, FhirPathString, IFhirPathFunctionLibraryFactory}

Expand All @@ -23,8 +24,32 @@ class CustomMappingFunctions(context: FhirPathEnvironment, current: Seq[FhirPath
* @param dataExpr String data such that byte representation of each 2 consecutive characters represents a number.
* @return Space separated numbers concatenated in a string
*/
@FhirPathFunction(documentation = "\uD83D\uDCDC Decodes the given data and converts it to an array of space separated numbers. Returns the space separated numbers concatenated in a string.\n\n\uD83D\uDCDD <span style=\"color:#ff0000;\">_@param_</span> **`dataExpr`** \nString data such that byte representation of each 2 consecutive characters represents a number.\n\n\uD83D\uDD19 <span style=\"color:#ff0000;\">_@return_</span> \n```\n'123 456 123'\n``` \n\uD83D\uDCA1 **E.g.** cst:createTimeSeriesData(%data)",
insertText = "cst:createTimeSeriesData(<dataExpr>)", detail = "cst", label = "cst:createTimeSeriesData", kind = "Method", returnType = Seq("string"), inputType = Seq("string"))
@FhirPathFunction(
documentation = FhirPathFunctionDocumentation(
detail = "Decodes the given data and converts it to an array of space separated numbers. Returns the space separated numbers concatenated in a string.",
usageWarnings = None,
parameters = Some(Seq(
FhirPathFunctionParameter(
name = "dataExpr",
detail = "String data such that byte representation of each 2 consecutive characters represents a number.",
examples = None
)
)),
returnValue = FhirPathFunctionReturn(
detail = None,
examples = Seq("'123 456 123'")
),
examples = Seq(
"cst:createTimeSeriesData(%data)"
)
),
insertText = "cst:createTimeSeriesData(<dataExpr>)",
detail = "cst",
label = "cst:createTimeSeriesData",
kind = "Method",
returnType = Seq(FHIR_DATA_TYPES.STRING),
inputType = Seq(FHIR_DATA_TYPES.STRING)
)
def createTimeSeriesData(dataExpr: ExpressionContext): Seq[FhirPathResult] = {
val dataResult = new FhirPathExpressionEvaluator(context, current).visit(dataExpr)
if (dataResult.length > 1 || !dataResult.head.isInstanceOf[FhirPathString]) {
Expand Down
Loading
Loading