Giter VIP home page Giter VIP logo

wikidatacomplete-backend's Introduction

WikidataComplete-Backend

Local Setup (using python 3.7)

  • Git clone (git clone https://github.com/WikidataComplete/wikidatacomplete-backend.git)
  • cd wikidatacomplete-backend
  • Setup virtual environment (python3 -m venv env .)
  • Activate virtual environment (source env/bin/activate)
  • Install requirements (pip install -r requirements.txt)
  • Create env file touch .env
  • Add these variables inside env file:
DEBUG=True/False (have 1 value either True or False)
SECRET_KEY=""    (use django project secret key here, can be generated via https://djecrety.ir/)
  • Run migrations (python manage.py makemigrations, python manage.py migrate)
  • Run server (python manage.py runserver)
  • Run custom management command to populate data (python manage.py transfer_old_facts)
  • See it running on http://localhost:8000/api/v1/facts/

API Docs

wikidatacomplete-backend's People

Contributors

lalit97 avatar perevalov avatar

Stargazers

Dhairya Khanna avatar  avatar

Watchers

Andreas Both avatar  avatar

Forkers

lalit97

wikidatacomplete-backend's Issues

Publish initial frontend

DoD

  • As a user, I want to login and see the upload form.
    • integrate login from #45 into the Web UI #53
    • Requirements:
      • menu items:
        • show link to highscore of the current user #54
        • show link to upload form
        • show account information of the current user
        • show logout button
  • Bootstrap was integrated into the React frontend
  • the code was deployed automatically on https://datacompletewiki.toolforge.org/

Add meta_information and feedback fields in Fact table

As per discussion with Andreas and Guo last to last week, we need 2 new fields in the table for implementing accept, and reject APIs and showing question text.

(1) feedback field for collecting feedback from editors
default = None
can be None/True/False

correct/ published (old schema) --> feedback (new schema)
(correct or published fields from the old schema should be mapped with feedback in the new schema for the existing fact records)

published = True -> Feedback = True (current date)
published = False -> Feedback = False (current date)
published = None -> Feedback = None (we have not received feedback yet. date = empty)

example feedback = {"feedback_date": 01-01-22, "feedback": boolean, "user_id": wdtId}

(2) question (old schema) --> meta_information (new schema)

meta_information = { # replacement for question field
"question": "" # current, donations can have anything
}

Exclude accepted and rejected facts in Get facts APIs

  • facts detail and list API should not include accepted and rejected facts.
  • test APIs by reloading the page in UI after accepting and rejecting facts. The page shouldn't break and API should not return accepted or rejected facts.

implement the 1st version of WikidataComplete Web service (wrapper service)

Context

The new WikidataComplete web service needs to be compatible with the old one.

flowchart LR;
subgraph firstiteration["first iteration"]
  direction LR
  WikidataGadget[["existing\nWikidataComplete\ngadget"]] -- Restful\nrequest --> NewService["new\nWikidataComplete\nweb service"]
  NewService -- Restful\nrequest  --> ExistingWikidataComplete[["existing WikidataComplete\nweb service"]]
  NewService -- store\nprocess\ninformation --> Database[(Database to store\n additional information\nabout the process,\ne.g., the actions per user)]
  NewService -- deploy\nautomatically --> DeployServer
  DeployServer>http://demos.swe.htwk-leipzig.de/ ]
end

style firstiteration fill:#fff,stroke:#333
style WikidataGadget fill:#ccf,stroke:#333
style ExistingWikidataComplete fill:#cfc,stroke:#333
style NewService fill:#fcf,stroke:#333
style Database fill:#ffc,stroke:#333
style DeployServer fill:#cff,stroke:#333
Loading

Thereafter, we will allow data donations.

flowchart LR;
subgraph seconditeration["later iteration"]
  direction LR
  WikidataGadget[["existing\nWikidataComplete\ngadget"]] -- Restful\nrequest --> NewService["new\nWikidataComplete\nweb service"]
   ExistingWikidataComplete[["existing WikidataComplete\nweb service"]] -- donates Wikidata\nfact candidates\nvia Restful request  --> NewService 
  NewService -- store\nprocess\ninformation --> Database[(Database to store\n additional information\nabout the process,\ne.g., the actions per user)]
  NewService -- deploy\nautomatically --> DeployServer
  DeployServer>http://demos.swe.htwk-leipzig.de/ ]
end

style seconditeration fill:#fee,stroke:#333
style WikidataGadget fill:#ccf,stroke:#333
style ExistingWikidataComplete fill:#cfc,stroke:#333
style NewService fill:#fcf,stroke:#333
style Database fill:#ffc,stroke:#333
style DeployServer fill:#cff,stroke:#333
Loading

Definition of Done (DoD)

  • @D063520 @gabinguo Please provide an API description of the existing web service (green)

  • @lalit97 Please implement the new web service (magenta) which is a wrapper for the existing web service (green) (see also #11 )

    • i.e., each request to the new web service (magenta) is translated into a request to the existing web service (green)
    • hence, the following should be true: the new web service can be used as backend for the existing WikidataComplete Gadget (blue) (only the web service URI needs to be changed), i.e., it behaves exactly the same
    • @lalit97 the requests to the existing web service are in a separate Python module (i.e., your web service should consist of at least two Python classes)
    • @lalit97 your common.js was changed to point to the new web service, in the next meeting show that you can add facts like with the existing web service
  • (skipped) @lalit97 create a Dockerfile for the new web service (magenta)

  • (skipped) @lalit97 after having finished the new web service inform @MindMaster98, he will provide a GitHub action to deploy the new service automatically to the demos server (cyan)

  • @lalit97 the API was documented using OpenAPI

    • the API documentation of the new service should be exactly the same as the old API
  • (skipped) @lalit97 make application parameters configurable via argparser or similar (see example)

  • the implemented functionality is tested (automatically) using a unit test

  • the version of the artifact was incremented (using Semantic Versioning -- ask @anbo-de if you are unsure what increment should be used) and documented here in a comment (use GitHub releases functionality)

    • the first version should be 0.1.0
  • the documentation was checked and was updated if necessary, updated documentations are linked here in a comment

  • the corresponding commit was mentioned here in a comment

Add tests to CRUD-Service

  • For all OpenAPI functions, at least one test was defined.
    • Each test that is sends information reads the payload of the message from a JSON file that is stored besides the test classes (s.t., the data is separated from the test implementation)

Log in functionality via Wikidata

As a user of a WikidataComplete Web UI, I want to log in using my Wikimedia account.

Remark: An OAuth2 mechanism would be preferred.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.