You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
I am running the adaptation_detail = fs.adaptation.get_detail(search_items="Adaptation.txt", csv=True) command where "Adaptation.txt" is a file of search items. The .csv file successfully downloads and contains all objects, except for the "serving" array/dict. In the Wiki and data dictionary, I have not seen any instructions about how to manage this situation and access the "serving" object. Any guidance you can provide on this would be most appreciated! Thank you.
Thanks for finding that bug, looks like it wasn't being exported correctly in the CSV file.
I just made an update to the library (2.2.3) that should fix this issue. A pip install --upgrade fsf_api_access_python in your environment should pull in the new library (check that it installs 2.2.3) and export the adaptation CSVs correctly
Alternatively, if you're unable to update the library at the moment, in the 2.2.2 version of the library the serving data should be within the object returned when you run your code as a Python dict. You can use this to access the different serving locations as a temporary solution until you're able to update your library:
adaptation_detail = fs.adaptation.get_detail(search_items="Adaptation.txt", csv=True)
for ada in adaptation_detail:
print(ada.serving)
Hi @Lyetenth, thank you again for your help. I just ran the pip install --user --upgrade fsf_api_access_python command in Terminal, and re-ran adaptation_detail = fs.adaptation.get_detail(search_items="Adaptation.txt", csv=True). The .csv that returns in my output_data folder is the same as the previous one— no columns nor info on the "adaptation serving" object. The last three columns are returnPeriod, latitude, longitude.
The second alternative returned many lines, some example output below:
I'm not quite sure what this information represents, and am also not sure how to integrate the output from this print command with the .csv files produced by adaptation_detail. Do you have a recommendation for how to merge adaptation serving object data with the corresponding adaptation projects in a .csv format? Thank you again!
Re: The upgrade. Can you run pip list in your terminal and find the version for fsf_api_access_python? Let's check if it upgraded correctly (sometimes it doesn't upgrade for whatever reason). It should say fsf-api-access-python 2.2.3.
If it does say fsf-api-access-python 2.2.3, can you post an image of the full output of pip list? I can check the sub-libraries to see if one of them are incompatible.
Ex: In the example you posted {'property': 327, 'neighborhood': 4, 'zcta': 3, 'tract': 3, 'city': 2, 'county': 1, 'cd': 2, 'state': 1}, the input adaptation measure serves
327 properties
4 neighbourhoods
3 zcta
3 tracts
...
I don't know which adaptation measure you used as an input, but for example a levee built to stop tidal floods along a coastline would have an adaptation serving where it serves X number of properties and Y neighbourhoods, etc. I'm not sure if that's what you're asking for, let me know if that answers your question on what the information represents.
For merging the output object with the csv, if you're not too familiar with converting the objects to a csv file then it would probably be easier to try to get the library upgraded. Once it's at version 2.2.3, it should create a CSV file with the servings broken down like the image below:
Hi @Lyetenth, thanks again! Below is a screenshot of the output when I run pip list. Looks like I have version 2.2.3. Not sure what the issue is or if the sub-libraries are off.
Also, thank you for the clarification on the second point. That is very helpful. I guess I was wondering whether it was possible to have .csv output that shows the individual properties served by a specific adaptation project. For example, in the case above, I'm wondering if it's possible to identify the unique parcel IDs of the 327 properties served by the project, e.g. a .csv with 327 observations uniquely ID'ed by parcel, with a common project ID they're served by. I'm not sure if that makes sense or if it's possible, but that's what I was getting at.
This really is weird. The other libraries look good, and shouldn't be causing problems. Are you able to run adaptation.get_detail on just a single adaptation_id and see if it works on just this? Might be for some reason it's removing the columns that don't have any properties (?).
and post the resulting CSV file here to this google drive folder, I'll do a quick compare to see if something is still exporting incorrectly.
Could you also upload your Adaptation.txt to the same folder and I'll take a look at running that as well to see if I can pinpoint the bug.
For the use-case you mentioned, I don't think we have something to do that at this time (ie: "For the adaptation measure with ID Z, give me all the fsids that this adaptation measure covers) but I believe the engineering team aims to get property-level fsids into the API services some time in the future.
A brute-force and not-so-elegant solution is to run adaptation.get_detail_by_location on all of the property fsids in an area, and filter it to the ones that have the adaptation_id you want.
ie: Run adaptation.get_detail_by_location on all X property fsids and filter for only rows where adaptation_id = Z
Not very quick or elegant, but it would work while I see how far along the team is on getting the above implemented.
Hi @Lyetenth, thanks again for the clarification. I just uploaded the resulting .csv output from adaptation_summary = fs.adaptation.get_detail(search_items=[13], csv=True), as well as my "Adaptation1.txt" file. Please let me know if there's anything I'm doing wrong on my end that is causing the "Adaptation Serving" object to be excluded.
Thank you as well for providing this info about accessing records showing the adaptation measure(s) each property is covered by (or vice versa). I'll give the brute-force method a try, and if it's not too cumbersome or time-consuming, I'll let you know how it goes. Also if you find out the engineering team's timeline re: property-level FSIDs, I'd be grateful for that info as well.
@Lyetenth also, I noticed in your screenshot above you have "latitude" and "longitude" data for Lockington Dam & Reservoir. In my download from the API, the Lockington Dam & Reservoir records (both dam and detention pond) have "NA" values for the "latitude" and "longitude" columns. In total, of the 16,800+ climate adaptation project records I've downloaded, <50 have latitude and longitude data. The overwhelming majority have "NA." Do you think this is an error?
One last thing— the data dictionary and Wiki don't mention this, so I'm assuming data like this aren't currently available, but I was wondering if the API makes (or has plans to make) any info available describing the date or time period when adaptation projects were completed? Guessing the answer is "no," but asking just to be 100% sure.
Hi @Lyetenth, thanks again for your help getting this sorted. Really appreciate it. Was able to download a CSV with the lat/longs.
On a slightly different topic, I was in today's FSF webinar, and Mike Kaminski mentioned First Street provides info on the original data source of the adaptation project (e.g., Army Corps, FEMA, etc.). Similar to the lat/long issue, the CSV that downloads after running fs.adaptation.get_detail_by_location for me doesn't contain any info on original data source. Do you think this is another sub-library or environment issue? Any additional guidance would be appreciated. Thanks!
The API currently does not currently export the data sources for adaptation projects so it makes sense for there to not be any data in the export CSV file. Let me see if there are any plans to add this data to the API
Hi @Lyetenth gotcha, thanks for clarifying. I understand if it's only available internally. If there are any plans to add this data to the API, please let me know! Thanks again for your help.
Activity
Lyetenth commentedon Jan 29, 2021
Hey @Steve-Koller,
Thanks for finding that bug, looks like it wasn't being exported correctly in the CSV file.
I just made an update to the library (2.2.3) that should fix this issue. A
pip install --upgrade fsf_api_access_pythonin your environment should pull in the new library (check that it installs 2.2.3) and export the adaptation CSVs correctlyAlternatively, if you're unable to update the library at the moment, in the 2.2.2 version of the library the
servingdata should be within the object returned when you run your code as a Python dict. You can use this to access the different serving locations as a temporary solution until you're able to update your library:Let me know if either solution works
Steve-Koller commentedon Feb 2, 2021
Hi @Lyetenth, thank you again for your help. I just ran the
pip install --user --upgrade fsf_api_access_pythoncommand in Terminal, and re-ranadaptation_detail = fs.adaptation.get_detail(search_items="Adaptation.txt", csv=True). The .csv that returns in my output_data folder is the same as the previous one— no columns nor info on the "adaptation serving" object. The last three columns are returnPeriod, latitude, longitude.The second alternative returned many lines, some example output below:
I'm not quite sure what this information represents, and am also not sure how to integrate the output from this
printcommand with the .csv files produced byadaptation_detail. Do you have a recommendation for how to merge adaptation serving object data with the corresponding adaptation projects in a .csv format? Thank you again!Lyetenth commentedon Feb 2, 2021
Hey @Steve-Koller,
Re: The upgrade. Can you run
pip listin your terminal and find the version forfsf_api_access_python? Let's check if it upgraded correctly (sometimes it doesn't upgrade for whatever reason). It should sayfsf-api-access-python 2.2.3.If it does say
fsf-api-access-python 2.2.3, can you post an image of the full output ofpip list? I can check the sub-libraries to see if one of them are incompatible.Re: The second question. The serving data returns the count of locations that the adaptation project is serving broken down by location type. (https://github.com/FirstStreet/fsf_api_access_python/wiki/Adaptation-Detail)
Ex: In the example you posted
{'property': 327, 'neighborhood': 4, 'zcta': 3, 'tract': 3, 'city': 2, 'county': 1, 'cd': 2, 'state': 1}, the input adaptation measure servesI don't know which adaptation measure you used as an input, but for example a levee built to stop tidal floods along a coastline would have an adaptation serving where it serves X number of properties and Y neighbourhoods, etc. I'm not sure if that's what you're asking for, let me know if that answers your question on what the information represents.
For merging the output object with the csv, if you're not too familiar with converting the objects to a csv file then it would probably be easier to try to get the library upgraded. Once it's at version 2.2.3, it should create a CSV file with the servings broken down like the image below:
Steve-Koller commentedon Feb 2, 2021
Hi @Lyetenth, thanks again! Below is a screenshot of the output when I run
pip list. Looks like I have version 2.2.3. Not sure what the issue is or if the sub-libraries are off.Also, thank you for the clarification on the second point. That is very helpful. I guess I was wondering whether it was possible to have .csv output that shows the individual properties served by a specific adaptation project. For example, in the case above, I'm wondering if it's possible to identify the unique parcel IDs of the 327 properties served by the project, e.g. a .csv with 327 observations uniquely ID'ed by parcel, with a common project ID they're served by. I'm not sure if that makes sense or if it's possible, but that's what I was getting at.
Really appreciate your help!

Lyetenth commentedon Feb 2, 2021
Hey @Steve-Koller,
This really is weird. The other libraries look good, and shouldn't be causing problems. Are you able to run
adaptation.get_detailon just a singleadaptation_idand see if it works on just this? Might be for some reason it's removing the columns that don't have any properties (?).If you can run
and post the resulting CSV file here to this google drive folder, I'll do a quick compare to see if something is still exporting incorrectly.
Could you also upload your
Adaptation.txtto the same folder and I'll take a look at running that as well to see if I can pinpoint the bug.For the use-case you mentioned, I don't think we have something to do that at this time (ie: "For the adaptation measure with ID Z, give me all the fsids that this adaptation measure covers) but I believe the engineering team aims to get property-level fsids into the API services some time in the future.
A brute-force and not-so-elegant solution is to run
adaptation.get_detail_by_locationon all of the property fsids in an area, and filter it to the ones that have theadaptation_idyou want.ie: Run
adaptation.get_detail_by_locationon all X property fsids and filter for only rows whereadaptation_id= ZNot very quick or elegant, but it would work while I see how far along the team is on getting the above implemented.
Steve-Koller commentedon Feb 5, 2021
Hi @Lyetenth, thanks again for the clarification. I just uploaded the resulting .csv output from
adaptation_summary = fs.adaptation.get_detail(search_items=[13], csv=True), as well as my "Adaptation1.txt" file. Please let me know if there's anything I'm doing wrong on my end that is causing the "Adaptation Serving" object to be excluded.Thank you as well for providing this info about accessing records showing the adaptation measure(s) each property is covered by (or vice versa). I'll give the brute-force method a try, and if it's not too cumbersome or time-consuming, I'll let you know how it goes. Also if you find out the engineering team's timeline re: property-level FSIDs, I'd be grateful for that info as well.
Thanks again!
Steve-Koller commentedon Feb 8, 2021
@Lyetenth also, I noticed in your screenshot above you have "latitude" and "longitude" data for Lockington Dam & Reservoir. In my download from the API, the Lockington Dam & Reservoir records (both dam and detention pond) have "NA" values for the "latitude" and "longitude" columns. In total, of the 16,800+ climate adaptation project records I've downloaded, <50 have latitude and longitude data. The overwhelming majority have "NA." Do you think this is an error?
One last thing— the data dictionary and Wiki don't mention this, so I'm assuming data like this aren't currently available, but I was wondering if the API makes (or has plans to make) any info available describing the date or time period when adaptation projects were completed? Guessing the answer is "no," but asking just to be 100% sure.
Thank you again!
Lyetenth commentedon Feb 11, 2021
Hey @Steve-Koller,
You should be able to see the lat / lngs values in the CSV now. Do a quick check and let me know if it's still NULL
Steve-Koller commentedon Feb 23, 2021
Hi @Lyetenth, thanks again for your help getting this sorted. Really appreciate it. Was able to download a CSV with the lat/longs.
On a slightly different topic, I was in today's FSF webinar, and Mike Kaminski mentioned First Street provides info on the original data source of the adaptation project (e.g., Army Corps, FEMA, etc.). Similar to the lat/long issue, the CSV that downloads after running
fs.adaptation.get_detail_by_locationfor me doesn't contain any info on original data source. Do you think this is another sub-library or environment issue? Any additional guidance would be appreciated. Thanks!Lyetenth commentedon Feb 24, 2021
Hi @Steve-Koller,
The API currently does not currently export the data sources for adaptation projects so it makes sense for there to not be any data in the export CSV file. Let me see if there are any plans to add this data to the API
Steve-Koller commentedon Feb 25, 2021
Hi @Lyetenth gotcha, thanks for clarifying. I understand if it's only available internally. If there are any plans to add this data to the API, please let me know! Thanks again for your help.