Difference between revisions of "Explain Plan Web Services"
(→Invoking the Explain Plan) |
(→Invoking the Explain Map) |
||
Line 171: | Line 171: | ||
== Invoking the Explain Map == | == Invoking the Explain Map == | ||
+ | Once the above structures are in your Registry, invoking the "Explain Map" Web Service by performing a POST call (using Curl, Python or POSTMAN) to: | ||
+ | <pre> | ||
+ | <your registry>/ws/secure/structuremap/explainmap | ||
+ | </pre> | ||
+ | |||
+ | This also requires the Header parameter '''URN''' to be specified as '''urn:sdmx:org.sdmx.infomodel.mapping.StructureMap=MAPPING_TEST:SS_DF(1.0).DF_MAP_TEST''' | ||
+ | <br/> | ||
+ | The body should be the test file (above). | ||
+ | <br> | ||
+ | The resultant output will show that 3 series are mapped and the series "C55BCX:C:BEL" is unmapped. Part of the output will show: | ||
+ | <pre> | ||
+ | "mapped": { | ||
+ | "A:B:BEL": "AAAB:BEL:FIXED_EER", | ||
+ | "A:C:BEL": "AAAC:BEL:FIXED_EER", | ||
+ | "XXX:C:BAR": "AACC:BAR:FIXED_EER" | ||
+ | }, | ||
+ | "unmapped": [ | ||
+ | "C55BCX:C:BEL" | ||
+ | ] | ||
+ | </pre> | ||
== Invoking the Explain Plan == | == Invoking the Explain Plan == |
Revision as of 09:01, 8 August 2023
Contents
Overview
Note: this is the explanation for the Web Services in Fusion Registry version 10.
The Registry has the User Interface feature "Test Mapping" which can be used to test an input file against a Mapping. This feature is very useful when debugging why a mapping did not occur. This page details how to directly call the Web Services that perform the explanation of a mapping
There are 2 Web Services. The firsts "explains" what series dimensions of an input file would be mapped and which would be unmapped with regards to a specifc Map, the second analyses a particular Series Key.
'Explain Map' Web Service
From the supplied file and the specified mapping structure URN, returns a JSON object stating which series were mapped and which were unmapped from the input.
Entry Point | ws/secure/structuremap/explainmap |
Access | Secure |
Authentication | HTTP Basic Authentication |
Http Method | POST |
Accepts | SDMX-ML, SDMX-JSON or SDMX-EDI structure message |
Content-Type | application/text or application/xml |
Response Format | JSON object |
Response Statuses | 200 - Query Ok
400 - Missing Header 'URN' or Unrecognised file input 401 - Unauthorized 404 - Cannot resolve reference to Structure Map specified in URN parameter |
HTTP Headers
The following header parameters must be specified:
HTTP Header | Purpose | Allowed Values |
---|---|---|
URN | (Mandatory) States the mapping structure to map the input data against. |
A valid URN for a Mapping. E.g. urn:sdmx:org.sdmx.infomodel.mapping.StructureMap=MAPPING_TEST:SS_DF(1.0).DF_MAP_TEST |
Output
The output JSON object has 4 fields:
- source - the URN of the DSD or Dataflow that was used as the source of the mapping
- target - the URN of the DSD or Dataflow that was used as the target of the mapping
- mapped - a JSON object. Each field is a unique input key that mapped. For each field is a String stating what it mapped to.
- unmapped - a JSON Array of Strings showing which keys from the input were unmapped
Example Output
{ "source": "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=MAPPING_TEST:DF_DSD1(1.0)", "target": "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=MAPPING_TEST:DF_DSD2(1.0)", "mapped": { "A:B:BEL": "AAAB:BEL:FIXED_EER", "A:C:BEL": "AAAC:BEL:FIXED_EER", "XXX:C:BAR": "AACC:BAR:FIXED_EER" }, "unmapped": [ "C55BCX:C:BEL" ] }
'Explain Plan' Web Service
Given the specified Key and Map, returns a JSON object stating the input, mappings and output for that series key
Entry Point | ws/secure/structuremap/explainplan |
Access | Secure |
Authentication | HTTP Basic Authentication |
Http Method | GET |
Response Format | JSON object |
Response Statuses | 200 - Success 400 - Missing or invalid parameter 401 - Unauthorized 404 - Cannot resolve reference to Structure Map specified in "map" parameter |
HTTP Query Parameters
Request Parameter | Required | Purpose |
---|---|---|
dsd | Yes | The URN of the DSD or Dataflow to map against. Depending on whether the source or target DSD / Dataflow is provided, the mapping can be reversed. |
map | Yes | The URN of the Structure Map to use in the mapping |
key | Yes | This is the token that was passed back from the Fusion registry server on the publication request |
Note: in versions prior to Fusion Registry 10.9.4, the "dsd" parameter must specify a DSD and not a Datflow URN.
Output
The output JSON object has the fields:
- reverseMapping - whether this was a reversed mapping or not
- input a JSON object stating the dimensions and attributes input. The dimensions will be the same as that passed in as the input parameter "key", but whereas the key only specified the value, this field shows the ID and value relationship.
- unmapped - a list of any Dimensions that are unmapped
- mappings - states the input mappings that were mapped as well as any fixed values output
- output - a JSON object with a field of "dimensions". This field lists the IDs of the output DSD or Dataflow and states what the values would be. If a dimension has a value of "null" it is unmapped. If it has a single value it was successfully mapped. If it has multiple values there this is also a failure as it is ambiguous as to what should be output.
Example Output
{ "reverseMapping": false, "input": { "dimensions": { "FREQ": "C55BCX", "BIS_TOPIC": "C", "REF_AREA": "BEL" }, "attributes": { "OBS_STATUS": null, "OBS_PRE_BREAK": null, "OBS_CONF": null, "BREAKS": null, "COVERAGE": null } }, "unmapped": [], "mappings": { "REF_AREA:BEL": { "REF_AREA": [ "BEL" ] }, "OBS_VALUE:*": { "EER_TYPE": [ "FIXED_EER" ], "COVERAGE": [ "FIXED_CVRG" ] } }, "output": { "dimensions": { "INSTRUMENT_TYPE": [ null ], "REF_AREA": [ "BEL" ], "EER_TYPE": [ "FIXED_EER" ] } } }
Simple Example
The file attached defines a number of Structural Metadata artefacts in the Agency "MAPPING_TEST" that can be loaded into a Registry
- Structures
- Test Data
Invoking the Explain Map
Once the above structures are in your Registry, invoking the "Explain Map" Web Service by performing a POST call (using Curl, Python or POSTMAN) to:
<your registry>/ws/secure/structuremap/explainmap
This also requires the Header parameter URN to be specified as urn:sdmx:org.sdmx.infomodel.mapping.StructureMap=MAPPING_TEST:SS_DF(1.0).DF_MAP_TEST
The body should be the test file (above).
The resultant output will show that 3 series are mapped and the series "C55BCX:C:BEL" is unmapped. Part of the output will show:
"mapped": { "A:B:BEL": "AAAB:BEL:FIXED_EER", "A:C:BEL": "AAAC:BEL:FIXED_EER", "XXX:C:BAR": "AACC:BAR:FIXED_EER" }, "unmapped": [ "C55BCX:C:BEL" ]
Invoking the Explain Plan
The following demonstrates performing a secure GET request to the explainplan Web Service, testing the series "C55BCX:C:BEL" (which is unmapped) against the Structure Map, and specifying the "dsd" to be the Dataflow Reference:
(Note: This will only work on Fusion Registry 10.9.4 and above)
<your registry>/ws/secure/structuremap/explainplan?dsd=urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=MAPPING_TEST:DF_DSD1(1.0)&map=urn:sdmx:org.sdmx.infomodel.mapping.StructureMap=MAPPING_TEST:SS_DF(1.0).DF_MAP_TEST&key=C55BCX:C:BEL
If the query used the DSD that the Dataflow is referencing (in the "dsd" parameter) the same result is achieved, and this should be used for Registries pre version 10.9.4.
<your registry>/ws/secure/structuremap/explainplan?dsd=urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=MAPPING_TEST:DSD1(1.0)&map=urn:sdmx:org.sdmx.infomodel.mapping.StructureMap=MAPPING_TEST:SS_DF(1.0).DF_MAP_TEST&key=C55BCX:C:BEL