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

Feature/country page #1972

Merged
merged 78 commits into from
Mar 4, 2024
Merged

Feature/country page #1972

merged 78 commits into from
Mar 4, 2024

Conversation

k9845
Copy link
Contributor

@k9845 k9845 commented Dec 5, 2023

Addresses

Make sure also we have loaded local-units in staging.

Commands to run

  • import_ns_organizational_capacity capacity.xls
  • ingest_gdacs
  • ingest_icrc
  • ingest_ns_capacity
  • ingest_ns_contact
  • ingest_ns_directory
  • ingest_ns_document
  • ingest_ns_initiatives

    databank

    • ingest_databank
    • ingest_acaps
    • FDRS_INCOME
    • fdrs_annual_income
    • ingest_climate
    • ingest_hdr
    • ingest_unicef
    • ingest_worldbank

Env variable required

    NS_CONTACT_USERNAME=,
    NS_CONTACT_PASSWORD=,
    ACAPS_API_TOKEN=,
    NS_DOCUMENT_API_KEY=,
    NS_INITIATIVES_API_KEY=,
    NS_INITIATIVES_API_TOKEN=,

Per

python manage.py loaddata question_group_description

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

Release

If there is a version update, make sure to tag the repository with the latest version.

@k9845 k9845 force-pushed the feature/country-page branch 6 times, most recently from 72f8af6 to 89b9b99 Compare December 15, 2023 08:22
@k9845 k9845 force-pushed the feature/country-page branch 5 times, most recently from 641c3af to ca20ec3 Compare December 22, 2023 06:35
@k9845 k9845 force-pushed the feature/country-page branch 6 times, most recently from b7bba5d to b791084 Compare January 2, 2024 08:27
@k9845 k9845 force-pushed the feature/country-page branch 6 times, most recently from e5ceacc to c926bf7 Compare January 11, 2024 10:12
@k9845 k9845 force-pushed the feature/country-page branch 6 times, most recently from c294883 to 6e68821 Compare January 29, 2024 06:29
@k9845 k9845 force-pushed the feature/country-page branch from 1aaf5ed to 916eaf4 Compare January 29, 2024 10:02
@k9845 k9845 force-pushed the feature/country-page branch 4 times, most recently from 4d6bac5 to aabeaac Compare February 28, 2024 10:30
@k9845 k9845 requested a review from thenav56 February 29, 2024 03:59
@k9845 k9845 marked this pull request as ready for review February 29, 2024 03:59
@k9845 k9845 force-pushed the feature/country-page branch 3 times, most recently from 5d74d8e to 78f2a20 Compare March 1, 2024 09:43
queryset = CountryKeyDocument.objects.select_related('country')
serializer_class = CountryKeyDocumentSerializer
search_fields = ("name",)
# permission_classes = (IsAuthenticated,)
Copy link
Member

Choose a reason for hiding this comment

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

Can you check this?


class GDACSEventViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = GDACSEventSerializer
filterset_class = GDACSEventFileterSet
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a queryset = .. as well for api document support.


class CountrySupportingPartnerViewSet(viewsets.ModelViewSet):
serializer_class = CountrySupportingPartnerSerializer
filterset_class = CountrySupportingPartnerFilter
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a queryset = .. as well for api document support.

fields = ()

def filter_countries(self, queryset, name, country):
if len(country):
Copy link
Member

Choose a reason for hiding this comment

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

Let's check for None as well.

api/admin.py Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Let's make sure all M2M and foreign keys have autocomplete enabled

Comment on lines +236 to +238
#'middlewares.cache.UpdateCacheForUserMiddleware',
'django.middleware.common.CommonMiddleware',
'middlewares.cache.FetchFromCacheForUserMiddleware',
#'middlewares.cache.FetchFromCacheForUserMiddleware',
Copy link
Member

Choose a reason for hiding this comment

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

Is this intentional?

if page >= rs[0]['pages']:
break
page += 1
print(data)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print(data)

while True:
for country_name in Country.objects.values_list('iso3', flat=True):
for indicator in WORLD_BANK_INDICATORS:
print(indicator)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print(indicator)

'per_page': 5000 - 1, # WD throws error on 5000
'page': page,
})
rs.raise_for_status()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should check the status instead of raise?


WORLD_BANK_INDICATORS = [indicator for indicator, _ in WORLD_BANK_INDICATOR_MAP]

WORLD_BANK_API = ""
Copy link
Member

Choose a reason for hiding this comment

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

Not used

@k9845 k9845 force-pushed the feature/country-page branch 3 times, most recently from 2e8b22b to 3ece1e3 Compare March 4, 2024 08:52
@samshara samshara merged commit 4266382 into develop Mar 4, 2024
1 check passed
@samshara samshara deleted the feature/country-page branch March 4, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants