noi-techpark / bdp-commons

GNU Affero General Public License v3.0
2 stars 12 forks source link

As STA I would like to integrate the real-time parking data of my parking stations in Bressanone and Brunico from the newly available Skidata API, so that I can show this data on the suedtirolmobil channels #663

Open rcavaliere opened 6 months ago

rcavaliere commented 6 months ago

231219_SpecificheIntegrazione_NOI_v1.1.docx

230728_SpecificaSkidata.pdf

dulvui commented 5 months ago

@rcavaliere The first version of the data collector is now available on testing. https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingStation/?where=sorigin.eq.skidata

I still have some questions:

dulvui commented 5 months ago

@rcavaliere The datacollector has now all data on testing. The only thing I changed from your proposal is the datatype naming: I used English translations for SostaBreve = ShortStay and Abbonati = Subscribers. Should I use the italian names? As GPS point I simply used the coordinates of Bolzano as placeholder.

ParkingFacility stations https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingFacility/?where=and(sorigin.eq.skidata,sactive.eq.true) ParkingStation stations https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingStation/?where=and(sorigin.eq.skidata,sactive.eq.true) all stations https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/*/?where=and(sorigin.eq.skidata,sactive.eq.true) data https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingStation/*/latest?where=and(sorigin.eq.skidata,sactive.eq.true)

rcavaliere commented 5 months ago

That's fine, I will test it!

rcavaliere commented 5 months ago

@dulvui looks everything correctly implemented, cool!

One question: at present don't we receive any measurements for the ParkingFacility? Or better can't we calculate this based on the measurements associated to the child ParkingStations, as proposed in the specification document? And are you sure that we receive the free data types? Don't we receive information about occupied / reserved parking lots? Can you provide some examples of responses of their API?

Once this is clarified, the Data Collector can be considered "production ready". However, we have the open point related to the coordinates not present in the API. I got the feedback that they will extend the API, so let's wait for this, correct the Data Collector, test it quickly again before going into production.

dulvui commented 5 months ago

@rcavaliere The facility itself doesn't give any measurements data, but of course it could be calculated based on the data of the child stations. I'll add that now and add a sum off all categorires to the ParkingFacility station.

For the free/occupied data we actually receive both from the API. CurrentLevel represents occupied and FreePlaces free. Currently I only consider free places, but I will add also occupied now. I have missed the part in the specification, about storing both free and occupied data.

Here an example response:

{
  "ContentEncoding": null,
  "ContentType": null,
  "Data": {
    "Status": "OK",
    "FreePlaces": [
      {
        "FacilityID": 608612,
        "FacilityDescription": "Mobilitätszentrum",
        "ParkNo": 0,
        "CountingCategoryNo": 1,
        "CountingCategory": "Sosta Breve",
        "FreeLimit": 217,
        "OccupancyLimit": 218,
        "CurrentLevel": 58,
        "Reservation": 0,
        "Capacity": 218,
        "FreePlaces": 160
      },
      {
        "FacilityID": 608612,
        "FacilityDescription": "Mobilitätszentrum",
        "ParkNo": 0,
        "CountingCategoryNo": 2,
        "CountingCategory": "Abbonati",
        "FreeLimit": 20,
        "OccupancyLimit": 21,
        "CurrentLevel": 2,
        "Reservation": 0,
        "Capacity": 21,
        "FreePlaces": 19
      },
      {
        "FacilityID": 608612,
        "FacilityDescription": "Mobilitätszentrum",
        "ParkNo": 0,
        "CountingCategoryNo": 3,
        "CountingCategory": "Totale",
        "FreeLimit": 237,
        "OccupancyLimit": 239,
        "CurrentLevel": 60,
        "Reservation": 0,
        "Capacity": 239,
        "FreePlaces": 179
      }
    ]
  },
  "JsonRequestBehavior": 0,
  "MaxJsonLength": null,
  "RecursionLimit": null
}
rcavaliere commented 5 months ago

@dulvui I will test this this afternoon. For the coordinates issue, they Data Provider will implement this, but we are waiting for feedback

rcavaliere commented 4 months ago

@dulvui I have tested the Data Collector. Most of the work has been done, great, just a couple of observations:

Can you please fix this?

dulvui commented 4 months ago

@rcavaliere I added now all types also to ParkingFacility by making the sum of the data provided by the single ParkingStations of a Parking Facility. All stations (PatkingFacility and ParkingStation) have now occupied/free measurements for all types, does that solve the second point?

Here the API call with all data type names for ParkingFacilities that are available now: https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingFacility/*/latest?where=sorigin.eq.skidata&select=tname And here of course all data https://mobility.api.opendatahub.testingmachine.eu/v2/flat,node/ParkingFacility/*/latest?where=sorigin.eq.skidata

rcavaliere commented 4 months ago

@dulvui many thanks, now the integration seems to be perfect! Only one thing: why do we have two ParkingFacility stations and just one ParkingStation? Is exactly this that we get from the Data Provider?

dulvui commented 4 months ago

@rcavaliere Great! From the API we get two Parking Facilities: Bolzano and Bressanone, but the actual data for the ParkingStation only for Bolzano. Bressanone still has no data and here you can see the response I get:

{
  "ContentEncoding": null,
  "ContentType": null,
  "Data": {
    "Status": "OK",
    "FreePlaces": []
  },
  "JsonRequestBehavior": 0,
  "MaxJsonLength": null,
  "RecursionLimit": null
}

So no ParkingStation is created for Bressanone yet, but when the data arrives, the station will create automatically.

rcavaliere commented 4 months ago

@dulvui perfect! Work is here is completed, please wait my input before deploy on production

rcavaliere commented 4 months ago

Skidata should have now fixed the coordinates issue. @dulvui, why don't we see the data on the testing version of analytics? If the coordinates were hardcoded, let's adapt the Data Collector so to read them from the API

dulvui commented 4 months ago

@rcavaliere You are right they are hardcoded, because I don't know the name of the location field yet. But I still don't see any location in the data. Is there another call to make or a new endpoint? Here the response:

      {
        "IdCompany": 18,
        "FacilityId": 608612,
        "Description": "Parcheggio Stazione Brunico",
        "City": "Bolzano",
        "Address": "Via dei Conciapelli, 60",
        "ZIPCode": "39100",
        "Telephone1": null,
        "Telephone2": null,
        "PostNumber": 500,
        "ReceiptMerchant": "STA – Strutture Trasporto Alto Adige SpA Via dei Conciapelli, 60 39100  Bolzano UID: 00586190217",
        "Web": null
      },
      {
        "IdCompany": 19,
        "FacilityId": 607440,
        "Description": "Parcheggio Stazione Bressanone",
        "City": "Bressanone",
        "Address": "Via dei Conciapelli, 60",
        "ZIPCode": "39100",
        "Telephone1": null,
        "Telephone2": null,
        "PostNumber": 500,
        "ReceiptMerchant": "STA – Strutture Trasporto Alto Adige SpA Via dei Conciapelli, 60 39100  Bolzano UID: 00586190217",
        "Web": null
      },
rcavaliere commented 4 months ago

@dulvui thanks for the feedback, I will check with the Skidata supplier. Anyway, why is the data not visible on analytics.testingmachine.eu?

dulvui commented 4 months ago

@rcavaliere They are visible, I took a random position in Bolzano near ponte roma image

rcavaliere commented 3 months ago

@dulvui let's wait to have the contracts signed before publishing the Data Collector

clezag commented 1 month ago

@rcavaliere @dulvui I've noticed that currently the data collector fails because the request to the data provider does not return a JSON anymore, but a HTML login page instead. The Authorization token has an invalid signature, but I don't know if that's the reason why, or if it's always like that.

Can you check with the provider?

rcavaliere commented 1 month ago

@clezag thanks for the information, I will take care of this!