Initial commit for 0.0.1

This commit is contained in:
dpguthrie
2020-08-21 22:29:52 -06:00
commit b11c84fbde
31 changed files with 7205 additions and 0 deletions

8
bankfind/__init__.py Normal file
View File

@ -0,0 +1,8 @@
"""Python interface to the FDIC's API for publically available bank data"""
__version__ = '0.0.1'
from .main import (get_failures, get_history, get_institutions, # noqa
get_locations, get_summary)
from .metadata import meta_dict # noqa

131
bankfind/base.py Normal file
View File

@ -0,0 +1,131 @@
from io import StringIO
import urllib.parse
import pandas as pd
import requests
from requests.models import Response
from bankfind.metadata import meta_dict
class BF:
DEFAULTS = {
'institutions': {
'sort_by': 'OFFICES',
'sort_order': 'ASC',
'limit': 10000,
'offset': 0,
'format': 'json',
'search': True
},
'locations': {
'sort_by': 'NAME',
'sort_order': 'ASC',
'limit': 10000,
'offset': 0,
'format': 'json',
'search': False
},
'history': {
'sort_by': 'PROCDATE',
'sort_order': 'DESC',
'limit': 10000,
'offset': 0,
'format': 'json',
'search': True
},
'summary': {
'sort_by': 'YEAR',
'sort_order': 'DESC',
'limit': 10000,
'offset': 0,
'format': 'json',
'search': False
},
'failures': {
'sort_by': 'FAILDATE',
'sort_order': 'DESC',
'limit': 10000,
'offset': 0,
'format': 'json',
'search': False
}
}
def __init__(self):
pass
def _construct_params(
self,
key: str,
filters: str = None,
search: str = None,
**kwargs):
d = self.DEFAULTS[key]
params = {
'sort_by': kwargs.get('sort_by', d['sort_by']),
'sort_order': kwargs.get(
'sort_order', d['sort_order']),
'limit': kwargs.get('limit', d['limit']),
'offset': kwargs.get('offset', d['offset']),
'format': 'csv' if kwargs.get('output') == 'pandas' else 'json',
'download': 'false',
'fields': kwargs.get(
'fields', ','.join(list(meta_dict[key].keys())))
}
if filters:
params.update({'filters': filters})
if search and d['search']:
params.update({'search': search})
return params
def _friendly_fields(self, key, data, dataframe=True):
meta = meta_dict[key]
if isinstance(data, list):
data = pd.DataFrame([i['data'] for i in data])
data.columns = data.columns.map(
dict((k, meta[k]['title'])
for k in meta.keys() if k in data.columns))
if dataframe:
return data
return data.to_dict(orient='records')
def _to_json(
self,
key: str,
response: Response,
friendly_fields: bool = False):
json_data = response.json()
if friendly_fields:
json_data['data'] = self._friendly_fields(
key, json_data['data'], dataframe=False)
else:
json_data['data'] = [i['data'] for i in json_data['data']]
return json_data
def _to_pandas(
self,
key: str,
response: Response,
friendly_fields: bool = False):
df = pd.read_csv(StringIO(response.text))
if friendly_fields:
df = self._friendly_fields(key, df)
return df
def _get_data(
self,
key: str,
filters: str = None,
search: str = None,
**kwargs):
params = self._construct_params(key, filters, search, **kwargs)
r = requests.get(
f"https://banks.data.fdic.gov/api/{key}",
params=urllib.parse.urlencode(params)
)
if r.ok:
return getattr(self, f"_to_{kwargs.get('output', 'json')}")(
key, r, kwargs.get('friendly_fields', False))
return r

154
bankfind/main.py Normal file
View File

@ -0,0 +1,154 @@
from bankfind.base import BF
def get_failures(filters: str = None, **kwargs):
"""
Detail on failed financial institutions
Arguments
---------
filters: str, default None, optional
Filter for the bank search
Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
format: str, default json, optional
Format of the data to return
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("failures", filters, **kwargs)
def get_history(filters: str = None, search: str = None, **kwargs):
"""
Detail on structure change events
Arguments
---------
filters: str, default None, optional
Filter for the bank search
search: str
Flexible text search against institution records. Currently, only
supports name search. Text search and fuzzy matching is supported
as well.
Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
output: str, default json, optional
Format of the data to return, json or pandas
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("history", filters, search, **kwargs)
def get_institutions(filters: str = None, search: str = None, **kwargs):
"""
List of financial institutions
Arguments
---------
filters: str, default None, optional
Filter for the bank search
search: str
Flexible text search against institution records. Currently, only
supports name search. Text search and fuzzy matching is supported
as well.
Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
format: str, default json, optional
Format of the data to return
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("institutions", filters, search, **kwargs)
def get_locations(filters: str = None, **kwargs):
"""
List of locations / branches of financial institutions
Arguments
---------
filters: str, default None, optional
Filter for the bank search
Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
format: str, default json, optional
Format of the data to return
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("locations", filters, **kwargs)
def get_summary(filters: str = None, **kwargs):
"""
Aggregate financial and structure data, subtotaled by year
Arguments
---------
filters: str, default None, optional
Filter for the bank search
Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
format: str, default json, optional
Format of the data to return
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("summary", filters, **kwargs)

View File

@ -0,0 +1,14 @@
from .failure import failure_dict
from .history import history_dict
from .institution import institution_dict
from .location import location_dict
from .summary import summary_dict
meta_dict = {
'failures': failure_dict,
'history': history_dict,
'institutions': institution_dict,
'locations': location_dict,
'summary': summary_dict
}

View File

@ -0,0 +1,93 @@
failure_dict = {
'NAME': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Institution Name',
'description': "This is the legal name of the institution. When available, the Institution's name links to useful information for the customers and vendors of these institutions. This information includes press releases, information about the acquiring institution, (if applicable), how your accounts and loans are affected, and how vendors can file claims against the receivership."
},
'CERT': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Cert',
'description': 'The certificate number assigned by the FDIC used to identify institutions and for the issuance of insurance certificates. By clicking on this number, you will link to the Institution Directory (ID) system which will provide the last demographic and financial data filed by the selected institution.'
},
'FIN': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'FIN',
'description': 'Financial Institution Number (FIN) is a unique number assigned to the institution as an Assistance Agreement, Conservatorship, Bridge Bank or Receivership.'
},
'CITYST': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Location',
'description': 'The city and state (or territory) of the headquarters of the institution.'
},
'FAILDATE': {
'type': 'string',
'format': 'date-time',
'title': 'Effective Date',
'description': 'The date that the failed / assisted institution ceased to exist as a privately held going concern. For institutions that entered into government ownership, such as FDIC Bridge Banks and RTC conservatorships, this is the date that they entered into such ownership.'
},
'FAILYR': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Year',
'description': 'The 4-digit year that the failed / assisted institution ceased to exist as a privately held going concern. For institutions that entered into government ownership, such as FDIC Bridge Banks and RTC conservatorships, this is the date that they entered into such ownership.'
},
'SAVR': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Insurance Fund',
'description': 'Before 1989, there were two federal deposit insurance funds, one administered by the FDIC, which insured deposits in commercial banks and state-chartered savings banks, and another administered by the Federal Savings and Loan Insurance Corporation (FSLIC), which insured deposits in state- and federally-chartered savings associations. In 1989, the Financial Institutions Reform, Recovery and Enforcement Act (FIRREA) specified that thereafter the FDIC would be the federal deposit insurer of all banks and savings associations and would administer both the FDIC fund, which was renamed the Bank Insurance Fund (BIF) and the replacement for the insolvent FSLIC fund, which was called the Savings Association Insurance Fund (SAIF). Although it was created in 1989, the SAIF was not responsible for savings association failures until 1996. From 1989 through 1995, savings association failures were the responsibility of the Resolution Trust Corporation (RTC). In February 2006, The Federal Deposit Insurance Reform Act of 2005 provided for the merger of the BIF and the SAIF into a single Deposit Insurance Fund (DIF). Necessary technical and conforming changes to the law were made under The Federal Deposit Insurance Reform Conforming Amendments Act of 2005. The merger of the funds was effective on March 31, 2006. For additional information about deposit insurance fund and legislation, go to http://www.fdic.gov/deposit/insurance/index.html.',
'options': ['BIF', 'RTC', 'FSLIC', 'SAIF', 'DIF', 'FDIC']
},
'RESTYPE1': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Transaction Type',
'description': "Institutions have been resolved through several different types of transactions. The transaction types outlined below can be grouped into three general categories, based upon the method employed to protect insured depositors and how each transaction affects a failed / assisted institution's charter. In most assistance transactions, insured and uninsured depositors are protected, the failed / assisted institution remains open and its charter survives the resolution process. In purchase and assumption transactions, the failed / assisted institution's insured deposits are transferred to a successor institution, and its charter is closed. In most of these transactions, additional liabilities and assets are also transferred to the successor institution. In payoff transactions, the deposit insurer - the FDIC or the former Federal Savings and Loan Insurance Corporation - pays insured depositors, the failed / assisted institution's charter is closed, and there is no successor institution. For a more complete description of resolution transactions and the FDIC's receivership activities, see Managing the Crisis: The FDIC and RTC Experience, a study prepared by the FDIC's Division of Resolutions and Receiverships. Copies are available from the FDIC's Public Information Center.\nCategory 1 - Institution's charter survives\nA/A\t- Assistance Transactions. These include: 1) transactions where assistance was provided to the acquirer, who purchased the entire institution. For a few FSLIC transactions, the acquirer purchased the entire bridge bank - type entity, but certain other assets were moved into a liquidating receivership prior to the sale, and 2) open bank assistance transactions, including those where assistance was provided under a systemic risk determination (in such cases any costs that exceed the amounts estimated under the least cost resolution requirement would be recovered through a special assessment on all FDIC-insured institutions).\nREP -\tReprivatization, management takeover with or without assistance at takeover, followed by a sale with or without additional assistance.\nCategory 2 - Institution's charter is terminated, insured deposits plus some assets and other liabilities are transferred to a successor charter\nP&A - Purchase and Assumption, where some or all of the deposits, certain other liabilities and a portion of the assets (sometimes all of the assets) were sold to an acquirer. It was not determined if all of the deposits (PA) or only the insured deposits (PI) were assumed.\nPA - Purchase and Assumption, where the insured and uninsured deposits, certain other liabilities and a portion of the assets were sold to an acquirer.\nPI - Purchase and Assumption of the insured deposits only, where the traditional P&A was modified so that only the insured deposits were assumed by the acquiring institution.\nIDT - Insured Deposit Transfer, where the acquiring institution served as a paying agent for the insurer, established accounts on their books for depositors, and often acquired some assets as well. Includes ABT (asset-backed transfer, a FSLIC transaction that is very similar to an IDT).\nMGR - An institution where FSLIC took over management and generally provided financial assistance. FSLIC closed down before the institution was sold.\nCategory 3\nPO - Payout, where the insurer paid the depositors directly and placed the assets in a liquidating receivership. Note: Includes transactions where the FDIC established a Deposit Insurance National Bank to facilitate the payout process.",
'options': ['A/A', 'REP', 'P&A', 'PA', 'PI', 'IDT', 'MGR', 'PO']
},
'CHCLASS1': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Charter Class',
'description': "The FDIC assigns classification codes indicating an institution's charter type (commercial bank, savings bank, or savings association), its chartering agent (state or federal government), its Federal Reserve membership status (member or nonmember), and its primary federal regulator (state-chartered institutions are subject to both federal and state supervision). These codes are:\nN - National chartered commercial bank supervised by the Office of the Comptroller of the Currency;\nSM - State charter Fed member commercial bank supervised by the Federal Reserve;\nNM - State charter Fed nonmember commercial bank supervised by the FDIC;\nSA - State or federal charter savings association supervised by the Office of Thrift Supervision or Office of the Comptroller of the Currency;\nSB - State charter savings bank supervised by the FDIC.",
'options': ['N', 'SM', 'NM', 'SA', 'SB']
},
'RESTYPE': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Resolution',
'description': 'The given institution has failure stature or it can be assistance has been provided by FDIC in merging with other institution.',
'options': ['Failure', 'Assistance']
},
'QBFDEP': {
'type': 'number',
'x-elastic-type': 'double',
'x-number-unit': 'Thousands of US Dollars',
'title': 'Total Deposits',
'description': 'Total including demand deposits, money market deposits, other savings deposits, time deposits and deposits in foreign offices as of the last Call Report or Thrift Financial Report filed by the institution prior to the effective date. Note this does not necessarily reflect total deposits on the last report filed because in some cases reports were filed after the effective date.'
},
'QBFASSET': {
'type': 'number',
'x-elastic-type': 'double',
'x-number-unit': 'Thousands of US Dollars',
'title': 'Total Assets',
'description': 'The Total assets owned by the institution including cash, loans, securities, bank premises and other assets as of the last Call Report or Thrift Financial Report filed by the institution prior to the effective date. Note this does not necessarily reflect total assets on the last report filed because in some cases reports were filed after the effective date. This total does not include off-balance-sheet accounts.'
},
'COST': {
'type': 'number',
'x-elastic-type': 'double',
'x-number-unit': 'Thousands of US Dollars',
'title': 'Estimated Loss',
'description': 'The estimated loss is the difference between the amount disbursed from the Deposit Insurance Fund (DIF) to cover obligations to insured depositors and the amount estimated to be ultimately recovered from the liquidation of the receivership estate. Estimated losses reflect unpaid principal amounts deemed unrecoverable and do not reflect interest that may be due on the DIF\'s administrative or subrogated claims should its principal be repaid in full.\nNotes:\nComprehensive data on estimated losses are not available for FDIC-insured failures prior to 1986, or for FSLIC-insured failures from 1934-88. Estimated loss is presented as "N/A" in years for which comprehensive information is not available.\nEstimated Loss data was previously referred to as \'Estimated Cost\' in past releases of the Historical Statistic on Banking. For RTC receiverships, the \'Estimated Cost\' included an allocation of FDIC corporate revenue and expense items such as interest expense on Federal Financing Bank debt, interest expense on escrowed funds and interest revenue on advances to receiverships. Other FDIC receiverships did not include such an allocation. To maintain consistency with FDIC receiverships, the RTC allocation is no longer reflected in the estimated loss amounts for failed / assisted institutions that were resolved through RTC receiverships.\nBeginning with the release of 2007 information, the \'Estimated Loss\' in the Historical Statistics on Banking is presented and defined consistently with the aggregate Estimated Receivership Loss for FRF-RTC institutions and Estimated Losses for FDIC receiverships that are reported in the FDIC\'s Annual Report. The estimated loss is obtained from the FDIC\'s Failed Bank Cost Analysis (FBCA) report and the RTC Loss report. The FBCA provides data for receiverships back to 1986. The RTC Loss Report provides similar data back to 1989. \nQuestions regarding Estimated Loss should be sent to DOFBusinessCenter@fdic.gov. \nAlso, for more detail regarding resolution transactions and the FDIC\'s receivership activities, see Managing the Crisis: The FDIC and RTC Experience, a historical study prepared by the FDIC\'s Division of Resolutions and Receiverships. Copies are available from the FDIC\'s Public Information Center.'
},
'PSTALP': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'State',
'description': 'Two-character alphanumeric code for US state or Territory'
}
}

2108
bankfind/metadata/history.py Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,348 @@
location_dict = {
'ADDRESS': {
'type': 'string',
'title': 'Branch Address',
'description': 'Street address at which the branch is physically located.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'LOCN_PHY_LNE1_TXT'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'LOCN_ADDR_LNE1_TXT'
}]
},
'BKCLASS': {
'type': 'string',
'title': 'Institution Class',
'description': "A classification code assigned by the FDIC based on the institution''s charter type (commercial bank or savings institution), charter agent (state or federal), Federal Reserve membership status (Fed member, Fed nonmember) and its primary federal regulator (state chartered institutions are subject to both federal and state supervision). N - Commercial bank, national (federal) charter and Fed member, supervised by the Office of the Comptroller of the Currency (OCC); NM - Commercial bank, state charter and Fed nonmember, supervised by the FDIC; OI - Insured U.S. branch of a foreign chartered institution (IBA); SA - Savings associations, state or federal charter, supervised by the Office of Thrift Supervision (OTS); SB - Savings banks, state charter, supervised by the FDIC; SM - Commercial bank, state charter and Fed member, supervised by the Federal Reserve (FRB)",
'options': ['N', 'NM', 'OI', 'SA', 'SB', 'SM'],
'x-source-mapping': [{
'formula': {
'type': 'raw',
'parameters': {
'script': 'if(ctx.INST_CLASS_CDE?.toLowerCase() == "sb" || ctx.INST_CLASS_CDE?.toLowerCase() == "sl") { \n ctx.BKCLASS = \'SA\'; \n} else if (ctx.INST_CLASS_CDE?.toLowerCase() == "mi" || ctx.INST_CLASS_CDE?.toLowerCase() == "si") { \n ctx.BKCLASS = \'SB\';\n} else {\n ctx.BKCLASS = ctx.INST_CLASS_CDE;\n}\n'
}
}
}]
},
'CBSA': {
'type': 'string',
'title': 'Core Based Statistical Area Name (Branch)',
'description': 'Name of the Core Based Statistical Area (CBSA) as defined by the US Census Bureau Office of Management and Budget.',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CBSANAME'
}]
},
'CBSA_DIV': {
'type': 'string',
'title': 'Metropolitan Divisions Name (Branch)',
'description': 'Name of the Core Based Statistical Division as defined by the US Census Bureau Office of Management and Budget.',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CBSA_DIV_NAME'
}]
},
'CBSA_DIV_FLG': {
'type': 'string',
'title': 'Metropolitan Divisions Flag (Branch)',
'description': 'A flag (1=Yes) indicating member of a Core Based Statistical Division as defined by the US Census Bureau Office of Management and Budget.',
'options': [0, 1],
'x-source-mapping': [{
'file': 'RELATION',
'field': 'DIVISION_FLAG'
}]
},
'CBSA_DIV_NO': {
'type': 'string',
'title': 'Metropolitan Divisions Number (Branch)',
'description': 'Numeric code of the Core Based Statistical Division as defined by the US Census Bureau Office of Management and Budget.',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CBSA_DIVISION'
}]
},
'CBSA_METRO': {
'type': 'string',
'title': 'Metropolitan Division Number (Branch)',
'description': 'Numeric code of the Metropolitan Statistical Area as defined by the US Census Bureau Office of Management and Budget',
'x-source-mapping': [{
'formula': {
'type': 'raw',
'parameters': {
'script': 'if(ctx.CBSA_METRO_FLG == "1") {\n ctx.CBSA_METRO = ctx.CBSA_NO;\n} else {\n ctx.CBSA_METRO = 0;\n} \n'
}
}
}]
},
'CBSA_METRO_FLG': {
'type': 'string',
'title': 'Metropolitan Division Flag (Branch)',
'description': 'A flag (1=Yes) used to indicate whether an branch is in a Metropolitan Statistical Area as defined by the US Census Bureau Office of Management and Budget',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'METRO_FLAG'
}]
},
'CBSA_METRO_NAME': {
'type': 'string',
'title': 'Metropolitan Division Name (Branch)',
'description': 'Name of the Metropolitan Statistical Area as defined by the US Census Bureau Office of Management and Budget',
'x-source-mapping': [{
'formula': {
'type': 'raw',
'parameters': {
'script': 'if(ctx.CBSA_METRO_FLG == "1") {\n ctx.CBSA_METRO_NAME = ctx.CBSA;\n} else {\n ctx.CBSA_METRO_NAME = 0;\n}\n'
}
}
}]
},
'CBSA_MICRO_FLG': {
'type': 'string',
'title': 'Micropolitan Division Flag (Branch)',
'description': 'A flag (1=Yes) used to indicate whether an branch is in a Micropolitan Statistical Area as defined by the US Census Bureau Office of Management and Budget',
'options': [0, 1],
'x-source-mapping': [{
'file': 'RELATION',
'field': 'MICRO_FLAG'
}]
},
'CBSA_NO': {
'type': 'string',
'title': 'Core Based Statistical Areas (Branch)',
'description': 'Numeric code of the Core Based Statistical Area (CBSA) as defined by the US Census Bureau Office of Management and Budget.',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CBSA'
}]
},
'CERT': {
'type': 'string',
'title': 'Institution FDIC Certificate #',
'description': 'A unique number assigned by the FDIC used to identify institutions and for the issuance of insurance certificates.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'ORG_CERT_NUM'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'ORG_CERT_NUM'
}]
},
'CITY': {
'type': 'string',
'title': 'Branch City',
'description': 'City in which branch is physically located.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'LOCN_PHY_CTY_NME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'LOCN_CTY_NME'
}]
},
'COUNTY': {
'type': 'string',
'title': 'Branch County',
'description': 'County where the branch is physically located.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'LOCN_PHY_CNTY_NME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'LOCN_CNTY_NME'
}]
},
'CSA': {
'type': 'string',
'title': 'Combined Statistical Area Name (Branch)',
'description': 'Name of the Combined Statistical Area (CSA) as defined by the US Census Bureau Office of Management and Budget',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CSANAME'
}]
},
'CSA_FLG': {
'type': 'string',
'title': 'Combined Statistical Area Flag (Branch)',
'description': 'Flag (1=Yes) indicating member of a Combined Statistical Area (CSA) as defined by the US Census Bureau Office of Management and Budget',
'options': [0, 1],
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CSA_FLAG'
}]
},
'CSA_NO': {
'type': 'string',
'title': 'Combined Statistical Area Number (Branch)',
'description': 'Numeric code of the Combined Statistical Area (CSA) as defined by the US Census Bureau Office of Management and Budget',
'x-source-mapping': [{
'file': 'RELATION',
'field': 'CSA'
}]
},
'ESTYMD': {
'type': 'string',
'format': 'date-time',
'title': 'Branch Established Date',
'description': 'The date on which the branch began operations.',
'x-source-mapping': [{
'formula': {
'type': 'date',
'parameters': {
'inputFormat': "yyyy-MM-dd'T'HH:mm:ss",
'outputFormat': 'MM/dd/yyyy',
'inputField': 'ESTYMD_RAW',
'outputField': 'ESTYMD'
}
}
}]
},
'FI_UNINUM': {
'type': 'string',
'title': 'FDIC UNINUM of the Owner Institution',
'description': 'This is the FDIC UNINUM of the institution that owns the branch. A UNINUM is a unique sequentially number added to the FDIC database for both banks and branches. There is no pattern imbedded within the number. The FI_UNINUM is updated with every merger or purchase of branches to reflect the most current owner.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'ORG_UNIQ_NUM'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'FI_ORG_UNIQ_NUM'
}]
},
'MAINOFF': {
'type': 'number',
'title': 'Main Office',
'description': 'Flag (1=Yes) indicating this location is the main office for the institution.',
'options': [0, 1],
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'MAINOFF'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'MAINOFF'
}]
},
'NAME': {
'type': 'string',
'x-elastic-type': 'keyword',
'title': 'Institution Name',
'description': 'Legal name of the FDIC Insured Institution',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'INST_FIN_LGL_NME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'INST_FIN_LGL_NME'
}]
},
'OFFNAME': {
'type': 'string',
'title': 'Office Name',
'description': 'Name of the branch.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'INST_FIN_LGL_NME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'INST_BR_NME'
}]
},
'OFFNUM': {
'type': 'string',
'title': 'Branch Number',
'description': "The branch's corresponding office number.",
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'OFFNUM'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'INST_BR_OFC_NUM'
}]
},
'RUNDATE': {
'type': 'string',
'format': 'date-time',
'title': 'Run Date',
'description': 'The day the institution information was updated.',
'x-source-mapping': [{
'formula': {
'type': 'simpleSetScript',
'parameters': {
'setField': 'RUNDATE',
'script': 'new SimpleDateFormat("MM/dd/yyyy").format(new Date())'
}
}
}]
},
'SERVTYPE': {
'type': 'number',
'title': 'Service Type Code',
'description': 'Define the various types of offices of FDIC-insured institutions. 11 - Full Service Brick and Mortar Office; 12 - Full Service Retail Office; 13 - Full Service Cyber Office; 14 - Full Service Mobile Office; 15 - Full Service Home/Phone Banking; 16 - Full Service Seasonal Office; 21 - Limited Service Administrative Office; 22 - Limited Service Military Facility; 23 - Limited Service Facility Office; 24 - Limited Service Loan Production Office; 25 - Limited Service Consumer Credit Office; 26 - Limited Service Contractual Office; 27 - Limited Service Messenger Office; 28 - Limited Service Retail Office; 29 - Limited Service Mobile Office; 30 - Limited Service Trust Office;',
'options': [11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'SERVTYPE'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'INST_BR_SVC_NUM'
}]
},
'STALP': {
'type': 'string',
'title': 'Branch State Abbreviation',
'description': 'State abbreviation in which the branch is physically located. The FDIC Act defines state as any State of the United States, the District of Columbia, and any territory of the United States, Puerto Rico, Guam, American Samoa, the Trust Territory of the Pacific Islands, the Virgin Island, and the Northern Mariana Islands.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'LOCN_PHY_ST_ABNME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'LOCN_ST_ABBV_NME'
}]
},
'STCNTY': {
'type': 'string',
'title': 'State and County Number',
'description': 'A five digit number representing the state and county in which the institution is physically located. The first two digits represent the FIPS state numeric code and the last three digits represent the FIPS county numeric code.',
'x-source-mapping': [{
'file': 'CALCULATED_IN_PIPELINE',
'field': 'N/A'
}]
},
'STNAME': {
'type': 'string',
'title': 'Branch State',
'description': 'State in which the branch is physically located. The FDIC Act defines state as any State of the United States, the District of Columbia, and any territory of the United States, Puerto Rico, Guam, American Samoa, the Trust Territory of the Pacific Islands, the Virgin Island, and the Northern Mariana Islands.',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'LOCN_PHY_ST_NME'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'LOCN_ST_NME'
}]
},
'UNINUM': {
'type': 'string',
'title': 'Unique Identification Number for a Branch Office',
'description': 'Unique Identification Number for a Branch Office as assigned by the FDIC',
'x-source-mapping': [{
'file': 'VINST_FIN_CUR_SDC',
'field': 'ORG_UNIQ_NUM'
}, {
'file': 'VINST_BR_CUR_SDC',
'field': 'ORG_UNIQ_NUM'
}]
},
'ZIP': {
'type': 'string',
'title': 'Branch Zip Code',
'description': 'The first five digits of the full postal zip code representing physical location of the branch.',
'x-source-mapping': [{
'formula': {
'type': 'raw',
'parameters': {
'script': "if (ctx.ZIP_RAW != null && ctx.ZIP_RAW?.length() < 5){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < 5; i++) {\n sb.append('0');\n }\n ctx.ZIP = sb.substring(ctx.ZIP_RAW.length()) + ctx.ZIP_RAW;\n} else {\n ctx.ZIP = ctx.ZIP_RAW;\n}"
}
}
}]
}
}

1178
bankfind/metadata/summary.py Normal file

File diff suppressed because it is too large Load Diff