com.pixelmed.apps

## Class DoseReporterWithLegacyOCRAndAutoSendToRegistry

- java.lang.Object
- - com.pixelmed.apps.DoseReporterWithLegacyOCRAndAutoSendToRegistry

-     public class DoseReporterWithLegacyOCRAndAutoSendToRegistry
      extends java.lang.Object

  A class to wait for incoming dose screen images and SRs and send them to pre-configured registry.

  The class has no public methods other than the constructor and a main method that is useful as a utility.

  External (unsecure) SQL access to the database is possible if the Application.DatabaseServerName property is specified; further details are described in `com.pixelmed.database.DatabaseInformationModel`; for example:

      % java -cp lib/additional/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --url "jdbc:hsqldb:hsql://localhost/testserverdb"

  For how to configure the necessary properties file, see:

  See Also:
    `NetworkApplicationProperties`, `DatabaseApplicationProperties`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile`
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.OurPatientStudySeriesInstanceModel`
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.OurReceivedObjectHandler`
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.ReceivedFileProcessor`
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.WatchDatabaseAndSendToRegistry`
    `protected class` | `DoseReporterWithLegacyOCRAndAutoSendToRegistry.WatchRemoteAEsForNewDoseInformation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `applicationDebugLevel`
    `protected java.lang.String` | `buildDate`
    `protected DatabaseInformationModel` | `databaseInformationModel`
    `protected static int` | `daysBackwardsFromTodayToQuery`
    `protected java.lang.String` | `defaultDaysBackwardsFromTodayToQuery`
    `protected java.lang.String` | `defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy`
    `protected static java.lang.String` | `defaultPropertiesFileName`
    `protected java.lang.String` | `defaultRetainDeidentifiedFiles`
    `protected java.lang.String` | `defaultRetainGeneratedRDSRFiles`
    `protected java.lang.String` | `defaultRetainSourceFilesUsedForSRGeneration`
    `protected java.lang.String` | `defaultSleepTimeBetweenPassesToProcessReceivedFiles`
    `protected java.lang.String` | `defaultSleepTimeBetweenPassesToQueryRemoteAEs`
    `protected int` | `ftpClientDebugLevel`
    `protected java.lang.String` | `imageTypeColumnName`
    `protected java.lang.String` | `instanceCreatorUIDColumnName`
    `protected java.lang.String` | `instanceHasBeenSentToRegistryColumnName`
    `protected java.lang.String` | `instanceIsExposureDoseSequenceColumnName`
    `protected java.lang.String` | `instanceIsRadiationDoseScreenColumnName`
    `protected java.lang.String` | `instanceIsRadiationDoseSRColumnName`
    `protected java.lang.String` | `instanceLocalFileNameColumnName`
    `protected java.lang.String` | `instanceLocalFileReferenceTypeColumnName`
    `protected java.lang.String` | `instanceLocalParentReferenceColumnName`
    `protected java.lang.String` | `instanceLocalPrimaryKeyColumnName`
    `protected static int` | `intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy`
    `protected java.lang.String` | `manufacturerColumnName`
    `protected static long` | `millisecondsPerDay`
    `protected NetworkApplicationInformationFederated` | `networkApplicationInformation`
    `protected NetworkApplicationProperties` | `networkApplicationProperties`
    `protected int` | `ocrDebugLevel`
    `protected java.lang.String` | `ourCalledAETitle`
    `protected java.util.Properties` | `properties`
    `protected static java.lang.String` | `propertyDelimitersForTokenizer_RemoteAEsForQuery`
    `protected static java.lang.String` | `propertyName_ApplicationDebugLevel`
    `protected static java.lang.String` | `propertyName_DaysBackwardsFromTodayToQuery`
    `protected static java.lang.String` | `propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy`
    `protected static java.lang.String` | `propertyName_OCRDebugLevel`
    `protected static java.lang.String` | `propertyName_RemoteAEsForQuery`
    `protected static java.lang.String` | `propertyName_RetainDeidentifiedFiles`
    `protected static java.lang.String` | `propertyName_RetainGeneratedRDSRFiles`
    `protected static java.lang.String` | `propertyName_RetainSourceFilesUsedForSRGeneration`
    `protected static java.lang.String` | `propertyName_SelectedDoseRegistry`
    `protected static java.lang.String` | `propertyName_SleepTimeBetweenPassesToProcessReceivedFiles`
    `protected static java.lang.String` | `propertyName_SleepTimeBetweenPassesToQueryRemoteAEs`
    `protected java.util.List<java.lang.String>` | `remoteAEsForQuery`
    `protected FTPRemoteHost` | `remoteHost`
    `protected boolean` | `retainDeidentifiedFiles`
    `protected boolean` | `retainGeneratedRDSRFiles`
    `protected boolean` | `retainSourceFilesUsedForSRGeneration`
    `protected java.io.File` | `savedImagesFolder`
    `protected static int` | `sleepTimeBetweenPassesToProcessReceivedFiles`
    `protected static int` | `sleepTimeBetweenPassesToQueryRemoteAEs`
    `protected java.lang.String` | `sopClassUIDColumnName`
    `protected java.lang.String` | `sourceApplicationEntityTitleColumnName`
    `protected StoredFilePathStrategy` | `storedFilePathStrategy`
    `protected java.lang.String` | `studyHasBeenProcessedColumnName`
    `protected java.lang.String` | `studyInstanceUIDColumnName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DoseReporterWithLegacyOCRAndAutoSendToRegistry(java.lang.String propertiesFileName)` Wait for incoming dose screen images and SRs and send to registry.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `alreadyHaveIt(AttributeList uniqueKeys)`
    `protected java.lang.String` | `deidentifyFile(java.lang.String dicomFileName)`
    `protected void` | `deleteFilesAndDatabaseRecords(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfFiles)`
    `protected void` | `deleteFilesAndSetDatabaseRecordsToReferenced(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfFiles)`

    `protected long`

    `findCandidateFilesToSendToRegistry(InformationEntity ie, java.lang.String localPrimaryKeyValue, java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfOriginalSRFiles, java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfLegacyOCRSRFiles, java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfDoseScreenFiles, long mostRecentInsertionTime)`

    `protected boolean` | `findSuitableSRFilesAndSendThemToRegistry(java.lang.String studyLocalPrimaryKeyValue)`
    `protected java.lang.String` | `getBuildDate()` Get the date the package was built.
    `protected void` | `loadProperties(java.lang.String propertiesFileName)` Load properties.
    `static void` | `main(java.lang.String[] arg)` Wait for incoming dose screen images and SRs and send to registry.
    `protected void` | `makeSRFileAndSendFileToRegistry(CTDose ctDose)`
    `protected void` | `sendFilesToRegistry(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfSRFiles)`
    `protected void` | `sendFileToRegistry(DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile candidateFile)`
    `protected void` | `sendFileToRegistry(java.lang.String fileName)`
    `protected void` | `setSelectedDatabaseRecordHasBeenSentToRegistry(java.lang.String filename)`
    `protected void` | `setSelectedDatabaseRecordIsExposureDoseSequence(java.lang.String filename)`
    `protected void` | `setSelectedDatabaseRecordIsRadiationDoseScreen(java.lang.String filename)`
    `protected void` | `setSelectedDatabaseRecordIsRadiationDoseSR(java.lang.String filename)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### defaultPropertiesFileName

          protected static java.lang.String defaultPropertiesFileName

    - #### propertyName_SelectedDoseRegistry

          protected static java.lang.String propertyName_SelectedDoseRegistry

    - #### propertyName_SleepTimeBetweenPassesToProcessReceivedFiles

          protected static java.lang.String propertyName_SleepTimeBetweenPassesToProcessReceivedFiles

    - #### propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected static java.lang.String propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### propertyName_SleepTimeBetweenPassesToQueryRemoteAEs

          protected static java.lang.String propertyName_SleepTimeBetweenPassesToQueryRemoteAEs

    - #### propertyName_DaysBackwardsFromTodayToQuery

          protected static java.lang.String propertyName_DaysBackwardsFromTodayToQuery

    - #### propertyName_RetainSourceFilesUsedForSRGeneration

          protected static java.lang.String propertyName_RetainSourceFilesUsedForSRGeneration

    - #### propertyName_RetainGeneratedRDSRFiles

          protected static java.lang.String propertyName_RetainGeneratedRDSRFiles

    - #### propertyName_RetainDeidentifiedFiles

          protected static java.lang.String propertyName_RetainDeidentifiedFiles

    - #### propertyName_RemoteAEsForQuery

          protected static java.lang.String propertyName_RemoteAEsForQuery

    - #### propertyName_ApplicationDebugLevel

          protected static java.lang.String propertyName_ApplicationDebugLevel

    - #### propertyName_OCRDebugLevel

          protected static java.lang.String propertyName_OCRDebugLevel

    - #### propertyDelimitersForTokenizer_RemoteAEsForQuery

          protected static java.lang.String propertyDelimitersForTokenizer_RemoteAEsForQuery

    - #### retainDeidentifiedFiles

          protected boolean retainDeidentifiedFiles

    - #### retainGeneratedRDSRFiles

          protected boolean retainGeneratedRDSRFiles

    - #### retainSourceFilesUsedForSRGeneration

          protected boolean retainSourceFilesUsedForSRGeneration

    - #### defaultRetainDeidentifiedFiles

          protected java.lang.String defaultRetainDeidentifiedFiles

    - #### defaultRetainGeneratedRDSRFiles

          protected java.lang.String defaultRetainGeneratedRDSRFiles

    - #### defaultRetainSourceFilesUsedForSRGeneration

          protected java.lang.String defaultRetainSourceFilesUsedForSRGeneration

    - #### defaultSleepTimeBetweenPassesToProcessReceivedFiles

          protected java.lang.String defaultSleepTimeBetweenPassesToProcessReceivedFiles

    - #### defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected java.lang.String defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### defaultSleepTimeBetweenPassesToQueryRemoteAEs

          protected java.lang.String defaultSleepTimeBetweenPassesToQueryRemoteAEs

    - #### defaultDaysBackwardsFromTodayToQuery

          protected java.lang.String defaultDaysBackwardsFromTodayToQuery

    - #### sleepTimeBetweenPassesToProcessReceivedFiles

          protected static int sleepTimeBetweenPassesToProcessReceivedFiles

    - #### intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

          protected static int intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy

    - #### sleepTimeBetweenPassesToQueryRemoteAEs

          protected static int sleepTimeBetweenPassesToQueryRemoteAEs

    - #### daysBackwardsFromTodayToQuery

          protected static int daysBackwardsFromTodayToQuery

    - #### millisecondsPerDay

          protected static final long millisecondsPerDay

      See Also:
        Constant Field Values

    - #### properties

          protected java.util.Properties properties

    - #### networkApplicationProperties

          protected NetworkApplicationProperties networkApplicationProperties

    - #### networkApplicationInformation

          protected NetworkApplicationInformationFederated networkApplicationInformation

    - #### ourCalledAETitle

          protected java.lang.String ourCalledAETitle

    - #### remoteAEsForQuery

          protected java.util.List<java.lang.String> remoteAEsForQuery

    - #### databaseInformationModel

          protected DatabaseInformationModel databaseInformationModel

    - #### remoteHost

          protected FTPRemoteHost remoteHost

    - #### ftpClientDebugLevel

          protected int ftpClientDebugLevel

    - #### ocrDebugLevel

          protected int ocrDebugLevel

    - #### applicationDebugLevel

          protected int applicationDebugLevel

    - #### buildDate

          protected java.lang.String buildDate

    - #### savedImagesFolder

          protected java.io.File savedImagesFolder

    - #### storedFilePathStrategy

          protected StoredFilePathStrategy storedFilePathStrategy

    - #### studyHasBeenProcessedColumnName

          protected java.lang.String studyHasBeenProcessedColumnName

    - #### instanceHasBeenSentToRegistryColumnName

          protected java.lang.String instanceHasBeenSentToRegistryColumnName

    - #### instanceIsRadiationDoseSRColumnName

          protected java.lang.String instanceIsRadiationDoseSRColumnName

    - #### instanceIsRadiationDoseScreenColumnName

          protected java.lang.String instanceIsRadiationDoseScreenColumnName

    - #### instanceIsExposureDoseSequenceColumnName

          protected java.lang.String instanceIsExposureDoseSequenceColumnName

    - #### studyInstanceUIDColumnName

          protected java.lang.String studyInstanceUIDColumnName

    - #### sopClassUIDColumnName

          protected java.lang.String sopClassUIDColumnName

    - #### manufacturerColumnName

          protected java.lang.String manufacturerColumnName

    - #### imageTypeColumnName

          protected java.lang.String imageTypeColumnName

    - #### instanceCreatorUIDColumnName

          protected java.lang.String instanceCreatorUIDColumnName

    - #### sourceApplicationEntityTitleColumnName

          protected java.lang.String sourceApplicationEntityTitleColumnName

    - #### instanceLocalParentReferenceColumnName

          protected java.lang.String instanceLocalParentReferenceColumnName

    - #### instanceLocalFileNameColumnName

          protected java.lang.String instanceLocalFileNameColumnName

    - #### instanceLocalFileReferenceTypeColumnName

          protected java.lang.String instanceLocalFileReferenceTypeColumnName

    - #### instanceLocalPrimaryKeyColumnName

          protected java.lang.String instanceLocalPrimaryKeyColumnName

  - ### Constructor Detail

    - #### DoseReporterWithLegacyOCRAndAutoSendToRegistry

          public DoseReporterWithLegacyOCRAndAutoSendToRegistry(java.lang.String propertiesFileName)
                                                         throws DicomException,
                                                                DicomNetworkException,
                                                                java.io.IOException,
                                                                java.lang.InterruptedException,
                                                                FTPException

      Wait for incoming dose screen images and SRs and send to registry.

      Parameters:
        `propertiesFileName` -
      Throws:
        `DicomException`
        `DicomNetworkException`
        `java.io.IOException`
        `java.lang.InterruptedException`
        `FTPException`

  - ### Method Detail

    - #### getBuildDate

          protected java.lang.String getBuildDate()

      Get the date the package was built.

      Returns:
        the build date

    - #### loadProperties

          protected void loadProperties(java.lang.String propertiesFileName)
                                 throws java.io.IOException

      Load properties.

      Throws:
        `java.io.IOException` - thrown if properties file is missing

    - #### deidentifyFile

          protected java.lang.String deidentifyFile(java.lang.String dicomFileName)
                                             throws DicomException,
                                                    java.io.IOException

      Throws:
        `DicomException`
        `java.io.IOException`

    - #### sendFileToRegistry

          protected void sendFileToRegistry(java.lang.String fileName)
                                     throws DicomException,
                                            java.io.IOException,
                                            java.security.NoSuchAlgorithmException,
                                            java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.security.NoSuchAlgorithmException`
        `java.lang.Exception`

    - #### sendFileToRegistry

          protected void sendFileToRegistry(DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile candidateFile)
                                     throws DicomException,
                                            java.io.IOException,
                                            java.security.NoSuchAlgorithmException,
                                            java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.security.NoSuchAlgorithmException`
        `java.lang.Exception`

    - #### sendFilesToRegistry

          protected void sendFilesToRegistry(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfSRFiles)
                                      throws DicomException,
                                             java.io.IOException,
                                             java.security.NoSuchAlgorithmException,
                                             java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.security.NoSuchAlgorithmException`
        `java.lang.Exception`

    - #### makeSRFileAndSendFileToRegistry

          protected void makeSRFileAndSendFileToRegistry(CTDose ctDose)

    - #### deleteFilesAndDatabaseRecords

          protected void deleteFilesAndDatabaseRecords(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfFiles)
                                                throws DicomException,
                                                       java.io.IOException

      Throws:
        `DicomException`
        `java.io.IOException`

    - #### deleteFilesAndSetDatabaseRecordsToReferenced

          protected void deleteFilesAndSetDatabaseRecordsToReferenced(java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfFiles)
                                                               throws DicomException,
                                                                      java.io.IOException

      Throws:
        `DicomException`
        `java.io.IOException`

    - #### findCandidateFilesToSendToRegistry

          protected long findCandidateFilesToSendToRegistry(InformationEntity ie,
                                                            java.lang.String localPrimaryKeyValue,
                                                            java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfOriginalSRFiles,
                                                            java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfLegacyOCRSRFiles,
                                                            java.util.Set<DoseReporterWithLegacyOCRAndAutoSendToRegistry.CandidateFile> setOfDoseScreenFiles,
                                                            long mostRecentInsertionTime)
                                                     throws DicomException

      Throws:
        `DicomException`

    - #### findSuitableSRFilesAndSendThemToRegistry

          protected boolean findSuitableSRFilesAndSendThemToRegistry(java.lang.String studyLocalPrimaryKeyValue)
                                                              throws DicomException,
                                                                     java.io.IOException,
                                                                     java.security.NoSuchAlgorithmException,
                                                                     java.lang.Exception

      Throws:
        `DicomException`
        `java.io.IOException`
        `java.security.NoSuchAlgorithmException`
        `java.lang.Exception`

    - #### setSelectedDatabaseRecordIsRadiationDoseSR

          protected void setSelectedDatabaseRecordIsRadiationDoseSR(java.lang.String filename)
                                                             throws DicomException

      Throws:
        `DicomException`

    - #### setSelectedDatabaseRecordIsRadiationDoseScreen

          protected void setSelectedDatabaseRecordIsRadiationDoseScreen(java.lang.String filename)
                                                                 throws DicomException

      Throws:
        `DicomException`

    - #### setSelectedDatabaseRecordIsExposureDoseSequence

          protected void setSelectedDatabaseRecordIsExposureDoseSequence(java.lang.String filename)
                                                                  throws DicomException

      Throws:
        `DicomException`

    - #### setSelectedDatabaseRecordHasBeenSentToRegistry

          protected void setSelectedDatabaseRecordHasBeenSentToRegistry(java.lang.String filename)
                                                                 throws DicomException

      Throws:
        `DicomException`

    - #### alreadyHaveIt

          protected boolean alreadyHaveIt(AttributeList uniqueKeys)
                                   throws DicomException

      Throws:
        `DicomException`

    - #### main

          public static void main(java.lang.String[] arg)

      Wait for incoming dose screen images and SRs and send to registry.

      Parameters:
        `arg` - none