From 3068dadc6dfba85cd68118465e60ee26b546578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Thu, 8 Oct 2026 11:19:04 +0200 Subject: [PATCH] :coffin: remove dead v1 products --- docs/code_samples/barcode_reader_v1.txt | 41 ------------- docs/code_samples/idcard_fr_v1.txt | 41 ------------- .../v1/cli/CommandLineInterfaceProducts.java | 12 ---- .../barcodereader/BarcodeReaderV1.java | 15 ----- .../BarcodeReaderV1Document.java | 47 --------------- .../MultiReceiptsExtractionTest.java} | 59 ++----------------- .../barcodereader/BarcodeReaderV1Test.java | 52 ---------------- 7 files changed, 4 insertions(+), 263 deletions(-) delete mode 100644 docs/code_samples/barcode_reader_v1.txt delete mode 100644 docs/code_samples/idcard_fr_v1.txt delete mode 100644 src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1.java delete mode 100644 src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Document.java rename src/test/java/com/mindee/{image/ImageExtractorTest.java => v1/fileoperations/MultiReceiptsExtractionTest.java} (63%) delete mode 100644 src/test/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Test.java diff --git a/docs/code_samples/barcode_reader_v1.txt b/docs/code_samples/barcode_reader_v1.txt deleted file mode 100644 index 676358a66..000000000 --- a/docs/code_samples/barcode_reader_v1.txt +++ /dev/null @@ -1,41 +0,0 @@ -import com.mindee.input.LocalInputSource; -import com.mindee.v1.MindeeClient; -import com.mindee.v1.parsing.common.PredictResponse; -import com.mindee.v1.product.barcodereader.BarcodeReaderV1; -import java.io.File; -import java.io.IOException; - -public class SimpleMindeeClientV1 { - - public static void main(String[] args) throws IOException { - String apiKey = "my-api-key"; - String filePath = "/path/to/the/file.ext"; - - // Init a new client - var mindeeClient = new MindeeClient(apiKey); - - // Load a file from disk - var inputSource = new LocalInputSource(filePath); - - // Parse the file - PredictResponse response = mindeeClient.parse( - BarcodeReaderV1.class, - inputSource - ); - - // Print a summary of the response - System.out.println(response.toString()); - - // Print a summary of the predictions -// System.out.println(response.getDocument().toString()); - - // Print the document-level predictions -// System.out.println(response.getDocument().getInference().getPrediction().toString()); - - // Print the page-level predictions -// response.getDocument().getInference().getPages().forEach( -// page -> System.out.println(page.toString()) -// ); - } - -} diff --git a/docs/code_samples/idcard_fr_v1.txt b/docs/code_samples/idcard_fr_v1.txt deleted file mode 100644 index 3ce921ac1..000000000 --- a/docs/code_samples/idcard_fr_v1.txt +++ /dev/null @@ -1,41 +0,0 @@ -import com.mindee.input.LocalInputSource; -import com.mindee.v1.MindeeClient; -import com.mindee.v1.parsing.common.PredictResponse; -import com.mindee.v1.product.fr.idcard.IdCardV1; -import java.io.File; -import java.io.IOException; - -public class SimpleMindeeClientV1 { - - public static void main(String[] args) throws IOException { - String apiKey = "my-api-key"; - String filePath = "/path/to/the/file.ext"; - - // Init a new client - var mindeeClient = new MindeeClient(apiKey); - - // Load a file from disk - var inputSource = new LocalInputSource(filePath); - - // Parse the file - PredictResponse response = mindeeClient.parse( - IdCardV1.class, - inputSource - ); - - // Print a summary of the response - System.out.println(response.toString()); - - // Print a summary of the predictions -// System.out.println(response.getDocument().toString()); - - // Print the document-level predictions -// System.out.println(response.getDocument().getInference().getPrediction().toString()); - - // Print the page-level predictions -// response.getDocument().getInference().getPages().forEach( -// page -> System.out.println(page.toString()) -// ); - } - -} diff --git a/src/main/java/com/mindee/v1/cli/CommandLineInterfaceProducts.java b/src/main/java/com/mindee/v1/cli/CommandLineInterfaceProducts.java index 3275e02f8..f35b3e2c0 100644 --- a/src/main/java/com/mindee/v1/cli/CommandLineInterfaceProducts.java +++ b/src/main/java/com/mindee/v1/cli/CommandLineInterfaceProducts.java @@ -1,6 +1,5 @@ package com.mindee.v1.cli; -import com.mindee.v1.product.barcodereader.BarcodeReaderV1; import com.mindee.v1.product.cropper.CropperV1; import com.mindee.v1.product.driverlicense.DriverLicenseV1; import com.mindee.v1.product.financialdocument.FinancialDocumentV1; @@ -47,17 +46,6 @@ void bankAccountDetailsV2Method( System.out.println(processor.standardProductOutput(BankAccountDetailsV2.class, file)); } - @CommandLine.Command(name = "barcode-reader", description = "Parse using Barcode Reader") - void barcodeReaderV1Method( - @CommandLine.Parameters( - index = "0", - paramLabel = "", - scope = CommandLine.ScopeType.LOCAL - ) File file - ) throws IOException, InterruptedException { - System.out.println(processor.standardProductOutput(BarcodeReaderV1.class, file)); - } - @CommandLine.Command(name = "fr-carte-grise", description = "Parse using FR Carte Grise") void carteGriseV1Method( @CommandLine.Parameters( diff --git a/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1.java b/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1.java deleted file mode 100644 index 9e90aaf86..000000000 --- a/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mindee.v1.product.barcodereader; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.mindee.v1.http.EndpointInfo; -import com.mindee.v1.parsing.common.Inference; -import lombok.Getter; - -/** - * Barcode Reader API version 1 inference prediction. - */ -@Getter -@JsonIgnoreProperties(ignoreUnknown = true) -@EndpointInfo(endpointName = "barcode_reader", version = "1") -public class BarcodeReaderV1 extends Inference { -} diff --git a/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Document.java b/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Document.java deleted file mode 100644 index 25fd306df..000000000 --- a/src/main/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Document.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mindee.v1.product.barcodereader; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.mindee.v1.parsing.SummaryHelperV1; -import com.mindee.v1.parsing.common.Prediction; -import com.mindee.v1.parsing.standard.StringField; -import java.util.ArrayList; -import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -/** - * Barcode Reader API version 1.0 document data. - */ -@Getter -@EqualsAndHashCode(callSuper = false) -@JsonIgnoreProperties(ignoreUnknown = true) -public class BarcodeReaderV1Document extends Prediction { - - /** - * List of decoded 1D barcodes. - */ - @JsonProperty("codes_1d") - protected List codes1D = new ArrayList<>(); - /** - * List of decoded 2D barcodes. - */ - @JsonProperty("codes_2d") - protected List codes2D = new ArrayList<>(); - - @Override - public boolean isEmpty() { - return ((this.codes1D == null || this.codes1D.isEmpty()) - && (this.codes2D == null || this.codes2D.isEmpty())); - } - - @Override - public String toString() { - StringBuilder outStr = new StringBuilder(); - String codes1D = SummaryHelperV1.arrayToString(this.getCodes1D(), "%n "); - outStr.append(String.format(":Barcodes 1D: %s%n", codes1D)); - String codes2D = SummaryHelperV1.arrayToString(this.getCodes2D(), "%n "); - outStr.append(String.format(":Barcodes 2D: %s%n", codes2D)); - return SummaryHelperV1.cleanSummary(outStr.toString()); - } -} diff --git a/src/test/java/com/mindee/image/ImageExtractorTest.java b/src/test/java/com/mindee/v1/fileoperations/MultiReceiptsExtractionTest.java similarity index 63% rename from src/test/java/com/mindee/image/ImageExtractorTest.java rename to src/test/java/com/mindee/v1/fileoperations/MultiReceiptsExtractionTest.java index 809c9b122..f8da43ab8 100644 --- a/src/test/java/com/mindee/image/ImageExtractorTest.java +++ b/src/test/java/com/mindee/v1/fileoperations/MultiReceiptsExtractionTest.java @@ -1,15 +1,15 @@ -package com.mindee.image; +package com.mindee.v1.fileoperations; import static com.mindee.TestingUtilities.getResourcePath; import static com.mindee.TestingUtilities.getV1ResourcePath; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; +import com.mindee.image.ExtractedImage; +import com.mindee.image.ImageExtractor; import com.mindee.input.LocalInputSource; import com.mindee.v1.parsing.common.Page; import com.mindee.v1.parsing.common.PredictResponse; -import com.mindee.v1.product.barcodereader.BarcodeReaderV1; -import com.mindee.v1.product.barcodereader.BarcodeReaderV1Document; import com.mindee.v1.product.multireceiptsdetector.MultiReceiptsDetectorV1; import com.mindee.v1.product.multireceiptsdetector.MultiReceiptsDetectorV1Document; import java.io.IOException; @@ -17,7 +17,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ImageExtractorTest { +public class MultiReceiptsExtractionTest { protected PredictResponse getMultiReceiptsPrediction( String name @@ -36,22 +36,6 @@ protected PredictResponse getMultiReceiptsPrediction( ); } - protected PredictResponse getBarcodeReaderPrediction( - String name - ) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.findAndRegisterModules(); - - JavaType type = objectMapper - .getTypeFactory() - .constructParametricType(PredictResponse.class, BarcodeReaderV1.class); - return objectMapper - .readValue( - getV1ResourcePath("products/barcode_reader/response_v1/" + name + ".json").toFile(), - type - ); - } - @Test public void givenAnImage_shouldExtractPositionFields() throws IOException { LocalInputSource image = new LocalInputSource( @@ -83,41 +67,6 @@ public void givenAnImage_shouldExtractPositionFields() throws IOException { } } - @Test - public void givenAnImage_shouldExtractValueFields() throws IOException { - PredictResponse response = getBarcodeReaderPrediction("complete"); - BarcodeReaderV1 inference = response.getDocument().getInference(); - - ImageExtractor extractor = new ImageExtractor( - new LocalInputSource(getV1ResourcePath("products/barcode_reader/default_sample.jpg")) - ); - Assertions.assertEquals(1, extractor.getPageCount()); - - for (Page page : inference.getPages()) { - List codes1D = extractor - .extractImagesFromPage(page.getPrediction().getCodes1D(), page.getPageId()); - for (int i = 0; i < codes1D.size(); i++) { - ExtractedImage extractedImage = codes1D.get(i); - Assertions.assertNotNull(extractedImage.getImage()); - LocalInputSource source = extractedImage.asInputSource(); - Assertions - .assertEquals( - String - .format("default_sample_page-%3s-item-%3s.jpg", page.getPageId() + 1, i + 1) - .replace(" ", "0"), - source.getFilename() - ); - extractedImage.writeToFile(getResourcePath("output/")); - } - List codes2D = extractor - .extractImagesFromPage(page.getPrediction().getCodes2D(), page.getPageId()); - for (ExtractedImage extractedImage : codes2D) { - Assertions.assertNotNull(extractedImage.getImage()); - extractedImage.writeToFile(getResourcePath("output/")); - } - } - } - @Test public void givenAPdf_shouldExtractPositionFields() throws IOException { LocalInputSource image = new LocalInputSource( diff --git a/src/test/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Test.java b/src/test/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Test.java deleted file mode 100644 index d92f10193..000000000 --- a/src/test/java/com/mindee/v1/product/barcodereader/BarcodeReaderV1Test.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.mindee.v1.product.barcodereader; - -import static com.mindee.TestingUtilities.assertStringEqualsFile; -import static com.mindee.TestingUtilities.getV1ResourcePathString; - -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.mindee.v1.parsing.common.Document; -import com.mindee.v1.parsing.common.PredictResponse; -import java.io.File; -import java.io.IOException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -/** - * Unit tests for BarcodeReaderV1. - */ -public class BarcodeReaderV1Test { - - protected PredictResponse getPrediction(String name) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.findAndRegisterModules(); - - JavaType type = objectMapper - .getTypeFactory() - .constructParametricType(PredictResponse.class, BarcodeReaderV1.class); - return objectMapper - .readValue( - new File(getV1ResourcePathString("products/barcode_reader/response_v1/" + name + ".json")), - type - ); - } - - @Test - void whenEmptyDeserialized_mustHaveValidProperties() throws IOException { - PredictResponse response = getPrediction("empty"); - BarcodeReaderV1Document docPrediction = response.getDocument().getInference().getPrediction(); - Assertions.assertTrue(docPrediction.getCodes1D().isEmpty()); - Assertions.assertTrue(docPrediction.getCodes2D().isEmpty()); - } - - @Test - void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException { - PredictResponse response = getPrediction("complete"); - Document doc = response.getDocument(); - assertStringEqualsFile( - doc.toString(), - getV1ResourcePathString("products/barcode_reader/response_v1/summary_full.rst") - ); - } - -}