Skip to content

Feature/create api client policy module#38

Open
nam-m wants to merge 38 commits intomainfrom
feature/create-api-client-policy-module
Open

Feature/create api client policy module#38
nam-m wants to merge 38 commits intomainfrom
feature/create-api-client-policy-module

Conversation

@nam-m
Copy link
Contributor

@nam-m nam-m commented Feb 11, 2024

Description

Issue Link: #19

This PR contains client class implementation for Business Licences in Vancouver Open Data Portal.

Since we only use Business Licences for now, the BASE_URL is set to "https://opendata.vancouver.ca/api/explore/v2.1/catalog/datasets/business-licences/records", and the supporting class methods will help add parameters to this URL

The query works by using "where" clause to filter the dataset, and "select" clause to choose return parameter.
For instance, setting where: businesstype="Short-Term Rental will filter the dataset for short-term rental businesses only.
And setting select: status will return the licence number status only.

Licence number validity check (string format, length,...) is omitted as this should be implemented in the Policies, so it is assumed that the status query will always return meaningful results

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • Unit Test
  • Integration Test
  • E2E Test

Checklist:

Before you submit your pull request, please make sure you have completed the following:

  • I have read the CONTRIBUTING document.
  • I have checked that my code adheres to the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Screenshots (if applicable)

Since we don't have pytest in CI yet, here's the test result
image

Additional Notes

Note that "licence" is used instead of "license" (grammar)

  • Interesting find:
    • For "Inactive" status, there's often another one with a different status. Hence, one licence number will return 2 statuses, in which one is "Inactive".
    • I found that some listings used inactive licence from another business

@nam-m nam-m added the enhancement New feature or request label Feb 11, 2024
@nam-m nam-m added this to the 1. MVP milestone Feb 11, 2024
@nam-m nam-m requested a review from umsu2 as a code owner February 11, 2024 23:55
@nam-m nam-m enabled auto-merge (squash) February 20, 2024 07:57
@nam-m nam-m requested a review from umsu2 February 21, 2024 04:55
def __init__(self, registration_number):
self.registration_number = registration_number

def valid_registration_number_policy(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Policies should have the same interface. this is 3 polices combined together.

class PolicyA:

def is_valid(): bool
def description(): ...

class PolicyB:
def is_valid(): bool
def description(): ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[MVP] Create API client to retrieve data from Vancouver Open Data Portal

3 participants