Skip to content
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

Re-factor API module #71

Open
26 tasks
skasberger opened this issue Jan 29, 2021 · 1 comment
Open
26 tasks

Re-factor API module #71

skasberger opened this issue Jan 29, 2021 · 1 comment
Assignees
Labels
pkg:api api related activities pkg:testing test related activities prio:high status:confirmed Is a valid issue and will be moved forward soon. type:review Review

Comments

@skasberger
Copy link
Member

skasberger commented Jan 29, 2021

Re-factor API module.

Requirements

  • Reduce API interfaces to Native and Sword
  • Make methods and variables private and access them through getters/setters (@Property, @func_name.setter)
  • Use session for requests
  • Store Dataverse installation version when instantiating API
  • Check if Dataverse installation already has endpoint before accessing
  • Make function call more intuitive from the users perspective, not from the API endpoints / programmers one.
  • Align to user stories

ACTIONS

0. Pre-Requisites

1. Research

  • Check out notes_api.md
  • Review existing module
  • Check sessions usage in Wikipedia() package: set headers, close, etc.
  • Identify most-common use-cases and their API requests needed?
    • Identify the helpful response objects
  • Check usage of abstract base class (ABC)
  • Automatically check file integrity after download with hash comparison.
  • List up all endpoints, cluster to logical groups. Then use result of identified user stories to improve naming and functionality.

User stories

Function naming and structure

  • Direct and easy to understand access to most common functionalities

  • Dataverse

    • get_dataverse_id(alias): returns the dataverse version string/int
    • get_children(alias/id)
  • Dataset

    • get_dataset_version(PID): returns directly the version string
    • get_children(pid/id)
  • Datafile

    • get_datafile_name(datafile_id): returns the datafile name string
    • get_dataframe(datafile_id): returns the datafile as Pandas dataframe

Architecture

class NativeApi():
  .__created_at
  .__api_token
  .__dataverse_version: beim ersten Aufruf runterladen und speichern
  .__dataverse_build: beim ersten Aufruf runterladen und speichern
  .api_token # @property
  .dataverse_version # @property
  .dataverse_build # @property

  def __init__(self):
    pass

class SwordApi():
  .__created_at
  .__api_token
  .__dataverse_version: beim ersten Aufruf runterladen und speichern
  .__dataverse_build: beim ersten Aufruf runterladen und speichern
  .api_token # @property
  .dataverse_version # @property
  .dataverse_build # @property

  def __init__(self):
    pass

2. Plan

  • Define requirements
  • Prioritize API functionalities by factors such as:
    • not used by AUSSDA
    • often used by users
    • critical if not working: see risk assessment

3. Implement

  • Write tests
  • Write/Update code
  • Write/Update Docs
  • Write/Update Docstrings
  • Run pytest
  • Run tox
  • Run pylint
  • Run mypy

4. Follow Ups

  • Review
    • Code
    • Tests
    • Docs

Check for architecture update of the API module.

@skasberger skasberger added type:review Review pkg:testing test related activities pkg:api api related activities prio:high status:confirmed Is a valid issue and will be moved forward soon. labels Jan 29, 2021
@skasberger skasberger self-assigned this Jan 29, 2021
@skasberger skasberger added this to the v0.4.0 milestone Feb 15, 2021
@skasberger skasberger mentioned this issue Mar 14, 2021
35 tasks
@skasberger skasberger changed the title Review API module architecture Re-factor API module Apr 2, 2021
@pdurbin
Copy link
Member

pdurbin commented Feb 14, 2024

As discussed during the 2024-02-14 meeting of the pyDataverse working group, we are closing old milestones in favor of a new project board at https://github.com/orgs/gdcc/projects/1 and removing issues (like this one) from those old milestones. Please feel free to join the working group! You can find us at https://py.gdcc.io and https://dataverse.zulipchat.com/#narrow/stream/377090-python

@pdurbin pdurbin removed this from the v0.4.0 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:api api related activities pkg:testing test related activities prio:high status:confirmed Is a valid issue and will be moved forward soon. type:review Review
Projects
None yet
Development

No branches or pull requests

2 participants