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 Request] API - Add Indicator #157

Open
janbur opened this issue Nov 29, 2023 · 1 comment
Open

[Feature Request] API - Add Indicator #157

janbur opened this issue Nov 29, 2023 · 1 comment
Labels
Back-end 🕗 5 - 8 hours It will take between half a day and a full day.

Comments

@janbur
Copy link
Collaborator

janbur commented Nov 29, 2023

This is the child of: #151

Current API docs: https://geosight.unicef.org/api/v1/docs/

Objective

Create a new API endpoint for adding a new indicator to GeoSight. This will support batch import of indicators e.g. from another platform or another GeoSight instance.

Implementation

POST /api/v1/indicators/

  • 📒 Description:

    • Create an indicator.
  • ⬇️ Payload:

    • name (string),
    • description (string),
    • source (string),
    • short_code (string),
    • category (string),
    • units (string),
    • type (int, float, category),
    • value_min (for int and float types),
    • value_max (for int and float types),
    • code_list_id (for "category" type only)
  • ⬆️ Returns:

    • 201:
      • name (string),
      • description (string),
      • source (string),
      • short_code (string),
      • category (string),
      • units (string),
      • type (int, float, category),
      • value_min (for int and float types),
      • value_max (for int and float types),
      • code_list_id (for "category" type only)
    • 400:
      • response error

PUT /api/v1/indicators/{id}/

  • 📒 Description:
    • Update an indicator.
  • ⬇️ Payload:
    • name (string),
    • description (string),
    • source (string),
    • short_code (string),
    • category (string),
    • units (string),
    • type (int, float, category),
    • value_min (for int and float types),
    • value_max (for int and float types),
    • code_list_id (for "category" type only)
  • ⬆️ Returns:
    • 201:
      • name (string),
      • description (string),
      • source (string),
      • short_code (string),
      • category (string),
      • units (string),
      • type (int, float, category),
      • value_min (for int and float types),
      • value_max (for int and float types),
      • code_list_id (for "category" type only)
    • 400:
      • response error
@janbur janbur changed the title [Feature Request] Add Indicator [Feature Request] API - Add Indicator Nov 29, 2023
@meomancer
Copy link
Collaborator

meomancer commented Nov 30, 2023

This is partial of #160

Technical :

        form = IndicatorForm(data)
        if form.is_valid():
            instance = form.instance
            instance.creator = request.user
            instance.save()

Reference code:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back-end 🕗 5 - 8 hours It will take between half a day and a full day.
Projects
None yet
Development

No branches or pull requests

2 participants