Opened 8 years ago

Closed 8 years ago

#926 closed task (fixed)

SCAN-B referral form generation improvements in Reggie

Reported by: olle Owned by: olle
Priority: major Milestone: Reggie v4.9
Component: net.sf.basedb.reggie Keywords:
Cc:

Description

This ticket covers improvements to the first trial version of SCAN-B referral form generation in Reggie (see Ticket #897, "Generate SCAN-B referral forms in Reggie").

Change History (12)

comment:1 by olle, 8 years ago

Owner: changed from Nicklas Nordborg to olle
Status: newassigned

Ticket accepted.

comment:2 by olle, 8 years ago

Traceability note:

  • SCAN-B referral form generation in Reggie was introduced in Ticket #897 (Generate SCAN-B referral forms in Reggie).

comment:3 by olle, 8 years ago

(In [4261]) Refs #926. SCAN-B referral form generation updated for Clinical Pathology forms to move short bar codes on labels downwards ~1mm, in order to better fit inside the label limits. This update will also affect generation of Middle Needle Biopsy forms, that uses the same method to create the bar codes for the form.

  1. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated in private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList) to move short bar codes on labels downwards ~1mm, in order to better fit inside the label limits.

comment:4 by olle, 8 years ago

(In [4262]) Refs #926. SCAN-B referral form generation updated for Clinical Chemistry forms to have individual adjustment terms in x-directions for bar codes on labels, in order to better fit to label text in the template. This update will also affect generation of Biopsy Clinical Chemistry forms, that uses the same method to create the bar codes for the form.

  1. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated in private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList) to have individual adjustment terms in x-directions for bar codes on labels, in order to better fit to label text in the template.

comment:5 by olle, 8 years ago

Design specification update:

  • The iText PDF package contains methods for creating bar codes (thanks to Nicklas Nordborg for this information and helpful hints regarding its use). Currently bar codes for SCAN-B referral form generation have been generated by the open source java library Barcode4J (http://barcode4j.sourceforge.net/). Using the iText barcode functionality to produce the barcodes for the SCAN-B referral forms would reduce the dependency on third-party software for the PDF file generation to a single package.

Implementation issues:

  1. The java class/file PdfUtil.java in src/net/sf/basedb/reggie/pdf/ is used to import bar code images into the PDF file. However, methods in this library class is used to produce other types of PDF documents than referral forms, e.g. result reports (this was actually the original use). When the class is modified, care must therefore be taken, not to break any functionality used by other Reggie modules.
  2. Tests using iText functionality to produce bar codes, revealed an unexpected difference in the width of the created bar code images compared to those produced by the Barcode4J package, when the same parameters were used (the new bar codes were 22.8% wider). If the new "raw" bar codes were decreased in width, the value for the bar code x-position also had to be adjusted. Values for size and placement of individual bar codes for referral forms are stored in class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/, and these parameters therefore have to be updated.

Design update:

  1. Java utility class/file PdfUtil.java in src/net/sf/basedb/reggie/pdf/ updated:
    a. New private method Image createBarcode(String text, float width, float height) added. It creates a barcode with chosen content, width, and height, and returns an Image object of it. The barcode will be of type Code 128.
    b. New public method void addBarcode(String text, float x, float y, float width, float height, int align) added. It calls new public method void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) with value of rotationDegrees set to 0.
    c. New public method void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) added. It calls new private method Image createBarcode(String text, float width, float height) to create a barcode with the desired content and size, after which new private method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) is called to import the barcode to the document at the chosen position.
    d. Public method void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) updated to call new public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) to import the image created from the input byte array into the document at the chosen position.
    e. New public method void importImage2(Image img, float x, float y, float width, float height, int align) added. It calls new public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) with value of rotationDegrees set to 0.
    f. New public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) added. It uses code previously in public method void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) to import the input image into the document at the chosen position.
  2. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated:
    a. The following private methods were updated by calling new public PdfUtil methods void addBarcode(String text, float x, float y, float width, float height, int align) and void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) to add a barcode to the document, instead of calling private method byte[] createBarcode(String barcodeText) to create a barcode image byte array, and then use that as input in a call to PdfUtil public methods void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align) and void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) to import the barcode into the document at the desired position:
    i. PdfUtil createConsentReportForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    ii. PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    iii. PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    iv. PdfUtil createClinChemBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    v. PdfUtil createClinChemBcBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList).
    Barcode width and position parameters have also been updated to give a result equaling that using the Barcode4J library to create the barcodes.
    b. The following private methods related to creating barcodes with the Barcode4J library were removed:
    i. byte[] createBarcode(String barcodeText),
    ii. byte[] createBarcode(String barcodeText, String barcodeType, Integer dpi, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize),
    iii. static Configuration buildBarcodeCfg(String type, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize).
Last edited 8 years ago by olle (previous) (diff)

comment:6 by olle, 8 years ago

(In [4295]) Refs #926. SCAN-B referral form generation updated to use iText package methods to create bar codes, instead of using open source java library Barcode4J (http://barcode4j.sourceforge.net/). Barcode width and position parameters have been updated to give a result equaling that using the Barcode4J library to create the bar codes.

  1. Java utility class/file PdfUtil.java in src/net/sf/basedb/reggie/pdf/ updated:
    a. New private method Image createBarcode(String text, float width, float height) added. It creates a barcode with chosen content, width, and height, and returns an Image object of it. The barcode will be of type Code 128.
    b. New public method void addBarcode(String text, float x, float y, float width, float height, int align) added. It calls new public method void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) with value of rotationDegrees set to 0.
    c. New public method void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) added. It calls new private method Image createBarcode(String text, float width, float height) to create a barcode with the desired content and size, after which new private method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) is called to import the barcode to the document at the chosen position.
    d. Public method void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) updated to call new public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) to import the image created from the input byte array into the document at the chosen position.
    e. New public method void importImage2(Image img, float x, float y, float width, float height, int align) added. It calls new public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) with value of rotationDegrees set to 0.
    f. New public method void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees) added. It uses code previously in public method void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) to import the input image into the document at the chosen position.
  2. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated:
    a. The following private methods were updated by calling new public PdfUtil methods void addBarcode(String text, float x, float y, float width, float height, int align) and void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees) to add a barcode to the document, instead of calling private method byte[] createBarcode(String barcodeText) to create a barcode image byte array, and then use that as input in a call to PdfUtil public methods void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align) and void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees) to import the barcode into the document at the desired position:
    i. PdfUtil createConsentReportForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    ii. PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    iii. PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    iv. PdfUtil createClinChemBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList),
    v. PdfUtil createClinChemBcBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList).
    Barcode width and position parameters have also been updated to give a result equaling that using the Barcode4J library to create the barcodes.
    b. The following private methods related to creating barcodes with the Barcode4J library were removed:
    i. byte[] createBarcode(String barcodeText),
    ii. byte[] createBarcode(String barcodeText, String barcodeType, Integer dpi, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize),
    iii. static Configuration buildBarcodeCfg(String type, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize).

comment:7 by olle, 8 years ago

Design specification update:

  • Two of the forms for biopsies in the neoadjuvant therapy kit are generated from unique form templates, but by the same methods as for two forms in the standard kit, that have templates with SCAN-B ID text and bar codes in similar places. However, the longer SCAN-B ID for biopsies (a suffix "C" is added) makes the placement of the SCAN-B ID text and bar codes to differ slightly from that in the original referral forms. The two methods should be updated to be able to add corrections in placement, when forms for biopsies are created. Some minor adjustments of bar code placements on labels should also be added for biopsy forms, in order to increase similarity with the original referral forms.

Design update:

  1. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated:
    a. Private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated to use the value of input argument String formTemplateName as argument when calling updated private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList).
    b. Private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated with new argument String formTemplateName. The value of the new argument is used to adjust SCAN-B ID text and bar code placements for biopsy forms. Code has also been refactored to place code for adding related text and bar code near each other.
    c. Private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated to use the value of input argument String formTemplateName as argument when calling updated private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList).
    d. Private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated with new argument String formTemplateName. The value of the new argument is used to adjust SCAN-B ID text and bar code placements for biopsy forms.

comment:8 by olle, 8 years ago

(In [4300]) Refs #926. SCAN-B referral form generation updated to make SCAN-B ID text and bar code placements for biopsy forms more similar to the original referral forms:

  1. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/reggie/servlet/ updated:
    a. Private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated to use the value of input argument String formTemplateName as argument when calling updated private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList).
    b. Private method PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated with new argument String formTemplateName. The value of the new argument is used to adjust SCAN-B ID text and bar code placements for biopsy forms. Code has also been refactored to place code for adding related text and bar code near each other.
    c. Private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated to use the value of input argument String formTemplateName as argument when calling updated private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList).
    d. Private method PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, String formTemplateName, List<String> formTemplateFileList) updated with new argument String formTemplateName. The value of the new argument is used to adjust SCAN-B ID text and bar code placements for biopsy forms.

comment:9 by olle, 8 years ago

Milestone: Reggie v4.xReggie v4.9

Milstone changed to Reggie v4.9.

comment:10 by olle, 8 years ago

(In [4304]) Refs #926. Reggie .classpath file in / updated by removing entries for jar files related to library Barcode4J and its configuration.

comment:11 by olle, 8 years ago

(In [4305]) Refs #926. Java barcode generation library Barcode4J and configuration library Avalon framework removed from libraries used for referral form generation in META-INF/lib/, since the bar codes now are generated by methods in the iText library used to create the PDF file.

  1. File MANIFEST.MF in META-INF/ updated by removing entries for jar files related to library Barcode4J and its configuration.

comment:12 by olle, 8 years ago

Resolution: fixed
Status: assignedclosed

Ticket closed to allow testing of the new modifications of SCAN-B referral form generation.

Note: See TracTickets for help on using tickets.