open-austin / indigent-defense-stats

A web scraper for collecting and processing public case records from sites using Tyler Technology's Odyssey court records database software.
MIT License
15 stars 6 forks source link

Check-in that the format json in CosmosDB still fits for front-end use #96

Open nicolassaw opened 1 month ago

nicolassaw commented 1 month ago

Problem The current code has changed a lot since the original data was exported and loaded into the current live website. It is likely that the current format of the json and the structure of the CosmosDB container that comes form the current form of code is not what the front-end expects in terms of values and shape (there may be many to one charges per case id or many versions of one case id where the database may expect one).

Goal Review the front-end code and check in with the front-end developers to ensure the shape of the individual json and the CosmosDB container is properly set up for the front end visualization. Make any necessary changes.

tpadmanabhan commented 1 month ago

@nreddy216 @nicolassaw will reach out on this ticket

nicolassaw commented 1 month ago

This is a redacted example of cases from the cosmos db nested-cases-db' and container nested-cases:

{
    case_id: '1231241',
    case_number: '18-23123CR-2',
    attorney_type: 'Retained',
    earliest_charge_date: '2018-04-17',
    has_evidence_of_representation: false,
    charge_desc: [ 'Aggravated Assault' ],
    charge_category: [ 'Violent' ],
    charge_level: [ 'Misdemeanor A' ],
    motions: [],
    id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa',
    _ridxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    _self: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxA==/',
    _etag: '"0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"',
    _attachments: 'attachments/',
    _ts: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  },
  {
    case_id: '32145125',
    case_number: '18-3141CR',
    attorney_type: 'Retained',
    earliest_charge_date: '2018-04-16',
    has_evidence_of_representation: false,
    charge_desc: [ 'Destruction of Property' ],
    charge_category: [ 'Property' ],
    charge_level: [ 'Misdemeanor A' ],
    motions: [],
    id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
    _rid: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=',
    _self: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    _etag: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"',
    _attachments: 'attachments/',
    _ts: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  },
  {
    case_id: '1352352',
    case_number: '18-161231R',
    attorney_type: 'Court Appointed',
    earliest_charge_date: '2018-04-16',
    has_evidence_of_representation: false,
    charge_desc: [ 'Weapons Offense' ],
    charge_category: [ 'Public Order' ],
    charge_level: [ 'Misdemeanor A' ],
    motions: [],
    id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
    _rid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    _self: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/',
    _etag: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"',
    _attachments: 'attachments/',
    _ts: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  },
  {
    case_id: '13054124',
    case_number: '18-131231CR',
    attorney_type: 'Retained',
    earliest_charge_date: '2018-04-15',
    has_evidence_of_representation: false,
    charge_desc: [ 'Extortion/Threat' ],
    charge_category: [ 'Violent' ],
    charge_level: [ 'Misdemeanor A' ],
    motions: [],
    id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    _rid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    _self: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
    _etag: '"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"',
    _attachments: 'attachments/',
    _ts: 1672031481
  }

This is queried from the same DB and container from our app, but for the “representation by year” table so a condensed view of everything:

  {
    attorney_type: 'Retained',
    has_evidence_of_representation: true,
    year: 2008,
    case_count: 80
  }

We’re also using this DB and container for the last two visualizations on the page: cases-json-db & clean-cases

nicolassaw commented 1 month ago

Next steps on this project: