How to GET only custom Field Names from Azure Form Recognizer API? - ocr

I trained a Custom Form Recognizer Model. It tests great. But I can't find the API endpoint to call that returns ONLY the key/value pairs for the form I sent the model to analyze.
Example:
I trained a custom model to find First name and Last name only
When I POST a PDF to the endpoint:
https://{my-project}.cognitiveservices.azure.com/formrecognizer/documentModels/{my-model}:analyze?api-version=2022-08-31
Then view JSON from the Operation-Location header:
https://form-rec-ocr-test.cognitiveservices.azure.com/formrecognizer/documentModels/{model-name}/analyzeResults/{GUID}?api-version=2022-08-31
I get aaaaallll the text on the submitted PDF instead of only the First name and Last name fields. I just want the key/value pairs to insert them into a table.
What is the correct API endpoint to call? The API docs here are focused on pre-build models instead of Custom Models.

For some reason, this was not lined out in any documentation I came across. Found the answer in this video #36:30.
The data was in the original JSON object, just at line 3300 under the document node.
Would simplify things if the Form Recognizer API could return ONLY the document array by defining a simple query parameter.

Related

Symfony API, form submissions vs json api

Quick question regarding submitting both form data and json data to a Symonfy endpoint.
I have FosRest bundle and a form with a PercentType
The PercentType transforms .95 to 95 for the view purposes, which means when submitting via a form 95 is expected. However my API sends and receives data in the model format ie 0.95.
Now when a user POST's json to the api 0.95 is transformed by the form to 0.0095 (dividing by 100).
I want to use the form in both cases to map, transform and validate data.
My first guess was to change the PercentType to NumberType depending on the request format (json vs html). Alternatively disable the transformer.
Has anyone got any experience with this situation? It's the same issue for MoneyType when storing values as cents.

Send custom property with value as JSON array

We want to send some events to Application Insights with data showing which features a user owns, and are available for the session. These are variable, and the list of items will probably grow/change as we continue deploying updates. Currently we do this by building a list of properties dynamically at start-up, with values of Available/True.
Since AI fromats each event data as JSON, we thought it would be interesting to send through custom data as JSON so it can be processed in a similar fashion. Having tried to send data as JSON though, we bumped into an issue where AI seems to send through escape characters in the strings:
Eg. if we send a property through with JSON like:
{"Property":[{"Value1"},..]}
It gets saved in AI as:
{\"Property\":[{\"Value1\"},..]} ).
Has anyone successfully sent custom JSON to AI, or is the platform specifically trying to safeguard against such usage? In our case, where we parse the data out in Power BI, it would simplify and speed up a lot some queries by being able to send a JSON array.
AI treats custom properties as strings, you'd have to stringify any json you want to send (and keep it under the length limit for custom property sizes), and then re-parse it on the other side.

Apigility field accepting an array of embedded objects?

I'd like to create an Apigility REST service which accepts POSTs of, for example, a user object which has a field containing an array of address objects. I can define the field without validators and process the raw JSON in my code, but I'm wondering if there is a better way to do this where the nested objects can also be validated by Apigility?
Apigility has a module called content-validation -- it allows you to configure input filters for your services, and request data will be passed through the input filter for validation and an appropriate ApiProblem response is returned when validation fails. (see https://apigility.org/documentation/api-primer/content-validation)
That still leaves the onus on you to configure an input filter that will suit your needs.
I would check packagist.org for a JSON Schema validator library which can take a JSON schema and a JSON payload and verify that the payload is well formed according to the schema. Then you can easily implement a custom InputFilter and bind it to your services. This will give you validation that the main object and sub objects are well formed (ie: user has name, email, birth date and address field contains objects that all have address/street/zip/etc).

Fusion Charts for representing data in graphical form

I am trying to render my data in a graph using fusion charts. I have a web service that returns the data in JSON format. I want to render chart for that data. can I directly give the URL of my web service so that I cannot set key value pairs. Is it possible to do so/ Can any one please tell me how to do this.
It can use a JSON URL/feed, a JSON Object (in JavaScript) or JSON String. This functionality is provided by FusionCharts class method setJSONUrl(). Example
myChart.setJSONUrl("Data.json");
See http://docs.fusioncharts.com/charts/contents/FirstChart/JSONData.html
FusionCharts Suite has a specific JSON structure for each category of charts. While passing the data to render method, data is expected in the pre defined format. Please refer to: http://docs.fusioncharts.com/charts/contents/DataFormats/JSON/Overview.html

zf2 json view script

We are currently trying to set up routes in such a way that the returned content-type can be set using a route parameter. The routing is all working properly now, but there is one problem. If one requests html, then the normal view script is rendered. The data we provide to this script can be anything from a string to a collection of objects, and the view script decides what to show to the user.
If however JSON response is requested, then we just provide the data returned from our controller as JSON. However, some data should not be made publicly available to the user, and hence some filtering is required. Is there any possibility to use JSON view scripts (as in ZF1 with context-switch) in order to support such filtering? Or maybe another method?
There is no such thing as a JSON script which lets you decide what to render and what not. You have to provide the proper data in the view model such that only the data is given that is eligible to be displayed.
I have been thinking about a hook in the JSON renderer so you can filter the view model's data based on the context of the request, but such thing does not exist yet. Unfortunately, you have to select the data in your controller or model.