codeforamerica / naics-api

Basic API to return NAICS codes and information
BSD 3-Clause "New" or "Revised" License
95 stars 55 forks source link

Service Unavailable #32

Open elainethale opened 3 years ago

elainethale commented 3 years ago

I previously used this API by hitting the address http://naics.codeforamerica.org/. Trying to use it today, I see the address changed at some point to http://api.naics.us/. In any case, neither of those addresses are accessible at this moment. Is this a temporary issue, or is the service no longer available? If the latter, is there a suggested replacement?

Thanks for your help!

rusty02 commented 3 years ago

Same for me, http://naics.us is not working anymore. Has anyone found a reliable webservice for NAICS lookup?

twencl commented 3 years ago

I was about to do an implementation with this API but I guess that's on hold now.

geoffrey-eisenbarth commented 3 years ago

I'm pretty sure this project has been abandoned, as it seems like it was just part of a one time "Code for America" code-camp type situation. Both BEA and BLS offer NAICS definitions on their website, and it's not too bad to write a scraper to download the relevant information and store it to disk. NAICS updates every 5 years (and it's normally subtle updates), so it's that that bad.

Officially, I think OMB/Census Bureau maintain the NAICS, so they might have some good resources as well, although in my experience BEA/BLS was better organized for scraping.

NickCrews commented 2 years ago

I just scrounged through the javascript that's currently on https://www.census.gov/naics/ (perhaps look this up on web.archinve.org if it has disappeared by the time you're reading this), which is the US Census's current web interface for searching up NAICS codes, and I found the backend that they are using. As of today, here are some example requests that work!

https://www.census.gov/naics/resources/model/dataHandler.php?input=attorney&search=2022 gives

{
"individual": "false",
"year": "2022",
"numRows": 11,
"result": {
"1": {
"index_desc": "Attorneys' offices",
"naics22": "541110"
},
"2": {
"index_desc": "Attorneys' private practices",
"naics22": "541110"
},
"3": {
"index_desc": "Patent attorneys' offices",
"naics22": "541110"
},
"4": {
"index_desc": "Patent attorneys' private practices",
"naics22": "541110"
},
"5": {
"index_desc": "Tax law attorneys' offices",
"naics22": "541110"
},
"6": {
"index_desc": "Tax law attorneys' private practices",
"naics22": "541110"
},
"7": {
"index_desc": "Arbitration and conciliation services (except by attorney, paralegal)",
"naics22": "541990"
},
"8": {
"index_desc": "Mediation product services (except by lawyer, attorney, paralegal offices, family and social services)",
"naics22": "541990"
},
"9": {
"index_desc": "Attorney generals' offices",
"naics22": "922130"
},
"10": {
"index_desc": "District attorneys' offices",
"naics22": "922130"
},
"11": {
"index_desc": "U.S. attorneys' offices",
"naics22": "922130"
}
},
"code": "attorney",
"isNumeric": 0,
"isChart": 0,
"datatype": "search",
"connection": "connected"
}

and https://www.census.gov/naics/resources/model/dataHandler.php?search=2022&input=5411 gives

{
"individual": "false",
"query": "SELECT code,title,\r\n                     dbms_lob.substr(DESCRIPTION,4000,1) as description,\r\n                     dbms_lob.substr(DESCRIPTION,4000,4001) as extend \r\n              FROM \"A2022_TITLE_DESCRIPTION\"  order by code",
"year": "2022",
"numRows": 8,
"result": [
{
"code": "5411",
"title": "Legal Services<sup>T</sup>",
"description": "This industry group comprises establishments primarily engaged in offering legal services, such as those offered by offices of lawyers, offices of notaries, and title abstract and settlement offices, and paralegal services. \n"
},
{
"code": "54111",
"title": "Offices of Lawyers<sup>T</sup>",
"description": "See industry description for 541110.\n"
},
{
"code": "541110",
"title": "Offices of Lawyers",
"description": "This industry comprises offices of legal practitioners known as lawyers or attorneys (i.e., counselors-at-law) primarily engaged in the practice of law.  Establishments in this industry may provide expertise in a range or in specific areas of law, such as criminal law, corporate law, family and estate law, patent law, real estate law, or tax law.\n\nCross-References."
},
{
"code": "54112",
"title": "Offices of Notaries<sup>T</sup>",
"description": "See industry description for 541120.\n"
},
{
"code": "541120",
"title": "Offices of Notaries",
"description": "This industry comprises establishments (except offices of lawyers and attorneys) primarily engaged in drafting, approving, and executing legal documents, such as real estate transactions, wills, and contracts; and in receiving, indexing, and storing such documents.\n\nCross-References."
},
{
"code": "54119",
"title": "Other Legal Services<sup>T</sup>",
"description": "This industry comprises establishments of legal practitioners (except lawyers and attorneys) primarily engaged in providing specialized legal or paralegal services.\n\nIllustrative Examples:\n\nNotary public services\nProcess serving services\nParalegal services\t\nReal estate settlement offices\nPatent agent services (i.e., patent filing and searching services)\nReal estate title abstract companies\n\n\nCross-References."
},
{
"code": "541191",
"title": "Title Abstract and Settlement Offices",
"description": "This U.S. industry comprises establishments (except offices of lawyers and attorneys) primarily engaged in one or more of the following activities: (1) researching public land records to gather information relating to real estate titles; (2) preparing documents necessary for the transfer of the title, financing, and settlement; (3) conducting final real estate settlements and closings; and (4) filing legal and other documents relating to the sale of real estate.  Real estate settlement offices, title abstract companies, and title search companies are included in this industry.\n\nCross-References."
},
{
"code": "541199",
"title": "All Other Legal Services",
"description": "This U.S. industry comprises establishments of legal practitioners (except offices of lawyers and attorneys, settlement offices, and title abstract offices).  These establishments are primarily engaged in providing specialized legal or paralegal services.\n\nIllustrative Examples:\n\nNotary public services\nPatent agent services (i.e., patent filing and searching services)\nParalegal services\t\nProcess serving services\n\n\nCross-References."
}
],
"code": "5411",
"isNumeric": 1,
"isChart": 0,
"datatype": "search",
"connection": "connected"
}

I'm not at all familiar with this repo, but it looks at first glance like the census.gov has changed their API, so simply changing the endpoint to https://www.census.gov/naics/resources/model/dataHandler.php from http://api.naics.us/ won't work. But, hopefully this will be helpful to someone!

geoffrey-eisenbarth commented 2 years ago

For what it's worth, my new solution has been to download definitions from the BLS: www.bls.gov/cew/apps/bls_naics/2017_titles_descriptions.csv

Although, just now I checked and it seems like 2022_titles_descriptions.csv works for the latest NAICS.

NickCrews commented 2 years ago

For what it's worth, my new solution has been to download definitions from the BLS: www.bls.gov/cew/apps/bls_naics/2017_titles_descriptions.csv

This looks pretty good too and would work offline. I couldn't actually get the 2017 one, but swapping to 2022_titles_descriptions.csv worked.

Just a heads up, if I grep that file for "attorney" then I don't get the exact same matches as when I use https://www.census.gov/naics/resources/model/dataHandler.php, although they're quite close. Not sure if there's a different/better way to search that file given a query, that would make the two methods agree with each other.

tconwell commented 2 years ago

If you are looking for a live API, I made which has a keyword API search and uses the 2022 definitions. It's not on Github right now though.