FR Health Card OCR .NET

The .NET OCR SDK supports the Health Card API.

Using the sample below, we are going to illustrate how to extract the data that we want using the OCR SDK.
Health Card sample

Quick-Start

using Mindee;
using Mindee.Input;
using Mindee.Product.Fr.HealthCard;

string apiKey = "my-api-key";
string filePath = "/path/to/the/file.ext";

// Construct a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load an input source as a path string
// Other input types can be used, as mentioned in the docs
var inputSource = new LocalInputSource(filePath);

// Call the product asynchronously with auto-polling
var response = await mindeeClient
    .EnqueueAndParseAsync<HealthCardV1>(inputSource);

// Print a summary of all the predictions
System.Console.WriteLine(response.Document.ToString());

// Print only the document-level predictions
// System.Console.WriteLine(response.Document.Inference.Prediction.ToString());

Output (RST):

########
Document
########
:Mindee ID: 9ee2733d-933a-4dcd-a73a-a31395e3b288
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/french_healthcard v1.0
:Rotation applied: Yes

Prediction
==========
:Given Name(s): NATHALIE
:Surname: DURAND
:Social Security Number: 2 69 05 49 588 157 80
:Issuance Date: 2007-01-01

Field Types

Standard Fields

These fields are generic and used in several products.

BaseField

Each prediction object contains a set of fields that inherit from the generic BaseField class.
A typical BaseField object will have the following attributes:

  • Confidence (double?): the confidence score of the field prediction.
  • BoundingBox (BoundingBox): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
  • Polygon (Polygon): contains the relative vertices coordinates (Polygon extends List<Point>) of a polygon containing the field in the image.
  • PageId (int?): the ID of the page, always null when at document-level.

Note: A Point simply refers to a List of double.

Aside from the previous attributes, all basic fields have access to a custom ToString method that can be used to print their value as a string.

StringField

The text field StringField extends BaseField, but also implements:

  • Value (string): corresponds to the field value.
  • RawValue (string): corresponds to the raw value as it appears on the document.

DateField

The date field DateField extends StringField, but also implements:

  • DateObject (DateTime?): an accessible representation of the value as a C# object. Can be null.

Attributes

The following fields are extracted for Health Card V1:

Given Name(s)

GivenNames: The given names of the card holder.

foreach (var GivenNamesElem in result.Document.Inference.Prediction.GivenNames)
{
    System.Console.WriteLine(GivenNamesElem.Value);
}

Issuance Date

IssuanceDate: The date when the carte vitale document was issued.

System.Console.WriteLine(result.Document.Inference.Prediction.IssuanceDate.Value);

Social Security Number

SocialSecurity: The social security number of the card holder.

System.Console.WriteLine(result.Document.Inference.Prediction.SocialSecurity.Value);

Surname

Surname: The surname of the card holder.

System.Console.WriteLine(result.Document.Inference.Prediction.Surname.Value);

Questions?

Join our Slack