Closed agamsol closed 2 years ago
May I ask from where do you crawl the data?
Hi @agamsol,
The cities.js
utility scrapes the cities data from the HFC website JSON files (in both Hebrew & English):
https://www.oref.org.il/Shared/Ajax/GetCitiesMix.aspx?lang=he https://www.oref.org.il/Shared/Ajax/GetCitiesMix.aspx?lang=en
Could you tell me what does id
represent in the alert.json
provided from Pikud Haoref?
Here is a alert response from about 2 days ago
{
"id": "133024095050000000",
"cat": "1",
"title": "ירי רקטות וטילים",
"data": [
"אחוזם"
],
"desc": "היכנסו למרחב המוגן ושהו בו 10 דקות"
}
I couldn't find any explanation for any of the ID's although I can assume what they belong to, except for the id
and cat
Hi @agamsol, It is most likely a unique auto-incrementing database identifier which Pikud Haoref assigns to every new alert. You can make use of this field to keep track of whether you have seen this alert before, or if it's the first time.
So after the alert.json
indicates that there is a threat
I need to save the ID and keep checking if it has been changed in alert.json
and if the new Alert's ID does not match the previous ID it indicates a new threat (at a short time since last threat)?
Hi @agamsol,
Correct. If the ID changes for the same areas indicated in data
it indicates a new alert for those areas.
but when the ID changes it should overwrite the existing cities in the DATA array no? there is no case where the DATA has been updated and the ID remains the same?
Hi @agamsol,
The ID is different on a per-alert basis. Every element in the alerts.json
array has a unique ID which you can use to track whether you have processed the individual alert before.
If I wanted to update citiesArchive.js
, what file do I need to launch in order to generate the latest file?
Hi @agamsol,
I've just updated it 2 days ago, there haven't been any changes since.
However, example/cities.js
is the file to run.
Thank you very much, I really appreciate everything!
By any chance, do you know all of the possible values for title
inside the alerts.json
file?
Quick debug showed this:
although I want to make sure this is what it can provide, for example- I know it can provide חדירת מחבלים
which doesn't show in the image above
Hi @agamsol, Sorry, I do not know the full list of possible values for this field.
Hi @agamsol, Thanks for bringing this to my attention. The HFC has indeed made modifications to both the city and zone names.
The cities
json
file has been updated in this commit. I will be releasing updates to the Android & iOS app with the new cities & zones published by the HFC.