Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public CodeDatabaseAPI(Connection conn) {
/** The jurisdiction (e.g illinois) that this database is working over */
public abstract Jurisdiction getJurisdiction();

/**
* Maps the name of an ECF element to be substituted by a court-specific code list or extension.
*/
public abstract Map<String, String> xmlElemToTableName();

/**
* Gets all court location identifiers (CLI) stored in the database.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,66 @@ public CodeDatabase(Jurisdiction jurisdiction, Connection conn) {
this.jurisdiction = jurisdiction;
}

// TODO(brycew-later): there's little more info on these mappings and how they combine.
// Is this actually an XPath? Should figure it out
private static final Map<String, String> ecf4Map =
Map.ofEntries(
Map.entry("cext:BondTypeText", "bond"),
Map.entry("cext:Charge/cext:ChargeStatute/j:StatuteLevelText", "degree"),
Map.entry("cext:Charge\\cext:ChargePhaseText", "chargephase"),
Map.entry("cext:GeneralOffenseText", "generaloffense"),
Map.entry("cext:StatuteTypeText", "statutetype"),
Map.entry(
"cext:Charge/cext:ChargeStatute/j:StatuteCodeIdentification/nc:IdentificationID",
"statute"),
Map.entry("ecf:CaseParticipantRoleCode", "partytype"),
Map.entry("ecf:FilingStatusCode", "filingstatus"),
Map.entry("ecf:ServiceRecipientID/nc:IdentificationSourceText", "servicetype"),
Map.entry(
"ecf:PersonDriverLicense/nc:DriverLicenseIdentification/nc:IdentificationCategoryText",
"driverlicensetype"),
Map.entry("j:/ArrestCharge/j:ArrestLocation/nc:LocationName", "arrestlocation"),
Map.entry("j:RegisterActionDescriptionText", "filing"),
Map.entry(
"j:ArrestOfficial/j:EnforcementOfficialUnit/nc:OrganizationIdentification/nc:IdentificationID",
"lawenforcementunit"),
Map.entry(
"j:Citation\\nc:ActivityIdentification\\tyler:JurisdictionCode",
"citationjurisdiction"),
Map.entry("nc:CaseCategoryText", "casecategory"),
Map.entry("nc:LocationCountryName", "country"),
Map.entry("nc:BinaryFormatStandardName", "documenttype"),
Map.entry("nc:BinaryCategoryText", "filingcomponent"),
Map.entry("nc:LocationStateName", "state"),
Map.entry("nc:PersonNameSuffixText", "namesuffix"),
Map.entry("nc:BinaryLocationURI", "filetype"),
Map.entry("nc:DocumentIdentification/nc:IdentificationSourceText", "crossreference"),
Map.entry("nc:PrimaryLanguage\\nc:LanguageCode", "language"),
Map.entry("nc:PersonPhysicalFeature\\nc:PhysicalFeatureCategoryCode", "physicalfeature"),
Map.entry("nc:PersonHairColorCode", "haircolor"),
Map.entry("nc:PersonEyeColorCode", "eyecolor"),
Map.entry("nc:PersonEthnicityText", "ethnicity"),
Map.entry("nc:PersonRaceText", "race"),
Map.entry("nc:VehicleMakeCode", "vehiclemake"),
Map.entry("nc:VehicleColorPrimaryCode", "vehiclecolor"),
Map.entry("tyler:CaseTypeText", "casetype"),
Map.entry("tyler:DamageAmountCode", "damageamount"),
Map.entry("tyler:DisclaimerRequirementCode", "disclaimerrequirement"),
Map.entry("tyler:FilerTypeText", "filertype"),
Map.entry("tyler:CaseSubTypeText", "casesubtype"),
Map.entry("tyler:VehicleTypeCode", "vehicletype"),
Map.entry("tyler:MotionTypeCode", "motiontype"),
Map.entry("tyler:AnswerCode", "answer"),
Map.entry("tyler:QuestionCode", "question"),
Map.entry("tyler:RemedyCode", "procedureremedy"),
Map.entry("tyler:DataFieldConfigCode", "datafieldconfig"),
Map.entry("tyler:DocumentOptionalService", "optionalservices"));

@Override
public Map<String, String> xmlElemToTableName() {
return ecf4Map;
}

public static CodeDatabase fromDS(Jurisdiction jurisdiction, DataSource ds) {
try {
CodeDatabase cd = new CodeDatabase(jurisdiction, ds.getConnection());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,62 +74,6 @@
public class CodeUpdater {
private static final Logger log = LoggerFactory.getLogger(CodeUpdater.class);

// TODO(brycew-later): there's little more info on these mappings and how they combine besides:
// The name of an ECF element to be substituted by a court-specific codelist or extension
// Is this actually an XPath? Should figure it out
public static final Map<String, String> ecf4ElemToTableName =
Map.ofEntries(
Map.entry("cext:BondTypeText", "bond"),
Map.entry("cext:Charge/cext:ChargeStatute/j:StatuteLevelText", "degree"),
Map.entry("cext:Charge\\cext:ChargePhaseText", "chargephase"),
Map.entry("cext:GeneralOffenseText", "generaloffense"),
Map.entry("cext:StatuteTypeText", "statutetype"),
Map.entry(
"cext:Charge/cext:ChargeStatute/j:StatuteCodeIdentification/nc:IdentificationID",
"statute"),
Map.entry("ecf:CaseParticipantRoleCode", "partytype"),
Map.entry("ecf:FilingStatusCode", "filingstatus"),
Map.entry("ecf:ServiceRecipientID/nc:IdentificationSourceText", "servicetype"),
Map.entry(
"ecf:PersonDriverLicense/nc:DriverLicenseIdentification/nc:IdentificationCategoryText",
"driverlicensetype"),
Map.entry("j:/ArrestCharge/j:ArrestLocation/nc:LocationName", "arrestlocation"),
Map.entry("j:RegisterActionDescriptionText", "filing"),
Map.entry(
"j:ArrestOfficial/j:EnforcementOfficialUnit/nc:OrganizationIdentification/nc:IdentificationID",
"lawenforcementunit"),
Map.entry(
"j:Citation\\nc:ActivityIdentification\\tyler:JurisdictionCode",
"citationjurisdiction"),
Map.entry("nc:CaseCategoryText", "casecategory"),
Map.entry("nc:LocationCountryName", "country"),
Map.entry("nc:BinaryFormatStandardName", "documenttype"),
Map.entry("nc:BinaryCategoryText", "filingcomponent"),
Map.entry("nc:LocationStateName", "state"),
Map.entry("nc:PersonNameSuffixText", "namesuffix"),
Map.entry("nc:BinaryLocationURI", "filetype"),
Map.entry("nc:DocumentIdentification/nc:IdentificationSourceText", "crossreference"),
Map.entry("nc:PrimaryLanguage\\nc:LanguageCode", "language"),
Map.entry("nc:PersonPhysicalFeature\\nc:PhysicalFeatureCategoryCode", "physicalfeature"),
Map.entry("nc:PersonHairColorCode", "haircolor"),
Map.entry("nc:PersonEyeColorCode", "eyecolor"),
Map.entry("nc:PersonEthnicityText", "ethnicity"),
Map.entry("nc:PersonRaceText", "race"),
Map.entry("nc:VehicleMakeCode", "vehiclemake"),
Map.entry("nc:VehicleColorPrimaryCode", "vehiclecolor"),
Map.entry("tyler:CaseTypeText", "casetype"),
Map.entry("tyler:DamageAmountCode", "damageamount"),
Map.entry("tyler:DisclaimerRequirementCode", "disclaimerrequirement"),
Map.entry("tyler:FilerTypeText", "filertype"),
Map.entry("tyler:CaseSubTypeText", "casesubtype"),
Map.entry("tyler:VehicleTypeCode", "vehicletype"),
Map.entry("tyler:MotionTypeCode", "motiontype"),
Map.entry("tyler:AnswerCode", "answer"),
Map.entry("tyler:QuestionCode", "question"),
Map.entry("tyler:RemedyCode", "procedureremedy"),
Map.entry("tyler:DataFieldConfigCode", "datafieldconfig"),
Map.entry("tyler:DocumentOptionalService", "optionalservices"));

/**
* The path to the keystore file, containing the x509 cert used to sign headers to download zips.
*/
Expand Down Expand Up @@ -352,7 +296,7 @@ private boolean downloadCourtTables(
policyResp.getRuntimePolicyParameters().getCourtCodelist().stream()
.collect(
Collectors.toMap(
(cc1) -> ecf4ElemToTableName.get(cc1.getECFElementName().getValue()),
(cc1) -> cd.xmlElemToTableName().get(cc1.getECFElementName().getValue()),
// Tyler gives us URLs w/ spaces, which aren't valid. This makes them valid
(cc1) ->
cc1.getCourtCodelistURI()
Expand Down Expand Up @@ -531,7 +475,7 @@ public boolean replaceSome(
log.info("Downloading system tables for {}", cd.getJurisdiction());
boolean success = downloadSystemTables(baseUrl, cd, signer);

var tablesToDeleteDomain = ecf4ElemToTableName.values();
var tablesToDeleteDomain = cd.xmlElemToTableName().values();
for (String table : tablesToDeleteDomain) {
cd.createTableIfAbsent(table);
cd.deleteFromTable(table);
Expand Down Expand Up @@ -676,7 +620,9 @@ private static CodeDatabaseAPI makeCodeDatabase(Jurisdiction jurisdiction) {
10,
100);

return CodeDatabase.fromDS(jurisdiction, ds);
return switch (jurisdiction.getVendor()) {
case Jurisdiction.Vendor.TYLER -> CodeDatabase.fromDS(jurisdiction, ds);
};
} catch (Exception ex) {
throw new RuntimeException(ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CaseType;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeDatabase;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeTableConstants;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeUpdater;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CourtLocationInfo;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.OptionalServiceCode;
import edu.suffolk.litlab.efsp.tyler.ecfcodes.ServiceCodeType;
Expand Down Expand Up @@ -62,7 +61,7 @@ public void tearDown() throws SQLException {

@Test
public void allNamespacesMapToTables() {
for (String table : CodeUpdater.ecf4ElemToTableName.values()) {
for (String table : cd.xmlElemToTableName().values()) {
if (!table.equalsIgnoreCase("optionalservices")) {
assertNotEquals(
CodeTableConstants.getTableColumns(table).size(), 0, "Expected " + table + " to exist");
Expand Down
Loading