code-gov-api icon indicating copy to clipboard operation
code-gov-api copied to clipboard

Add endpoint for exposing the code.json file

Open IanLee1521 opened this issue 6 years ago • 6 comments

It would be great to add an endpoint to the REST API to enable an end user to get the full code.json file for all the federal agencies. That would allow comparisons against the data from agencies.

For instance, I am interesting in comparing Federal wide information to the data at DOECode. Additionally, I have am investigating other integrations with, for instance, GitHub.com/llnl/scraper

IanLee1521 avatar Mar 07 '18 17:03 IanLee1521

@IanLee1521 this already exists. The endpoint /status/{agencyName}/fetched returns the code.json that was fetched in our last harvest.

You can try it out here. You do not need an API key to view this endpoint.

I will admit that the endpoint and the description in the swagger docs aren't descriptive enough to let you know their functionality. I'll keep this issue open and work on making them better.

froi avatar Mar 22 '18 00:03 froi

I'll add another thing to this. The endpoint signature should say {agencyAcronym not {agencyName}.

Eg. curl -X GET https://api.code.gov/status/GSA/fetched

I've taken note of it and will be fixing this as well.

froi avatar Mar 22 '18 00:03 froi

Thanks @froi -- Is there (could there be) a similar endpoint for pulling the / a combined code.json file?

IanLee1521 avatar Mar 22 '18 17:03 IanLee1521

There could be but it isn't on our roadmap. We used something similar to that for our front-end when it wasn't using the API. You can take a look at an example here. Keep in mind that this file is 4 months out of date.

The file was created by the code-gov-harvester. You could run it yourself and reproduce the file if you think it might be useful to you.

froi avatar Mar 22 '18 17:03 froi

Got it. Perhaps that would be a good feature request to add into https://github.com/llnl/scraper to handle creating that...?

As an aside, do you have a static list of the agencyAcronym's that you're using?

IanLee1521 avatar Mar 22 '18 17:03 IanLee1521

As an aside, do you have a static list of the agencyAcronym's that you're using?

Yes, agency_metadata.json. We follow whatever acronym the agencies are using in their code.json.

Eg.

{
    "id": 1,
    "name": "Department of Agriculture",
    "acronym": "USDA",
    "website": "https://usda.gov/",
    "codeUrl": "https://www.usda.gov/code.json",
    "fallback_file": "USDA.json",
    "requirements": {
      "agencyWidePolicy": 0.75,
      "openSourceRequirement": 0,
      "inventoryRequirement": 0,
      "schemaFormat": 0.5,
      "overallCompliance": 0
    },
    "complianceDashboard": true
}

Perhaps that would be a good feature request to add into https://github.com/llnl/scraper to handle creating that...?

I don't see why not.

Something to keep in mind is that our inventory includes non-open source projects as well. So if this feature is added to your project it would be awesome but would only include part of the agencies' inventory, unless you also use their code.json files. Does that make sense?

froi avatar Mar 22 '18 18:03 froi