Skip to content
This repository has been archived by the owner. It is now read-only.

Update the GraphQL queries with new Cassandra schema #87

Merged
merged 28 commits into from Aug 4, 2017

Conversation

Projects
None yet
3 participants
@c-w
Copy link
Member

commented Jul 31, 2017

Just to get us started, still some things to implement (e.g. extra data needs to get wired from the frontend).

c-w added some commits Jul 21, 2017

Update conjunction as per Erik's invariants
`conjunctiontopics` tuple will always be in alphabetical order
for records for the main edge is represented as `(isis, None, None)`
then conjunction selected of `isis->car->fear` is represented as
`(car,fear,isis)`
isis->car` is represented as `(car,isis,None)`

@c-w c-w added the in progress label Jul 31, 2017

@c-w c-w requested a review from erikschlegel Jul 31, 2017

c-w added some commits Jul 31, 2017

Add mainEdge to popularLocations
This is the backend change for the following frontend change:
CatalystCode/project-fortis-interfaces#15
Add bbox and zoom to topSources and timeSeries
This is the backend change for the frontend change in
CatalystCode/project-fortis-interfaces#16
Add originalSource to TilesSchema
This is the backend change for the frontend change in
CatalystCode/project-fortis-interfaces#18
Wire-through originalSource for EdgesSchema
This is the backend change for the frontend change in
CatalystCode/project-fortis-interfaces#19

@c-w c-w force-pushed the implement-tiles-resolver branch from 94bbd52 to 8ea73a2 Aug 1, 2017

c-w added some commits Aug 1, 2017

Simplify event lookup
By adding non-queryable columns to the events table that contain all of
an events places and topics, we can re-build a full event just from the
data that we get back from that table. This makes a number of queries
easier and more performant, including the MessagesSchema.event query.
@Smarker

Smarker approved these changes Aug 3, 2017

Copy link
Contributor

left a comment

LGTM

];

cassandraConnector.executeQuery(query, params)
.then(rows => {
const keywords = makeSet(rows.map(row => row.topics), topic => topic);
const keywords = makeSet(rows, row => row.topic);

This comment has been minimized.

Copy link
@Smarker

Smarker Aug 3, 2017

Contributor

Rather than const keywords maybe it would be clearer to use const topics so there's one term for topic rather than a topic's name either being keyword or topic?

This comment has been minimized.

Copy link
@c-w

c-w Aug 3, 2017

Author Member

Done in 97a935a.

@erikschlegel
Copy link
Collaborator

left a comment

Looks great. Sorry for the delay. Please opine to the comments below.

AND periodtype = ?
AND pipelinekey = ?
AND externalsourceid = ?
AND conjunctiontopics = ?

This comment has been minimized.

Copy link
@erikschlegel

erikschlegel Aug 3, 2017

Collaborator

we've switched conjunctivetopic1, conjunctivetopic2, conjunctivetopic3

This comment has been minimized.

Copy link
@c-w

c-w Aug 4, 2017

Author Member

Done in 4b4d59b.

AND externalsourceid = ?
AND event_time <= ?
AND event_time >= ?
`.trim();

This comment has been minimized.

Copy link
@erikschlegel

erikschlegel Aug 3, 2017

Collaborator

we should probably use LIMIT here, as this result set can be large. We only care about the events that display on the news feed which are pages of 15 events.

This comment has been minimized.

Copy link
@c-w

c-w Aug 4, 2017

Author Member

Done in ab36b4c.

SELECT *
FROM fortis.events
WHERE pipelinekey = ?
AND eventid IN ?

This comment has been minimized.

Copy link
@erikschlegel

erikschlegel Aug 3, 2017

Collaborator

apparently the limit of items you can include in a C* IN clause is 65535. We should be fine as long as we cap the number of filtered eventid based on a LIMIT threshold from ^^^.

This comment has been minimized.

Copy link
@c-w

c-w Aug 4, 2017

Author Member

Done in 6bdb30d.

const eventsParams = [
toPipelineKey(args.sourceFilter),
eventIds,
`%${args.fulltextTerm}%`

This comment has been minimized.

Copy link
@erikschlegel

erikschlegel Aug 3, 2017

Collaborator

👍

c-w added some commits Aug 4, 2017

AND periodtype = ?
AND pipelinekey = ?
AND externalsourceid = ?
AND conjunctiontopic1 = ?

This comment has been minimized.

Copy link
@Smarker

Smarker Aug 4, 2017

Contributor

I know this was a change for CatalystCode/project-fortis-pipeline@f869c20, but conjunctiontopic1 doesn't seem so clear to me just with the 1 appended. I see that it is derived from the first parameter mainEdge in toConjunctionTopics, so maybe there could be a better name for this? But then doing so conjunctiontopic2 and conjunctiontopic3 would have to be changed as well to reflect a change in name of conjunctiontopic1.

This comment has been minimized.

Copy link
@c-w

c-w Aug 4, 2017

Author Member

This is one for @erikschlegel. I don't particularly care about the naming here because we have quite a few things in the database that require documentation already.

@c-w c-w merged commit 88315dc into master Aug 4, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@c-w c-w deleted the implement-tiles-resolver branch Aug 4, 2017

@c-w c-w removed the in progress label Aug 4, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.