<commit_before># HMDA Platform API

## Public HTTP Endpoints

* `/`
    * `GET` - Root endpoint, with information about the HMDA Platform service. Used for health checks

    Example response, with HTTP code 200:

    ```json
    {
      "status": "OK",
      "service": "hmda-api",
      "time": "2016-06-17T13:54:10.725Z",
      "host": "localhost"
    }
    ```

All endpoints in the `/institutions` namespace require two headers (see "Authorization" section below for more detail):
* `CFPB-HMDA-Username`, containing a string
* `CFPB-HMDA-Institutions`, containing a list of integers


* `/institutions`
    * `GET` - List of Financial Institutions

    Example response, with HTTP code 200:

    ```json
    {
      "institutions": [
        {
          "id": "12345",
          "name": "<NAME>",
          "status": "active"
        },
        {
          "id": "123456",
          "name": "<NAME>",
          "status": "inactive"
        }
      ]
    }
    ```

* `/institutions/<institution>`
    * `GET` - Details for Financial Institution

    Example response, with HTTP code 200:

    ```json
    {
      "institution": {
      "id": "12345",
      "name": "<NAME>",
      "status": "active"
    },
      "filings": [
        {
          "period": "2017",
          "institutionId": "12345",
          "status": {
            "code": 1,
            "message": "not-started"
          }
        },
        {
          "period": "2016",
          "institutionId": "12345",
          "status": {
            "code": 3,
            "message": "completed"
          }
        }
      ]
    }
    ```


* `/institutions/<institution>/filings/<period>`
    * `GET` - Details for a filing

    Example response, with HTTP code 200:

    ```json
   {
     "filing": {
     "period": "2017",
     "institutionId": "12345",
     "status": {
       "code": 1,
       "message": "not-started"
     }
   },
   "submissions": [
     {
       "id": 3,
       "status": {
         "code": 1,
         "message": "created"
       }
     },
     {
       "id": 2,
       "status": {
         "code": 1,
         "message": "created"
       }
     },
     {
       "id": 1,
       "status": {
         "code": 1,
         "message": "created"
       }
     }
   ]
   }
    ```

* `/institutions/<institution>/filings/<period>/submissions`

    * `POST` - Create a new submission

    Example response, with HTTP code 201:

    ```json
    {
        "id": 4,
        "status": {
          "code": 1,
          "message": "created"
        }
    }
    ```
    
* `/institutions/<institution>/filings/<period>/submissions/latest`

    * `GET` - The latest submission for some institution and period

     Example response, with HTTP code 200:
    
    ```json
    {
      "id": 3,
      "status": {
        "code": 1,
        "message": "created"
      }
    }
    ```

<commit_msg>update api.md to reflect the proper response of /institutions/0/filings/2016/submissions<commit_after># HMDA Platform API

## Public HTTP Endpoints

* `/`
    * `GET` - Root endpoint, with information about the HMDA Platform service. Used for health checks

    Example response, with HTTP code 200:

    ```json
    {
      "status": "OK",
      "service": "hmda-api",
      "time": "2016-06-17T13:54:10.725Z",
      "host": "localhost"
    }
    ```

All endpoints in the `/institutions` namespace require two headers (see "Authorization" section below for more detail):
* `CFPB-HMDA-Username`, containing a string
* `CFPB-HMDA-Institutions`, containing a list of integers


* `/institutions`
    * `GET` - List of Financial Institutions

    Example response, with HTTP code 200:

    ```json
    {
      "institutions": [
        {
          "id": "12345",
          "name": "<NAME>",
          "status": "active"
        },
        {
          "id": "123456",
          "name": "<NAME>",
          "status": "inactive"
        }
      ]
    }
    ```

* `/institutions/<institution>`
    * `GET` - Details for Financial Institution

    Example response, with HTTP code 200:

    ```json
    {
      "institution": {
      "id": "12345",
      "name": "<NAME>",
      "status": "active"
    },
      "filings": [
        {
          "period": "2017",
          "institutionId": "12345",
          "status": {
            "code": 1,
            "message": "not-started"
          }
        },
        {
          "period": "2016",
          "institutionId": "12345",
          "status": {
            "code": 3,
            "message": "completed"
          }
        }
      ]
    }
    ```


* `/institutions/<institution>/filings/<period>`
    * `GET` - Details for a filing

    Example response, with HTTP code 200:

    ```json
   {
     "filing": {
     "period": "2017",
     "institutionId": "12345",
     "status": {
       "code": 1,
       "message": "not-started"
     }
   },
   "submissions": [
     {
       "id": 3,
       "status": {
         "code": 1,
         "message": "created"
       }
     },
     {
       "id": 2,
       "status": {
         "code": 1,
         "message": "created"
       }
     },
     {
       "id": 1,
       "status": {
         "code": 1,
         "message": "created"
       }
     }
   ]
   }
    ```

* `/institutions/<institution>/filings/<period>/submissions`

    * `POST` - Create a new submission

    Example response, with HTTP code 201:

    ```json
    {
      "id": {
        "institutionId": "0",
        "period": "2016",
        "sequenceNumber": 1
      },
      "status": {
        "code": 1,
        "message": "created"
      }
    }
    ```
    
* `/institutions/<institution>/filings/<period>/submissions/latest`

    * `GET` - The latest submission for some institution and period

     Example response, with HTTP code 200:
    
    ```json
    {
      "id": 3,
      "status": {
        "code": 1,
        "message": "created"
      }
    }
    ```


{'fraction_non_alphanumeric': 0.16115912557193696, 'fraction_numerical': 0.03253685815963396, 'mean_word_length': 1.6091954022988506, 'pattern_counts': {'":': 109, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '59427', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1851, 'n_words': 445}