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

[Form Recognizer] Add misc properties on models #34363

Merged
merged 4 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
- Added support for AzureBlobList source type when building document models
- Added support for building, getting, listing and deleting classifiers
- Added support for queryFields premium feature when performing analysis operations
- Added model `QuotaDetails` and property `customNeuralDocumentModelBuilds` on `ResourceDetails`
- Added property `expiresOn` to `DocumentModelDetails` and `DocumentModelSummary`
- Added properties on `DocumentStyle` : `similarFontFamily`, `fontStyle`, `fontWeight`, `color`, `backgroundColor`
- Added property `commonName` to `DocumentKeyValuePair`.
- Added support for ParagraphRole `formulaBlock`
- Added support for `code` property on `CurrencyValue`
- Added properties `unit`, `cityDistrict`, `stateDistrict`, `suburb`, `house`, and `level` to `AddressValue`
- Added method `isValueBoolean` to model `DocumentField`
- Added support for `DocumentFieldType.BOOLEAN`

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public final class DocumentModelDetails {
*/
private Map<String, String> tags;

private OffsetDateTime expiresOn;


/**
* Get the Unique model identifier.
*
Expand Down Expand Up @@ -103,6 +106,19 @@ private void setTags(Map<String, String> tags) {
this.tags = tags;
}

/**
* Get the Date and time (UTC) when the analyze operation was submitted.
*
* @return the expiresOn value.
*/
public OffsetDateTime getExpiresOn() {
return expiresOn;
}

private void setExpiresOn(OffsetDateTime expiresOn) {
this.expiresOn = expiresOn;
}

static {
DocumentModelDetailsHelper.setAccessor(new DocumentModelDetailsHelper.DocumentModelDetailsAccessor() {
@Override
Expand All @@ -129,6 +145,11 @@ public void setDocTypes(DocumentModelDetails documentModelDetails, Map<String, D
public void setTags(DocumentModelDetails documentModelDetails, Map<String, String> tags) {
documentModelDetails.setTags(tags);
}

@Override
public void setExpiresOn(DocumentModelDetails documentModelDetails, OffsetDateTime expiresOn) {
documentModelDetails.setExpiresOn(expiresOn);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public final class DocumentModelSummary {
* List of key-value tag attributes associated with the model.
*/
private Map<String, String> tags;
private OffsetDateTime expiresOn;


/**
* Get the unique model identifier.
Expand Down Expand Up @@ -104,6 +106,19 @@ void setTags(Map<String, String> tags) {
this.tags = tags;
}

/**
* Get the Date and time (UTC) when the document model will expire.
*
* @return the expiresOn value.
*/
public OffsetDateTime getExpiresOn() {
return expiresOn;
}

private void setExpiresOn(OffsetDateTime expiresOn) {
this.expiresOn = expiresOn;
}

static {
DocumentModelSummaryHelper.setAccessor(new DocumentModelSummaryHelper.DocumentModelSummaryAccessor() {
@Override
Expand All @@ -125,6 +140,11 @@ public void setCreatedOn(DocumentModelSummary documentModelSummary, OffsetDateTi
public void setTags(DocumentModelSummary documentModelSummary, Map<String, String> tags) {
documentModelSummary.setTags(tags);
}

@Override
public void setExpiresOn(DocumentModelSummary documentModelSummary, OffsetDateTime expiresOn) {
documentModelSummary.setExpiresOn(expiresOn);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.ai.formrecognizer.documentanalysis.administration.models;

import com.azure.ai.formrecognizer.documentanalysis.implementation.util.QuotaDetailsHelper;
import com.azure.core.annotation.Immutable;

import java.time.OffsetDateTime;

/** Quota used, limit, and next reset date/time. */
@Immutable
public final class QuotaDetails {
/*
* Amount of the resource quota used.
*/
private int used;

/*
* Resource quota limit.
*/
private int quota;

/*
* Date/time when the resource quota usage will be reset.
*/
private OffsetDateTime quotaResetDateTime;


/**
* Get the used property: Amount of the resource quota used.
*
* @return the used value.
*/
public int getUsed() {
return this.used;
}

/**
* Get the quota property: Resource quota limit.
*
* @return the quota value.
*/
public int getQuota() {
return this.quota;
}

/**
* Get the quotaResetDateTime property: Date/time when the resource quota usage will be reset.
*
* @return the quotaResetDateTime value.
*/
public OffsetDateTime getQuotaResetDateTime() {
return this.quotaResetDateTime;
}

private void setUsed(int used) {
this.used = used;
}

private void setQuota(int quota) {
this.quota = quota;
}

private void setQuotaResetDateTime(OffsetDateTime quotaResetDateTime) {
this.quotaResetDateTime = quotaResetDateTime;
}

static {
QuotaDetailsHelper.setAccessor(new QuotaDetailsHelper.QuotaDetailsAccessor() {
@Override
public void setUsed(
QuotaDetails quotaDetails, int used) {
quotaDetails.setUsed(used);
}

@Override
public void setQuota(
QuotaDetails quotaDetails, int quota) {
quotaDetails.setQuota(quota);
}

@Override
public void setQuotaResetDateTime(
QuotaDetails quotaDetails, OffsetDateTime quotaResetDateTime) {
quotaDetails.setQuotaResetDateTime(quotaResetDateTime);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public final class ResourceDetails {
*/
private int customDocumentModelLimit;

private QuotaDetails customNeuralDocumentModelBuilds;

/**
* Get the current count of built document analysis models
*
Expand All @@ -48,6 +50,20 @@ private void setCustomDocumentModelLimit(int customDocumentModelLimit) {
this.customDocumentModelLimit = customDocumentModelLimit;
}

/**
* Get the customNeuralDocumentModelBuilds property: Quota used, limit, and next reset date/time.
*
* @return the customNeuralDocumentModelBuilds value.
*/
public QuotaDetails getCustomNeuralDocumentModelBuilds() {
return customNeuralDocumentModelBuilds;
}

private void setCustomNeuralDocumentModelBuilds(
QuotaDetails customNeuralDocumentModelBuilds) {
this.customNeuralDocumentModelBuilds = customNeuralDocumentModelBuilds;
}

static {
ResourceDetailsHelper.setAccessor(new ResourceDetailsHelper.ResourceDetailsAccessor() {
@Override
Expand All @@ -61,6 +77,12 @@ public void setDocumentModelLimit(
ResourceDetails resourceDetails, int documentModelLimit) {
resourceDetails.setCustomDocumentModelLimit(documentModelLimit);
}

@Override
public void setCustomNeuralDocumentModelBuilds(
ResourceDetails resourceDetails, QuotaDetails quotaDetails) {
resourceDetails.setCustomNeuralDocumentModelBuilds(quotaDetails);
}
});
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private AddressValueHelper() {
*
* @param addressValueAccessor The accessor.
*/
public static void setAccessor(final AddressValueHelper.AddressValueAccessor addressValueAccessor) {
public static void setAccessor(final AddressValueAccessor addressValueAccessor) {
accessor = addressValueAccessor;
}

Expand All @@ -35,6 +35,18 @@ public interface AddressValueAccessor {
void setPostalCode(AddressValue addressValue, String postalCode);
void setCountryRegion(AddressValue addressValue, String countryRegion);
void setStreetAddress(AddressValue addressValue, String streetAddress);

void setUnit(AddressValue addressValue, String unit);

void setCityDistrict(AddressValue addressValue, String cityDistrict);

void setStateDistrict(AddressValue addressValue, String stateDistrict);

void setSuburb(AddressValue addressValue, String suburb);

void setHouse(AddressValue addressValue, String house);

void setLevel(AddressValue addressValue, String level);
}
static void setPoBox(AddressValue addressValue, String poBox) {
accessor.setPoBox(addressValue, poBox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ private CurrencyValueHelper() {
public interface CurrencyValueAccessor {
void setAmount(CurrencyValue currencyValue, double amount);
void setSymbol(CurrencyValue currencyValue, String currencySymbol);

void setCode(CurrencyValue currencyValue, String code);
}

/**
Expand All @@ -38,4 +40,7 @@ static void setAmount(CurrencyValue currencyValue, double amount) {
static void setCurrencySymbol(CurrencyValue currencyValue, String currencySymbol) {
accessor.setSymbol(currencyValue, currencySymbol);
}
static void setCode(CurrencyValue currencyValue, String code) {
accessor.setCode(currencyValue, code);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private DocumentKeyValuePairHelper() {
* @param documentKeyValueElementAccessor The accessor.
*/
public static void setAccessor(
final DocumentKeyValuePairHelper.DocumentKeyValuePairAccessor documentKeyValueElementAccessor) {
final DocumentKeyValuePairAccessor documentKeyValueElementAccessor) {
accessor = documentKeyValueElementAccessor;
}

Expand All @@ -37,6 +37,8 @@ public interface DocumentKeyValuePairAccessor {
void setKey(DocumentKeyValuePair documentKeyValuePair, DocumentKeyValueElement key);
void setValue(DocumentKeyValuePair documentKeyValuePair, DocumentKeyValueElement value);
void setConfidence(DocumentKeyValuePair documentKeyValuePair, float confidence);

void setCommonName(DocumentKeyValuePair documentKeyValuePair, String commonName);
}

static void setConfidence(DocumentKeyValuePair documentKeyValuePair, float confidence) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public interface DocumentModelDetailsAccessor {
void setDocTypes(DocumentModelDetails documentModelDetails, Map<String, DocumentTypeDetails> docTypes);

void setTags(DocumentModelDetails documentModelDetails, Map<String, String> tags);

void setExpiresOn(DocumentModelDetails documentModelDetails, OffsetDateTime expiresOn);
}

/**
Expand Down Expand Up @@ -62,4 +64,8 @@ static void setDocTypes(DocumentModelDetails documentModelDetails, Map<String, D
static void setTags(DocumentModelDetails documentModelDetails, Map<String, String> tags) {
accessor.setTags(documentModelDetails, tags);
}

static void setExpiresOn(DocumentModelDetails documentModelDetails, OffsetDateTime expirationDateTime) {
accessor.setExpiresOn(documentModelDetails, expirationDateTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public interface DocumentModelSummaryAccessor {
void setDescription(DocumentModelSummary documentModelSummary, String description);
void setCreatedOn(DocumentModelSummary documentModelSummary, OffsetDateTime createdDateTime);
void setTags(DocumentModelSummary documentModelSummary, Map<String, String> tags);

void setExpiresOn(DocumentModelSummary documentModelSummary, OffsetDateTime expiresOn);
}

/**
Expand All @@ -51,4 +53,8 @@ static void setCreatedOn(DocumentModelSummary documentModelSummary, OffsetDateTi
static void setTags(DocumentModelSummary documentModelSummary, Map<String, String> tags) {
accessor.setTags(documentModelSummary, tags);
}

static void setExpiresOn(DocumentModelSummary documentModelSummary, OffsetDateTime expirationDateTime) {
accessor.setExpiresOn(documentModelSummary, expirationDateTime);
}
}
Loading