-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature/3374 three letter language code #2188
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One structural change, and the other thing is that we'll need a migration for this to move all 2 letter codes in the database to 3 letter ones. You can look in portality.migrate
to see how we handle migrations (look in one of the more recent ones to get the latest approaches), or I can talk you through it.
from typing import Callable, Any | ||
|
||
|
||
def create_fn_to_isolang(output_format=None, is_upper=False) -> Callable[[Any], str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this has got its own file, can't this just live in the portality.lib.coerce
module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create_fn_to_isolang
also call by portality.lib.dataobj
I should not let portality.lib.coerce
import to portality.lib.dataobj
or either way.
you can find a lot of same kind of convert function in portality.lib.coerce
or portality.lib.dataobj
, some of those is duplicate
- seamless.to_utf8_unicode
- seamless.to_unicode_upper
- to_country_code
- to_url
- to_float
in order to solve the import and duplicate problems, extract to new file to contain list of same kind of function is a solution.
but, purpose of this task is not refactoring. that is the reason why this file only have one function.
@philipkcl I think we should also identify some areas where language codes are particularly visible, such as search interface, ToC pages, and Article pages and list them under the testing header above to ask the DOAJ team to review before release |
I found the system compatible very well for records with 2-letter or 3-letter. which mean the form can show which language of 2-letter code and convert to 3-letter when the form saved. Should we still need to convert data from 2-letter to 3-letter? |
I found language code have been used in some form and some background job. |
I think we should be storing the data as we want it yeah. There are other ways to get at the data that aren't the form, and I'm not sure whether the fields would be automatically converted or not (it's possible they are!). We could check the API and perhaps the Journal CSV and see whether they come out as 3 letter codes there too. Even so, the strong temptation is to just migrate the data we hold so we don't need to think about it in the future. |
@richard-jones, I just found there have a special language field in Article
article structure journal structure |
added migration |
also migrate to 3 letter country code |
this branch is not ready yet, I need to update test case for country code |
ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change requested.
@philipkcl Unit tests failing even after testing multiple times. Not sure it is an issue with my environment. Please have a check once
=========================== short test summary info ============================
FAILED doajtest/unit/api_tests/test_api_crud_article.py::TestCrudArticle::test_14_test_via_endpoint
FAILED doajtest/unit/api_tests/test_api_crud_article.py::TestCrudArticle::test_15_no_redirects
FAILED doajtest/unit/api_tests/test_api_crud_article.py::TestCrudArticle::test_16_no_redirects
================= 3 failed, 15 passed, 2213 warnings in 59.35s =================
Tested as much as possible on UI. Looks ok to me
the unit test fail seem to be created by branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migration is for the Articles, but actually we need to migrate the data in Journals and Applications
portality/migrate/3374_three_letter_language_code/operations.py
Outdated
Show resolved
Hide resolved
remember to run |
@richard-jones , removed article migration |
Switch to the three letter code language code list #3374
Please don't delete any sections when completing this PR template; instead enter N/A for checkboxes or sections which are not applicable, unless otherwise stated below
See #
Describe the scope/purpose of the PR here in as much detail as you like
orphaned_datasets.py
have not been update, because it seem to be outdated and not workingDATAOBJ_TO_MAPPING_DEFAULTS
addedcountry_code_3
Categorisation
This PR...
Basic PR Checklist
constants
ormessages
filesdates
)develop
develop
(or other base branch)Testing
List the Functional Tests that must be run to confirm this feature
Deployment
What deployment considerations are there? (delete any sections you don't need)
Configuration changes
What configuration changes are included in this PR, and do we need to set specific values for production
Scripts
What scripts need to be run from the PR (e.g. if this is a report generating feature), and when (once, regularly, etc).
Migrations
What migrations need to be run to deploy this
Monitoring
What additional monitoring is required of the application as a result of this feature
New Infrastructure
What new infrastructure does this PR require (e.g. new services that need to run on the back-end).
Continuous Integration
What CI changes are required for this