Skip to content

JCasBuilder

Sean Finan edited this page Feb 9, 2026 · 1 revision

final public class JCasBuilder

Populate a JCas with creator, patient and document information. This follows the Builder pattern, but can be used to modify an existing cas as well as create one.

  • Author: SPF , chip-nlp
  • Version: %I%
  • Since: 9/22/2019

public JCasBuilder overwrite()

Overwrite any information already in a JCas.

  • Returns: this builder.

public JCasBuilder setInstitutionId( final String institutionId )

  • Parameters:
    • institutionId Identity of the institution. e.g. hospital, health system, insurance company, study, etc.
  • Returns: this builder

public JCasBuilder setAuthorSpecialty( final String authorSpecialty )

  • Parameters:
    • authorSpecialty The medical (or professional) specialty of a document's author.
  • Returns: this builder

public JCasBuilder setPatientId( final String patientId )

  • Parameters:
    • patientId The unique ID of a patient at an institution, in a study, in an insurance database, etc.
  • Returns: this builder

public JCasBuilder setPatientNum( final long patientNum )

  • Parameters:
    • patientNum Depends upon user. e.g. Index of a patient in the run, index/number of the patient in a database, etc.
  • Returns: this builder

public JCasBuilder setFirstName( final String firstName )

  • Parameters:
    • firstName Patient's first name.
  • Returns: this builder

public JCasBuilder setMiddleName( final String middleName )

  • Parameters:
    • middleName Patient's middle name.
  • Returns: this builder

public JCasBuilder setLastName( final String lastName )

  • Parameters:
    • lastName Patient's last name.
  • Returns: this builder

public JCasBuilder setBirthDay( final String birthday )

  • Parameters:
    • birthday Patient's date of birth. Format of this date is not controlled.
  • Returns: this builder

public JCasBuilder setDeathday( final String deathday )

  • Parameters:
    • deathday Patient's date of death. Format of this date is not controlled.
  • Returns: this builder

public JCasBuilder setGender( final String gender )

  • Parameters:
    • gender Patient's date of gender. Format of this value is not controlled.
  • Returns: this builder

public JCasBuilder setInstanceId( final String instanceId )

  • Parameters:
    • instanceId This is pretty nebulous, and can be used for anything.
  • Returns: this builder

public JCasBuilder setEncounterId( final String encounterId )

  • Parameters:
    • encounterId Can be the same or different from a document ID, or empty.
  • Returns: this builder

public JCasBuilder setDocId( final String docId )

  • Parameters:
    • docId Document ID. Depending upon requirements of the run, this may need to be unique.
  • Returns: this builder

public JCasBuilder setDocIdPrefix( final String docIdPrefix )

  • Parameters:
    • docIdPrefix Can be anything identifying a collection of documents. Patient ID, Document Type, etc.
  • Returns: this builder

public JCasBuilder setDocType( final String docType )

  • Parameters:
    • docType the type of document, for instance imaging note or pathology report.
  • Returns: this builder

public JCasBuilder setDocSubType( final String docSubType )

  • Parameters:
    • docSubType a subtype. e.g. type = pathology report, subtype = biopsy analysis.
  • Returns: this builder

public JCasBuilder setDocStandard( final String docStandard )

  • Parameters:
    • docStandard -
  • Returns: this builder

public JCasBuilder setDocRevisionNum( final int docRevisionNum )

  • Parameters:
    • docRevisionNum for a document that may have had several iterations of editing.
  • Returns: this builder

public JCasBuilder setDocTime( final String docTime )

  • Parameters:
    • docTime time of document. Nebulous. First write? Sign off? Also, time format is not specified.
  • Returns: this builder

public JCasBuilder setDocPath( final String docPath )

  • Parameters:
    • docPath path to the file containing the doc, a database cell containing the doc, net location, etc.
  • Returns: this builder

public JCasBuilder nullDocText()

Use if the document text should be null.

  • Returns: this builder

public JCasBuilder setDocText( final String docText )

  • Parameters:
    • docText text contents of the document.
  • Returns: this builder

public JCas build() throws UIMAException

  • Returns: a jcas created from scratch and populated with data added in this builder.
  • Exceptions:
    • UIMAException is the fresh jcas cannot be created.

public JCas rebuild( final JCas jCas )

  • Parameters:
    • jCas ye olde ...
  • Returns: a jcas that has been reset (emptied of previous information) and populated with data added in this builder.

private boolean ifWrite( final String value, final String defaultValue )

  • Parameters:
    • value set by user or null
    • defaultValue -
  • Returns: true if the value is not null, and is not the default value or overwrite is true.

private boolean ifWrite( final int value, final int defaultValue )

  • Parameters:
    • value set by user or null
    • defaultValue -
  • Returns: true if the value is not the default value or overwrite is true.

private boolean ifWrite( final long value, final long defaultValue )

  • Parameters:
    • value set by user or null
    • defaultValue -
  • Returns: true if the value is not the default value or overwrite is true.

public JCas populate( final JCas jCas )

  • Parameters:
    • jCas ye olde ...
  • Returns: the given jcas populated with the data added in this builder.

Apache cTAKES

ctakes-core API

Python API

ctakes-core

patient
    AbstractPatientConsumer
    AbstractPatientFileWriter
    PatientNoteCollector
    PatientNoteStore
    PatientViewUtil
pipeline
    PipeBitLocator
    PipelineBuilder
    PiperFileReader
    PiperFileRunner
resource
    FileLocator
util
    CalendarUtil
    MutableUimaContext
    NumberedSuffixComparator
    Pair
    RelationArgumentUtil
    StringUtil
     annotation
         ConceptBuilder
         EssentialAnnotationUtil
         IdentifiedAnnotationBuilder
         IdentifiedAnnotationUtil
         OntologyConceptUtil
         SemanticGroup
         SemanticTui
     doc
         DocIdUtil
         JCasBuilder
         TextBySectionBuilder
         TextBySentenceBuilder
     log
         DotLogger
         FinishedLogger
     regex
         RegexSpanFinder
         TimeoutMatcher
     textspan
         DefaultAspanComparator
         DefaultTextSpanComparator
         DefaultTextSpan
         TextSpan



General

Clone this wiki locally