generateCodebook(question: QuestionMetadata, potentialEntities: Entity[], rawAnswers: RawDataAnswer[]) // returns {codes: Code[]}
// with
type Code = {
id: string // id of the corresponding entity
existsInRepo: boolean // whether the code already exists in the entities repo
entity: Entity // when adding a new entity, should contain entity metadata
}
generateMatches(question: QuestionMetadata, matchingEntities: entities[], rawAnswers: RawDataAnswer[]) // return result: matches: AnswerMatch[]
// where AnswerMatch is defined as:
type AnswerMatch = {
index: number;
answer: string;
answerId: string;
tokenIds: string[];
};
We need two functions
generateCodebook
entitieshere are the existing potentially matching entities, as defined by the question'smatchTagsfunction. Ideally less than 1000 (or whatever the context cutoff is).existsInRepo: trueshould then manually be added to the Entities repo in the appropriate file.idfor existing entities and not the entireentityobject.generateMatches