@@ -177,13 +177,17 @@ export const filterData = (
177177 const entityTypes = Object . keys ( scheme ) . filter ( ( type ) => type !== 'Document' && type !== 'Chunk' ) ;
178178 if ( graphType . includes ( 'Document' ) && ! graphType . includes ( 'Entities' ) && ! graphType . includes ( 'Chunk' ) ) {
179179 // Document only
180+ // @ts -ignore
180181 filteredNodes = allNodes . filter ( ( node ) => node . labels . includes ( 'Document' ) ) ;
181182 filteredScheme = { Document : scheme . Document } ;
182183 } else if ( ! graphType . includes ( 'Document' ) && graphType . includes ( 'Entities' ) && ! graphType . includes ( 'Chunk' ) ) {
183184 // Only Entity
185+ // @ts -ignore
184186 filteredNodes = allNodes . filter ( ( node ) => ! node . labels . includes ( 'Document' ) && ! node . labels . includes ( 'Chunk' ) ) ;
187+ // @ts -ignore
185188 filteredRelations = allRelationships . filter (
186- ( rel ) => ! [ 'PART_OF' , 'FIRST_CHUNK' , 'HAS_ENTITY' , 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption )
189+ ( rel ) => // @ts -ignore
190+ ! [ 'PART_OF' , 'FIRST_CHUNK' , 'HAS_ENTITY' , 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption )
187191 ) ;
188192
189193 filteredScheme = entityTypes . reduce ( ( acc , key ) => {
@@ -192,28 +196,34 @@ export const filterData = (
192196 } , { } as Scheme ) ;
193197 } else if ( ! graphType . includes ( 'Document' ) && ! graphType . includes ( 'Entities' ) && graphType . includes ( 'Chunk' ) ) {
194198 // Only Chunk
199+ // @ts -ignore
195200 filteredNodes = allNodes . filter ( ( node ) => node . labels . includes ( 'Chunk' ) ) ;
201+ // @ts -ignore
196202 filteredRelations = allRelationships . filter ( ( rel ) => [ 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption ) ) ;
197203 filteredScheme = { Chunk : scheme . Chunk } ;
198204 } else if ( graphType . includes ( 'Document' ) && graphType . includes ( 'Entities' ) && ! graphType . includes ( 'Chunk' ) ) {
199205 // Document + Entity
200206 filteredNodes = allNodes . filter (
201- ( node ) =>
207+ ( node ) => // @ts -ignore
202208 node . labels . includes ( 'Document' ) || ( ! node . labels . includes ( 'Document' ) && ! node . labels . includes ( 'Chunk' ) )
203209 ) ;
204210 filteredRelations = allRelationships . filter (
205- ( rel ) => ! [ 'PART_OF' , 'FIRST_CHUNK' , 'HAS_ENTITY' , 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption )
211+ ( rel ) => // @ts -ignore
212+ ! [ 'PART_OF' , 'FIRST_CHUNK' , 'HAS_ENTITY' , 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption )
206213 ) ;
207214 } else if ( graphType . includes ( 'Document' ) && ! graphType . includes ( 'Entities' ) && graphType . includes ( 'Chunk' ) ) {
208215 // Document + Chunk
216+ // @ts -ignore
209217 filteredNodes = allNodes . filter ( ( node ) => node . labels . includes ( 'Document' ) || node . labels . includes ( 'Chunk' ) ) ;
210- filteredRelations = allRelationships . filter ( ( rel ) =>
218+ filteredRelations = allRelationships . filter ( ( rel ) => // @ts -ignore
211219 [ 'PART_OF' , 'FIRST_CHUNK' , 'SIMILAR' , 'NEXT_CHUNK' ] . includes ( rel . caption )
212220 ) ;
213221 filteredScheme = { Document : scheme . Document , Chunk : scheme . Chunk } ;
214222 } else if ( ! graphType . includes ( 'Document' ) && graphType . includes ( 'Entities' ) && graphType . includes ( 'Chunk' ) ) {
215223 // Chunk + Entity
224+ // @ts -ignore
216225 filteredNodes = allNodes . filter ( ( node ) => ! node . labels . includes ( 'Document' ) ) ;
226+ // @ts -ignore
217227 filteredRelations = allRelationships . filter ( ( rel ) => ! [ 'PART_OF' , 'FIRST_CHUNK' ] . includes ( rel . caption ) ) ;
218228 } else if ( graphType . includes ( 'Document' ) && graphType . includes ( 'Entities' ) && graphType . includes ( 'Chunk' ) ) {
219229 // Document + Chunk + Entity
0 commit comments