Opened 7 years ago

Closed 7 years ago

#1518 closed defect (fixed)

WCST_Import check the evaluation expressions metadata result in ingredient file

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 9.4
Component: wcst_import Version: development
Keywords: wcst_import expression, ingredient file Cc: Vlad Merticariu, Dimitar Misev
Complexity: Medium

Description

wcst_import evaluation expression has the syntax ${…} and the expression will be evaluated to get the value (e.g: netCDF variable's metadata).

However, if the $ is missing, it just pass the invalidate message to petascope such as: "description": "'{grib:marsClass}'",

and could lead to petascope postgresql query is not valid due to the expression is not evaluated:

SELECT id,label FROM ps_quantity WHERE uom_id='1'
AND description=''{grib:marsClass}'' AND nil_ids='{13}'

ERROR:  syntax error at or near "{"
LINE 1: ...OM ps_quantity WHERE uom_id='1' AND description=''{grib:mars...
                                                             ^

Ingredient file example: https://pastebin.com/FcAraFhC
which has invalid syntax in band's metadata with description element which needs to throw error in wcst_import

          "bands": [
            {
              "name": "2_metre_temperature_surface",
              "identifier": "'${grib:cfVarName}'",
	      "description": "'{grib:marsClass}'",
              "nilReason": "Nil value represents missing values.",
              "nilValue": "'${grib:missingValue}'"
            }

Change History (10)

comment:1 by Dimitar Misev, 7 years ago

So is this valid?

                "metadata": {
                    "type": "xml",
                    "global": {
                        "Title": "'This is a test coverage'"
                    }
                },

comment:2 by Bang Pham Huu, 7 years ago

@Dimitar: the {} without $ is invalid, yours is valid.

comment:3 by Dimitar Misev, 7 years ago

Just be careful; if you're going to change whether "'text'" is valid or not, make sure that existing ingredients files are not broken.

in reply to:  3 comment:4 by Bang Pham Huu, 7 years ago

Replying to dmisev:

Just be careful; if you're going to change whether "'text'" is valid or not, make sure that existing ingredients files are not broken.

I only check if the evaluation with {} miss the $.

comment:5 by Dimitar Misev, 7 years ago

Why is it invalid? I understand that "'This is a test coverage'" is just text; I can't have { or } in a title?

in reply to:  5 comment:6 by Bang Pham Huu, 7 years ago

Replying to dmisev:

Why is it invalid? I understand that "'This is a test coverage'" is just text; I can't have { or } in a title?

metadata could be in JSON format then the "{" or "}" is keywords and should not be used in string.

comment:7 by Dimitar Misev, 7 years ago

here it's xml type so they are valid I guess?

in reply to:  7 comment:8 by Bang Pham Huu, 7 years ago

Replying to dmisev:

here it's xml type so they are valid I guess?

Actually, I'm not the one who created this syntax, so I will check wcst_import first, I think in the ticket error, it should just remove the and "{….}" is a valid string as well in SQL, instead of "'{….}'". "'" seems to be used for making this evaluation returns a string.

comment:9 by Bang Pham Huu, 7 years ago

Summary: WCST_Import validate all the evaluation expressions in ingredient fileWCST_Import check the evaluation expressions metadata result in ingredient file

comment:10 by Bang Pham Huu, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.