Skip to content

[rojak-api] Revisi spesifikasi API berdasarkan schema data v0.5 #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bobbypriam opened this issue Nov 6, 2016 · 2 comments
Open

[rojak-api] Revisi spesifikasi API berdasarkan schema data v0.5 #180

bobbypriam opened this issue Nov 6, 2016 · 2 comments
Labels
Milestone

Comments

@bobbypriam
Copy link
Contributor

Panduan: rojak_schema_latest.sql.

Perubahan paling utama yaitu pemindahan asosiasi news_sentiment dari sebelumnya news-candidate menjadi news-pair_of_candidates.

Deliverable: spesifikasi API v0.3.

@pyk pyk added the tim-api label Nov 6, 2016
@pyk pyk added this to the Rojak v2.0.0 milestone Nov 6, 2016
@bobbypriam
Copy link
Contributor Author

bobbypriam commented Nov 7, 2016

Okay, ini draft yang kita ajukan untuk v0.3.

Summary

Beberapa notable changes termasuk:

  1. Kita menghilangkan kapabilitas mendapatkan sentimen dari candidate.
  2. Endpoint /pairings/{id}/media-sentiments kita hilangkan dan menjadikannya embeddable field pada resource pairings dengan nama sentimentsByMedia. Endpoint /media/{id}/sentiments juga di-merge jadi embeddable field pada resource media dengan nama sentimentsOnPairing. Total hanya akan ada 8 endpoint yang masing-masing berbentuk /<resource> dan /<resource>/<id> dari 4 entity utama, yaitu candidate, pairing, news, dan media.

Endpoints

Candidates

endpoints                 response type
---------------------------------------
/candidates:              [Candidate]
  /{id}:                  Candidate

embeddable:
  - pairing:              Pairing

Pairing

endpoints                 response type
---------------------------------------
/pairings:                [Pairing]
  /{id}:                  Pairing

embeddable:
  - candidates:           PairingCandidates
  - overallSentiments:    PairingSentiment
  - sentimentsByMedia:    [PairingMediaSentiment]

News

endpoints                 response type
---------------------------------------
/news:                    [News]
  /{id}                   News

embeddable:
  - media:                Media
  - mentions:             [Candidate]
  - sentiments:           [NewsSentiment]

searchable:
  - mediaId
  - candidateId

Media

endpoints                 response type
---------------------------------------
/media:                   [Media]
  /{id}:                  Media

embeddable:
  - latestNews:           [News]
  - sentimentsOnPairings: [PairingMediaSentiment]

Schema

Note: embeddedFields of an entity are present only if the
      entity are not embedded themselves.

// ------- Candidate -------

type Candidate {
  id
  ...properties
  ...embeddedFields
}

// ------- Pairing -------

type Pairing {
  id
  ...properties
  ...embeddedFields
}

type PairingCandidates {
  cagub: Candidate
  cawagub: Candidate
}

type PairingSentiment {
  positiveNewsCount: Int
  negativeNewsCount: Int
}

type PairingMediaSentiment {
  media: Media
  positiveNewsCount: Int
  negativeNewsCount: Int
}

// ------- News -------

type News {
  id
  ...properties
  ...embeddedFields
}

type NewsSentiment {
  pairing: Pairing
  type: String
  confidentScore: Float
}

// ------- Media -------

type Media {
  id
  ...properties
  ...embeddedFields
}

@bobbypriam
Copy link
Contributor Author

bobbypriam commented Nov 8, 2016

Update

Dari spesifikasi di atas, ada beberapa perubahan:

  1. Pada trait searchable dari news, tadinya kita berniat menambahkan field untuk pencarian berdasarkan pairing_id dan url. Pencarian dengan pairing_id agak redundan dengan candidate_id, karena detail kandidat bisa di-embed pada pairing, maka kita hilangkan. Untuk url juga sepertinya masih belum bisa disupport saat ini (lihat [rojak-api] Enable searching for news article by URL #131), jadinya untuk sementara kita hilangkan juga.
  2. Tambahan endpoint /stats untuk mendapatkan statistik data pada Rojak saat ini. Data yang saat ini terpikirkan dapat diquery adalah news_count, media_count, total_sentiments_count, positive_sentiments_count, negative_sentiments_count, oot_sentiments_count.

PR sedang otw, tinggal implemen yang /stats, harusnya bisa besok malam ini 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants