Parser for FTS files that accompany CMS data from ResDac
See also What is FTS for more details about FTS
The parser tries to recognize a type of a medicare or a medicaid CMS file and extract metadata
Abstract class for CMS FTS file
- class CMSFTS(type_of_data: str)[source]
Bases:
object
Abstract class for Medicaid and Medicare files from dorieh.cms
- Parameters:
type_of_data¶ – Can be either ps for personal summary or ip for inpatient admissions data
- common_indices = ['BENE_ID', 'FILE']
- on_after_read_file(columns: List[FTSColumn])[source]
Callback function
- Parameters:
columns¶ – columns read from FTS file
- Returns:
nothing
- static add_record_column(columns: List[FTSColumn])[source]
Adds a RECORD column, to uniquely identify a record in the database. A column is of type SERIAL, i.e. auto-incremented
- Parameters:
columns¶ –
- Returns:
- static add_file_column(columns: List[FTSColumn])[source]
Adds a column containing the name of original file, from which the data has been read
- Parameters:
columns¶ –
- Returns:
- column_to_dict(c: FTSColumn) dict [source]
Returns a column as a dictionary object that can be added to YAML data model :param _sphinx_paramlinks_dorieh.cms.fts2yaml.CMSFTS.column_to_dict.c: a column as parsed from FTS :return: dictionary
- to_dict()[source]
Returns full metadata for the file as a dictionary to be included in the YAML data model used to generate DDL for the corresponding table
- Returns:
dictionary
Concrete subclass describing Medicare FTS file
- class MedicareFTS(type_of_data: str)[source]
Bases:
CMSFTS
Subclass describing Medicare data file (usually, FWF dat file)
- Parameters:
type_of_data¶ – Can be either ps for personal summary or ip for inpatient admissions data
Concrete subclass describing Medicaid FTS file
Abstract class describing a column in a CMS data file
- class FTSColumn(order, column, c_type, c_format, c_width, label)[source]
Bases:
object
Metadata object for a column described in FTS file
A column can be either a CSV or fixed width (fwf) column
Concrete subclass describing a column in a Medicare data file
- class MedicareFTSColumn(order: int, long_name: str, short_name: str, type: str, start: int, width, desc: str)[source]
Bases:
FTSColumn
Subclass for a column in medicare files
- nattrs = 7