Skip to content

Conversation

@esirK
Copy link
Contributor

@esirK esirK commented Jan 27, 2021

Description

Includes country in the sensor data serializer

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Screenshot 2021-01-27 at 16 52 19

Checklist:

  • My code follows the style guidelines 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

@esirK esirK self-assigned this Jan 27, 2021
Copy link
Member

@kilemensi kilemensi left a comment

Choose a reason for hiding this comment

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

🚀 @esirK

LGTM

   {
      "id":19709462,
      "sampling_rate":null,
      "timestamp":"2021-01-27T14:09:46.012686Z",
      "sensordatavalues":[
         {
            "id":46360003,
            "value":"1009.43",
            "value_type":"pressure"
         },
         {
            "id":46360002,
            "value":"28.64",
            "value_type":"P10"
         },
         {
            "id":46360001,
            "value":"18.8",
            "value_type":"P2"
         },
         {
            "id":46360000,
            "value":"13.2",
            "value_type":"P1"
         },
         {
            "id":46359999,
            "value":"97.0",
            "value_type":"temperature"
         },
         {
            "id":46359998,
            "value":"14",
            "value_type":"humidity"
         }
      ],
      "location":{
         "id":3388,
         "location":"Université Assane Seck de Ziguinchor, Boucotte-Sud BS Rue 57, Boucotte Sud, Ziguinchor, Département de Ziguinchor, Ziguinchor, 27000, Sénégal",
         "indoor":false,
         "description":null,
         "country":"Sénégal"
      },
      "sensor":1465,
      "software_version":""
   },

Since we'll be dealing with a lot of data however, do we need the full location object or we could create a specific SensorLocation serializer e.g. SensorDataSensorLocationSerializer that just returns the location's country field ?

@esirK
Copy link
Contributor Author

esirK commented Jan 27, 2021

@kilemensi yes that is also possible.

@esirK esirK merged commit 13a065f into develop Jan 28, 2021
@esirK esirK deleted the ft-return-sensor-country branch January 28, 2021 00:54
esirK added a commit that referenced this pull request Feb 2, 2021
* Ft locations endpoint (#75)

* Adds Location Serializer

* Allows users to list and create locations

* Adds a basename for sensors_location_router

* Adds Pagination

* Adds Node creation API endpoint (#76)

* Adds Node creation API endpoint

* Remove un used serializer import

* Add Sensors + Sensor_Type Endpoint (#77)

* sensors endpoint

* fix serializers

* authentication on post

* sensors type endpoint

* Update sensorsafrica/api/v2/views.py

Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>

* Update sensorsafrica/api/v2/views.py

Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>

* spelling

Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>

* [Hotfix] Creation api (#79)

* Standardize naming around views, models and routes
* Add tests

* [Feature] Public / Private Data (#81)

* Add SensorDataView using CursorPagination to show all available data

* Make /v2/data return all data, keept /data/<sensortype> for air/water,
etc.

* Switch computation to only work with public data (sensorsAFRICA data for
now)

* Upgrade backward compatible deps

* Add default AUTHENTICATION_CLASSES (#82)

Feinstaub framework doesn't set per view authentication classes and
hence we need default ones

* [Fix] serializer (#83)

* Introduce SensorTypeSerializer that will handle uid

* Use SensorTypeSerializer

* Ensure city and data exists before trying to upload (#85)

* Upload data from public sensors only (#87)

* [Feature] Make v1/now return public data only (#86)

* Recreate feinstaub NowView but with public sensors filter

* Switch to custom NowView

* Add owner as part of node (#89)

* [Fix] v1/node should check groups (#88)

* Add NodeView that checks group ownership + pagination

* Update router to use new NodeView

* Use user id instead of user object (#90)

* Adds endpoint for providing metadata (#91)

* Adds endpoint for providing metadata

* Use dynamic database name

* Returns sensors locations and last time database was updated.

* Adds sensor networks to returned metadata

* Adds authentication to the meta endpoint

* Remove a default NETWORKS_OWNER

* Use latest created SensorDataValue to know when the database was last updated.

* Ensure we only return SensorLocations with a country

* Ft increase gurnicorn timeout (#92)

* Increase Gunicorn timeout to 3 minutes

* Return sorted sensors locations

* Includes country in the sensor data serializer (#93)

* Includes country in the sensor data serializer

* Only return location id and country

* Ft add location filter (#95)

* Adds a nodes filter using location

* Adds nodes filter for v1 of the API

* Remove filterling on v2 since it's only used for the F.E map

* Use default django filter backend

* Makes country location matching case insensitive.

* [Ft] Nodes last notify (#94)

* update node last_notify

* update nodeserializer

* import from feinstaub

* class naming

* code refactor

* remove repeating line

* comment line

* Update sensorsafrica/api/v1/serializers.py

Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>

* rename verbose to lastnotify

* update only when current notify is less than sensordata timestamp

Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>

* Ft add location filter for /v2/data (#97)

* Adds location filter for /data endpoint

* Temporaliry Remove iexact

* [FT] Time filter  (#96)

* add last_notify filter on nodes, sensorfilter

* view class override

* filter ovverides

* add exact to look up exp

* Includes missing import

Co-authored-by: esir <esirkings@gmail.com>

Co-authored-by: Khadija Mahanga <khadijamahanga@y7mail.com>
Co-authored-by: _ Kilemensi <kilemensi@users.noreply.github.com>
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