Changes between Initial Version and Version 1 of Ticket #1029, comment 5


Ignore:
Timestamp:
Mar 19, 2018, 9:31:53 AM (6 years ago)
Author:
olle

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1029, comment 5

    initial v1  
    11Design discussion:
    22
    3 (To be added later)
     3 * First version of SCAN-B-rec referral form generation will be based on the corresponding functionality for Reggie and the SCAN-B project. Some functionality may have to be adapted for the former project, but changes will be easier to describe in comparison with corresponding functionality for the SCAN-B project. Therefore the initial revision will be closely similar to the code base for the latter:[[BR]]a. A new sub-section "Referral forms" with entry "Generate referral forms" will be added to section "Personal information wizards", and will require a `PatientCurator` role to be used.[[BR]]b. Step 1 of the SCAN-B referral form generation wizard will have two menus, one for the SCAN-B site, and one for selecting the form variant to generate forms for (initially two choices, "Kit 1 - Standard" and "Kit 2 - Neoadjuvant therapy").[[BR]]c. Step 2 should contain two input fields, one for the first SCAN-B ID for the form set batch to be created, and the number of form sets in the batch. One button should be shown, "Generate referral forms".[[BR]]d. Step 3 should present three buttons, "Download form batch file 1", "Download form batch file 2", and "Update used SCAN-B ID list". As expected, clicking the first or second button should allow the corresponding form batch PDF file to be downloaded to the local system, while clicking on the third button will update the stored list of used SCAN-B ID to prevent the same set of referral form sets to be created again for the same site, provided that the default start SCAN-B ID has not been modified by the user and that the list has been updated after each created form set batch.
     4
     5Design update:
     6
     7 1. JSP file `index.jsp` in `resources/` updated in section "Personal information wizards" with new sub-section "Referral forms" with entry "Generate referral forms". The entry for generating referral forms is linked to new JSP file `generate-referral-forms.jsp` in `resources/personal/`, and requires a `PatientCurator` role to be used.
     8 2. New JSP file `generate-referral-forms.jsp` in `resources/personal/` added. It is linked to new javascript file `generate-referral-forms.js` in `resources/personal/`.
     9 3. New javascript file `generate-referral-forms.js` in `resources/personal/` added.[[BR]]a. Function `initPage()` calls `ScanBQuarterMonthReportServlet` with command "`GetSites`" to obtain entries for the site menu, created by callback function `sitesLoaded(response)`.[[BR]]b. Function `initializeStep2(response)` calls `ReferralGeneratorServlet` with command "`GetReferralStartInfo`" to obtain the SCAN-B ID for the first form set for the selected site. The default number of form sets in the batch to be created is chosen depending on the selected form set variant (50 for Kit 1, 25 for Kit 2).[[BR]]c. Clicking on button "`Generate referral forms`" activates function `generateReferralForms()`, that calls `ReferralGeneratorServlet` with command "`GenerateReferralForms`" and callback function `initializeStep3(response)`.[[BR]]d. Function `initializeStep3(response)` activates buttons for downloading created form batch files and updating used SCAN-B ID list.[[BR]]e. Function `downloadFormBatch(batchType)` calls `ReferralGeneratorServlet` with command "`DownloadFormBatchFile`" to download the corresponding form batch file to the local system.[[BR]]f. Function `updateUsedScanbIdList()` calls `ReferralGeneratorServlet` with command "`UpdateUsedScanbIdList`" to updated the used SCAN-B ID list.
     10 4. New java servlet class/file `ReferralGeneratorServlet.java` in `src/net/sf/basedb/meludi/servlet/` added.[[BR]]a. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` supports command "`GetReferralStartInfo`", that calls private method `JSONObject fetchReferralstartInfo()` to obtain a JSONObject to return with info on the start SCAN-B ID values for different sites.[[BR]]b. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` supports command "`UpdateUsedScanbIdList`", that retrieves the used start SCAN-B ID and the number of form sets generated, after which the used SCAN-B ID list file is updated for the current site with the value returned by private method `String nextScanbId(String scanbId, Integer incr)`.[[BR]]c. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` supports command "`GenerateReferralForms`", that calls a number of private convenience methods to create the desired referral form batch PDF files, with support from utility class `PdfUtil`.[[BR]]d. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` supports command "`DownloadFormBatchFile`", which retrieves a path to the desired form batch PDF file by calling private method `String fetchReferralFormBatchFilePath(int batchType)`, after which it sends the file contents to an output stream, for download by the user.[[BR]]e. Private method `String fetchReferralStartInfoFilePath()` returns a path to the referral start info file.[[BR]]f. Private method `JSONObject fetchReferralstartInfo()` returns a JSONObject with info on the start SCAN-B ID values for different sites.[[BR]]g. Private method `String fetchReferralFormBatchFilePath(int batchType)` returns a path to the desired form batch PDF file.[[BR]]h. Private method `tring fetchReferralFormBatchFileName(int batchType, String startScanbId, String endScanbId)` returns name to be used for the referral form batch file.[[BR]]i. Private method `String fetchReferralFormTemplateFilePath(String formTemplateName)` returns path to be used for referral form template file.[[BR]]j. Private method `String fetchReferralFormTemplateFilename(String formTemplateName)` returns name of referral form template file, obtained from MeLuDI configuration file.[[BR]]k. Private method `String fetchReferralFormTemplateFileDirPath()` returns directory path for referral form template files, obtained from MeLuDI configuration file.[[BR]]l. Private method `String nextScanbId(String scanbId, Integer incr)` returns the next SCAN-B ID for a site (same prefix) after a desired incrementation. Any optional suffix is retained.[[BR]]m. Private method `PdfUtil createPatientInfoForm(PdfUtil pdfUtil, String scanbId)` creates PDF contents for a patient info form.[[BR]]n. Private method `PdfUtil createConsentReportForm(PdfUtil pdfUtil, String scanbId)` creates PDF contents for a consent report form.[[BR]]o. Private method `PdfUtil createClinChemForm(PdfUtil pdfUtil, String scanbId, String pdfTemplatePath)` creates PDF contents for a clinical chemistry form using the desired template (standard or biopsy).[[BR]]p. Private method `PdfUtil createClinPathologyForm(PdfUtil pdfUtil, String scanbId, String pdfTemplatePath)` creates PDF contents for a clinical pathology form using the desired template (standard or biopsy).[[BR]]q. Private method `byte[] createBarcode(String barcodeText, String barcodeType, Integer dpi, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize)` returns a byte array of a barcode image corresponding to desired contents. Java library `Barcode4J` is used to generate the barcode.[[BR]]r. Private static method `Configuration buildBarcodeCfg(String type, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize)` configures the `Barcode4J` barcode generator.
     11 5. XML configuration file servlets.xml in `META-INF` updated by adding new java servlet class `ReferralGeneratorServlet` to the servlet list.
     12 6. New utility library `PdfUtil.java` in `src/net/sf/basedb/meludi/pdf/` added.
     13 7. New data access object `ClientApp.java` in `src/net/sf/basedb/meludi/dao/` added.
     14 8. New iText library `itextpdf-5.5.3.jar` with license file `itext-license.txt` in `meludi/META-INF/lib/` added.
     15 9. Outermost Ant build file `build.xml` in `/` updated by adding file set `META-INF/lib` to class path for compiling.
     16 10. Properties file `build.properties` in `/` updated by adding dependency on JAR files in  `base/www/WEB-INF/lib/`.
     17 11. Java classpath file `.classpath` in `/` updated by adding `META-INF/lib/itextpdf-5.5.3.jar`.
     18 12. `Meludi.java` in `src/net/sf/basedb/meludi/` updated:[[BR]]a. New private static  method `String fetchProjectName(int activeProjectId)` added.[[BR]]b. New public static  method `String fetchReferralFormTemplatesDir(int activeProjectId)` added.[[BR]]c. New public static  method `String fetchReferralFormTemplatesOldDir(int activeProjectId)` added.[[BR]]d. New public static  method `String fetchSecondaryAnalysisDir(int activeProjectId)` added.