codefortulsa / courtbot-engine

5 stars 6 forks source link

Combine party names from multiple sources #12

Closed pipakin closed 7 years ago

pipakin commented 7 years ago

getCaseParties should return the unique set of party names. Right now it will contain duplicates if multiple services return the same name.

chriswsh commented 7 years ago

Does it need to only return an array of this form:

[ { name: name1 }, {name: name2 }, {name: name3} ]

It looks like right now, courtbot-engine-data-oscn returns the defendants objects from the API, which would be:

{ "name": "string" "dockets": {} "events": {} }

If we can strip the extra stuff, that would make checking for duplicates a lot easier.

ashlux commented 7 years ago

It seems reasonable for courtbot-engine-data-oscn to strip out all the extra data. I don't know what data needs to be returned but [{name}, ...] looks about right. If so, just return an array of strings?

pipakin commented 7 years ago

Indeed, it was returning additional info, since it was getting it I wasn't stripping it out (since at the time I didn't need to). I'm fine with changing it to just an array of strings, however we will need to update everywhere that uses that data and expects an object with a name property.

chriswsh commented 7 years ago

Okay. In that case, I'll go with the array of strings. That way, courtbot-engine can add the results to a Set, which automatically checks for duplicates. Would you like courtbot-engine to convert the set back to an array? Or, if you're going to update everywhere that uses that data anyway, would updating it to the ES6 Set object be an issue?

pipakin commented 7 years ago

I wasn't planning to go change anything, if you want to make those changes I'd suggest making sure that the existing functionality that depends on it still works. :) The easiest way would be to convert it back to a list that has objects with a name property.

chriswsh commented 7 years ago

Ok. List of objects with a name property also works for me.

pipakin commented 7 years ago

Resolved by #23, #24, and #25