Last active
April 7, 2023 18:34
-
-
Save justinledwards/122ce6156d045151060d6848004f1192 to your computer and use it in GitHub Desktop.
Florida Court Case Number Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const parseFloridaCourtCaseNumber = (caseNumber) => { | |
// Regular expression pattern to match Florida court case numbers with optional extra hyphens | |
const pattern = /^(\d{4})-(\w{2})-(\d{6})(?:-([A-Za-z0-9]+))?(?:-([A-Za-z0-9]+))?$/; | |
const match = caseNumber.match(pattern); | |
if (match) { | |
const [, year, caseTypeAbbrev, sequenceNumber, optionalPart1, optionalPart2] = match; | |
// Map case type abbreviations to their corresponding strings | |
const caseTypeMap = { | |
'AP': 'Appeals', | |
'CA': 'Circuit Civil', | |
'CF': 'Circuit Criminal: Felony', | |
'TR': 'Civil Traffic: Traffic Infractions', | |
'CC': 'County Civil', | |
'SC': 'County Civil: Small Claims', | |
'CO': 'County Criminal: County Ordinance', | |
'MM': 'County Criminal: Misdemeanor', | |
'MO': 'County Criminal: Municipal Ordinance', | |
'IN': 'County Criminal: Non Criminal Infraction', | |
'CT': 'Criminal Traffic', | |
'DR': 'Domestic Relations/Family', | |
'CJ': 'Juvenile Delinquency', | |
'DP': 'Juvenile Dependency', | |
'GA': 'Probate: Guardianship', | |
'MH': 'Probate: Mental Health', | |
'CP': 'Probate: Probate/Guardianship' | |
}; | |
const caseType = caseTypeMap[caseTypeAbbrev] || 'Unknown'; | |
return { | |
year, | |
caseType, | |
sequenceNumber, | |
optionalPart1: optionalPart1 || null, | |
optionalPart2: optionalPart2 || null, | |
}; | |
} | |
// Return null if the case number does not match the expected pattern | |
return null; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment