Skip to content

Add "sa" as valid license and map "publicdomain" to "pdm" #4220

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

Merged
merged 5 commits into from
May 1, 2024

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Apr 29, 2024

Description

Some files specify the license as "publicdomain". Our standard slug for public domain content is "pdm".

Some files in the API have licenses like "publicdomain" and "sa". This PR adds these licenses to the openverse-attribution package. This PR also adds some exception handling around the use of License (it should not be necessary anymore, but still).

A more comprehensive update for License is #4250, this PR is the baseline fix that will enable us to deploy the API again.

Testing Instructions

  1. Change some rows in the DB to have "publicdomain" or "sa" as the license.
  2. Go to their detail page.
  3. You should not get 500 errors.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb added 🟧 priority: high Stalls work on the project or its dependents 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API labels Apr 29, 2024
@dhruvkb dhruvkb requested a review from a team as a code owner April 29, 2024 07:43
@dhruvkb dhruvkb requested review from krysal and stacimc April 29, 2024 07:43
@obulat
Copy link
Contributor

obulat commented Apr 29, 2024

I queried the ES index for license values we used. Do we correctly handle all of them, @dhruvkb ?

{
  "hits": {
    "total": {
      "value": 10000,
      "relation": "gte"
    },
  },
  "aggregations": {
    "unique_licenses": {
      "buckets": [
        {
          "key": "by-nc",
          "doc_count": 494378894
        },
        {
          "key": "by-nc-sa",
          "doc_count": 287575564
        },
        {
          "key": "by",
          "doc_count": 268183052
        },
        {
          "key": "by-nc-nd",
          "doc_count": 252172663
        },
        {
          "key": "by-sa",
          "doc_count": 215586799
        },
        {
          "key": "by-nd",
          "doc_count": 54390016
        },
        {
          "key": "cc0",
          "doc_count": 52675005
        },
        {
          "key": "pdm",
          "doc_count": 27846971
        },
        {
          "key": "sampling+",
          "doc_count": 22399
        },
        {
          "key": "publicdomain",
          "doc_count": 21335
        },
        {
          "key": "sa",
          "doc_count": 11723
        },
        {
          "key": "nc-sampling+",
          "doc_count": 5898
        }
      ]
    }
  }
}

@dhruvkb
Copy link
Member Author

dhruvkb commented Apr 29, 2024

We also do not handle "sa". The closest to that is "by-sa". All others are now handled. Should I update the PR for "sa" → "by-sa" as well?

@dhruvkb dhruvkb changed the title Use "pdm" as the license instead of "publicdomain" Map incorrect licenses "publicdomain" and "sa" to "pdm" and "by-sa" Apr 29, 2024
Copy link

sentry-io bot commented Apr 29, 2024

Sentry Issue: OPENVERSE-API-DB

Copy link
Collaborator

@stacimc stacimc left a comment

Choose a reason for hiding this comment

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

Is this a problem that should be addressed in the catalog where we're setting those slugs? Or is that the long-term plan and this is temporary?

I'm also curious about mapping sa to by-sa. In the catalog we set these for https://creativecommons.org/licenses/sa/1.0/ and https://creativecommons.org/licenses/sa/2.0/jp, both of which I get results for (although there's a notice that they're retired). I'm not really familiar with how this works, but is it accurate to map that to by-sa? Should we just not ingest those records, instead?

@dhruvkb
Copy link
Member Author

dhruvkb commented Apr 29, 2024

Thanks for catching and explaining this @stacimc because mapping "sa" to "by-sa" would not have been right! I have updated the code in 179182f to treat "sa" accurately as a valid, but deprecated license.

@dhruvkb dhruvkb force-pushed the handle_publidomain branch from 179182f to 36b21e4 Compare April 29, 2024 19:57
@dhruvkb dhruvkb changed the title Map incorrect licenses "publicdomain" and "sa" to "pdm" and "by-sa" Add "sa" as valid license and map "publicdomain" to "pdm" Apr 29, 2024
@dhruvkb dhruvkb force-pushed the handle_publidomain branch from 36b21e4 to 641844f Compare April 29, 2024 20:16
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

@dhruvkb, I thought this could be a quick fix that would enable us to deploy the API without reverting the pdm changes. However, after @stacimc's note, I realize that we should carefully review the handling of licenses to ensure that we don't accidentally change the values.
Catalog has a very comprehensive list of license pair and license url correspondences, and publicdomain there is a valid license (mark) value: https://github.com/WordPress/openverse/blob/2051936d08b31c024873051fd3b7725635579e47/catalog/dags/common/licenses/constants.py
I think we should move it to the attribution package, and update it to accept all possible values.

@dhruvkb dhruvkb marked this pull request as draft April 30, 2024 04:57
@zackkrida zackkrida added 🟥 priority: critical Must be addressed ASAP and removed 🟧 priority: high Stalls work on the project or its dependents labels Apr 30, 2024
@zackkrida zackkrida requested review from obulat and stacimc April 30, 2024 14:53
@dhruvkb dhruvkb marked this pull request as ready for review May 1, 2024 11:50
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

LGTM for the sake of our deployments. I would generally prefer we use license instead of lic in the model and serializer but that's a style nitpick and not blocking.

@dhruvkb
Copy link
Member Author

dhruvkb commented May 1, 2024

license shadows built-in name.

@dhruvkb dhruvkb merged commit c9b8593 into main May 1, 2024
61 checks passed
@dhruvkb dhruvkb deleted the handle_publidomain branch May 1, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants