{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0TitleBillNumberDocketNumberGeneralCourtNumberPrimarySponsorCosponsorsJointSponsorBillHistoryLegislationTypeNamePinslipDocumentTextEmergencyPreambleRollCallsAttachmentsCommitteeRecommendationsAmendmentsList References
02299An Act relative to collective bargaining right...H3069HD2435193.0{'Id': 'PJK1', 'Name': 'Patrick Joseph Kearney...[{'Id': 'PJK1', 'Name': 'Patrick Joseph Kearne...NaNhttp://malegislature.gov/api/GeneralCourts/193...BillBy Representative Kearney of Scituate, a petit...\\tSECTION 1. Section 1 of Chapter 150E of the ...NaN[][][][][['1', '150E'], ['23', '268A']]
12358An Act relative to the open meeting lawH3121HD2204193.0{'Id': 'E_U1', 'Name': 'Erika Uyterhoeven', 'T...[{'Id': 'E_U1', 'Name': 'Erika Uyterhoeven', '...NaNhttp://malegislature.gov/api/GeneralCourts/193...BillBy Representative Uyterhoeven of Somerville, a...\\tSECTION 18 of chapter 30A of the General Law...NaN[][][][][['18', '30A']]
\n", "
" ], "text/plain": [ " Unnamed: 0 Title BillNumber \\\n", "0 2299 An Act relative to collective bargaining right... H3069 \n", "1 2358 An Act relative to the open meeting law H3121 \n", "\n", " DocketNumber GeneralCourtNumber \\\n", "0 HD2435 193.0 \n", "1 HD2204 193.0 \n", "\n", " PrimarySponsor \\\n", "0 {'Id': 'PJK1', 'Name': 'Patrick Joseph Kearney... \n", "1 {'Id': 'E_U1', 'Name': 'Erika Uyterhoeven', 'T... \n", "\n", " Cosponsors JointSponsor \\\n", "0 [{'Id': 'PJK1', 'Name': 'Patrick Joseph Kearne... NaN \n", "1 [{'Id': 'E_U1', 'Name': 'Erika Uyterhoeven', '... NaN \n", "\n", " BillHistory LegislationTypeName \\\n", "0 http://malegislature.gov/api/GeneralCourts/193... Bill \n", "1 http://malegislature.gov/api/GeneralCourts/193... Bill \n", "\n", " Pinslip \\\n", "0 By Representative Kearney of Scituate, a petit... \n", "1 By Representative Uyterhoeven of Somerville, a... \n", "\n", " DocumentText EmergencyPreamble \\\n", "0 \\tSECTION 1. Section 1 of Chapter 150E of the ... NaN \n", "1 \\tSECTION 18 of chapter 30A of the General Law... NaN \n", "\n", " RollCalls Attachments CommitteeRecommendations Amendments \\\n", "0 [] [] [] [] \n", "1 [] [] [] [] \n", "\n", " List References \n", "0 [['1', '150E'], ['23', '268A']] \n", "1 [['18', '30A']] " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import requests\n", "import pandas as pd\n", "\n", "df = pd.read_csv(\"list_regex_format_12bills.csv\")\n", "df.head(2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "List References: section number and chapter format" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 [['1', '150E'], ['23', '268A']]\n", "1 [['18', '30A']]\n", "2 NaN\n", "3 [['2', '15D'], ['2', '18B'], ['11', '15D'], ['...\n", "4 [['10', '70B']]\n", "5 [['77', '54']]\n", "6 [['1', '125'], ['73', '7C']]\n", "7 [['1', '150E'], ['23', '268A']]\n", "8 [['7', '4'], ['7', '4'], ['10', '66']]\n", "9 NaN\n", "10 [['2', '15D'], ['2', '18B'], ['11', '15D'], ['...\n", "11 [['77', '54']]\n", "Name: List References, dtype: object" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['List References'] " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "List References: section number and chapter format" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TitleBillNumberDocketNumberDocumentTextList References
0An Act relative to collective bargaining right...H3069HD2435\\tSECTION 1. Section 1 of Chapter 150E of the ...[['1', '150E'], ['23', '268A']]
1An Act relative to the open meeting lawH3121HD2204\\tSECTION 18 of chapter 30A of the General Law...[['18', '30A']]
2An Act relative to vehicle recallsH400HD1240\\tSECTION 1. Chapter 90 of the General Laws, a...NaN
3An Act providing affordable and accessible hig...H489HD2794\\tSECTION 1. The seventh paragraph of section ...[['2', '15D'], ['2', '18B'], ['11', '15D'], ['...
4An Act to Improve access, opportunity, and cap...H538HD485\\tSECTION 1. To create a new capital infrastru...[['10', '70B']]
5An Act providing a local option for ranked cho...H711HD1183\\tSECTION 1. Section 44A of chapter 43 of the ...[['77', '54']]
6An Act establishing a jail and prison construc...S1979SD661\\tSECTION 1. Chapter 7C of the General Laws is...[['1', '125'], ['73', '7C']]
7An Act relative to collective bargaining right...S2014SD1208\\tSECTION 1. Section 1 of chapter 150E of the ...[['1', '150E'], ['23', '268A']]
8An Act extending the public records law to the...S2064SD390\\tSECTION 1. Section 7 of chapter 4 of the Gen...[['7', '4'], ['7', '4'], ['10', '66']]
9An Act to end discriminatory outcomes in vocat...S257SD2312\\tSECTION 1. Chapter 74 of the General Laws is...NaN
10An Act providing affordable and accessible hig...S301SD667\\tSECTION 1. The seventh paragraph of section ...[['2', '15D'], ['2', '18B'], ['11', '15D'], ['...
11An Act providing a local option for ranked cho...S433SD391\\tSECTION 1. Section 44A of chapter 43 of the ...[['77', '54']]
\n", "
" ], "text/plain": [ " Title BillNumber DocketNumber \\\n", "0 An Act relative to collective bargaining right... H3069 HD2435 \n", "1 An Act relative to the open meeting law H3121 HD2204 \n", "2 An Act relative to vehicle recalls H400 HD1240 \n", "3 An Act providing affordable and accessible hig... H489 HD2794 \n", "4 An Act to Improve access, opportunity, and cap... H538 HD485 \n", "5 An Act providing a local option for ranked cho... H711 HD1183 \n", "6 An Act establishing a jail and prison construc... S1979 SD661 \n", "7 An Act relative to collective bargaining right... S2014 SD1208 \n", "8 An Act extending the public records law to the... S2064 SD390 \n", "9 An Act to end discriminatory outcomes in vocat... S257 SD2312 \n", "10 An Act providing affordable and accessible hig... S301 SD667 \n", "11 An Act providing a local option for ranked cho... S433 SD391 \n", "\n", " DocumentText \\\n", "0 \\tSECTION 1. Section 1 of Chapter 150E of the ... \n", "1 \\tSECTION 18 of chapter 30A of the General Law... \n", "2 \\tSECTION 1. Chapter 90 of the General Laws, a... \n", "3 \\tSECTION 1. The seventh paragraph of section ... \n", "4 \\tSECTION 1. To create a new capital infrastru... \n", "5 \\tSECTION 1. Section 44A of chapter 43 of the ... \n", "6 \\tSECTION 1. Chapter 7C of the General Laws is... \n", "7 \\tSECTION 1. Section 1 of chapter 150E of the ... \n", "8 \\tSECTION 1. Section 7 of chapter 4 of the Gen... \n", "9 \\tSECTION 1. Chapter 74 of the General Laws is... \n", "10 \\tSECTION 1. The seventh paragraph of section ... \n", "11 \\tSECTION 1. Section 44A of chapter 43 of the ... \n", "\n", " List References \n", "0 [['1', '150E'], ['23', '268A']] \n", "1 [['18', '30A']] \n", "2 NaN \n", "3 [['2', '15D'], ['2', '18B'], ['11', '15D'], ['... \n", "4 [['10', '70B']] \n", "5 [['77', '54']] \n", "6 [['1', '125'], ['73', '7C']] \n", "7 [['1', '150E'], ['23', '268A']] \n", "8 [['7', '4'], ['7', '4'], ['10', '66']] \n", "9 NaN \n", "10 [['2', '15D'], ['2', '18B'], ['11', '15D'], ['... \n", "11 [['77', '54']] " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_cleaned = df[['Title', 'BillNumber', 'DocketNumber', 'DocumentText', 'List References']]\n", "df_cleaned" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import ast \n", "\n", "new_df = df_cleaned.copy()\n", "\n", "new_df['List References'] = df_cleaned['List References'].apply(lambda x: \"None\" if pd.isna(x) else ast.literal_eval(x))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 [[1, 150E], [23, 268A]]\n", "1 [[18, 30A]]\n", "2 None\n", "3 [[2, 15D], [2, 18B], [11, 15D], [19, 66]]\n", "4 [[10, 70B]]\n", "5 [[77, 54]]\n", "6 [[1, 125], [73, 7C]]\n", "7 [[1, 150E], [23, 268A]]\n", "8 [[7, 4], [7, 4], [10, 66]]\n", "9 None\n", "10 [[2, 15D], [2, 18B], [11, 15D], [19, 66]]\n", "11 [[77, 54]]\n", "Name: List References, dtype: object" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df['List References']" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[['2', '15D'], ['2', '18B'], ['11', '15D'], ['19', '66']]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df['List References'].values[3]" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "def make_api_call(item):\n", " result = \"\"\"\"\"\"\n", " try:\n", " # unpack section and chapter for example: ['2', '15D']\n", " section, chapter = item\n", " r = requests.get(f'https://malegislature.gov/api/Chapters/{chapter}/Sections/{section}', verify=False)\n", " r = r.json()\n", "\n", " # fields to extract\n", " result = r.get(\"Text\", np.nan)\n", " return result\n", " except:\n", " pass" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Section 2. There shall be in the executive office of education a department of early education and care, in this chapter called the department, which shall be the state agency responsible for compliance with early education and care services under the Personal Responsibility and Work Opportunity Reconciliation Act of 1996 (Pub. L. 104–193), or any successor federal statute. The department shall be the state education agency for the purposes of early education and care services under federal law. The department shall seek, apply for and encourage the use of any federal funds for early education and care services, and shall facilitate the coordination of federal, state, and local policies concerning early education and care. The department shall be under the supervision and management of the commissioner of early education and care, in this chapter called the commissioner. \n", "\n", "The department shall:— \n", "\n", "(a) be the lead agency of the commonwealth for administering and providing early education and care programs and services to children; \n", "\n", "(b) provide early education and care programs and mental health consultation and other support services for children in the commonwealth through grants, contracting for those programs and services, and providing vouchers to participants, and promote the coordination of all such programs and services; \n", "\n", "(c) license or approve child care centers, school-aged child care programs, family child care homes and large family child care homes, family foster care which is not supervised and approved by a placement agency, placement agencies, group care facilities, or temporary shelter facilities; \n", "\n", "(d) develop and maintain a current consolidated waiting list for all subsidized early education and care programs, and services in the commonwealth; \n", "\n", "(e) establish and develop a schedule for revising: (1) a rate structure for voucher and contracted payments to providers of subsidized early education and care programs and services on behalf of low-income and other at-risk children; and (2) a sliding fee scale for participants in those programs. A public hearing under chapter 30A and the approval of the board shall be required before the establishment or revision of the rate structure and sliding fee scale; \n", "\n", "(f) manage and implement the Massachusetts universal pre-kindergarten program, established in section 13, that may be phased in over a period of time as determined by the board, and ensure the universal accessibility to the program by using the sliding fee scale developed for early education and care programs; \n", "\n", "(g) after a public hearing, adopt criteria including income eligibility requirements, for determining eligibility for an early education and care program or service, including the universal pre-kindergarten program under this chapter and develop a schedule for revising such criteria. Income eligibility requirements shall include a maximum allowable income for working families; \n", "\n", "(h) monitor and evaluate on an ongoing basis all early education and care programs and services, including program outcomes in meeting the developmental and educational needs of all children; \n", "\n", "(i) analyze and evaluate all budget requests for early education and care programs and services, including requests from secretaries, departments, agencies, or other offices within the commonwealth and make recommendations to the secretary of education, general court, appropriate secretaries, departments, agencies, or other offices regarding coordination and approval of those budget requests; \n", "\n", "(j) lease, purchase, hold and dispose of personal and real property it considers necessary to carry out this chapter; \n", "\n", "(k) seek to increase the availability of early education and care programs and services and encourage all providers of those programs and services to work together to create an array of options allowing families to select programs that fit with their schedules; \n", "\n", "(l) provide information and referral to persons seeking early education and care programs and services; \n", "\n", "(m) work in conjunction with the department of transitional assistance to obtain federal reimbursement under the federal Social Security Act for all participants in publicly-funded early education and care programs and services who are eligible; \n", "\n", "(n) promote the development of early education and care services for children by seeking and accepting federal grants as well as assisting other agencies of the commonwealth and local agencies to take full advantage of all federal funds available for those services; \n", "\n", "(o) provide technical assistance and consultation to providers and potential providers of early education and care services; \n", "\n", "(p) facilitate the development of the early education and care workforce, and, when appropriate, provide for training programs and professional development for persons offering early education and care programs and services; \n", "\n", "(q) establish and regularly update: (1) a comprehensive database of early childhood educators and providers, hereinafter referred to as the educator database, for the purpose of enhancing the workforce development system; and (2) a comprehensive database of children both waiting for and receiving early education and care services, in this chapter called the student database, that is compatible with relevant databases at the department of elementary and secondary education and the executive office of health and human services; and \n", "\n", "(r) collect and disseminate information to assist parents in nurturing their children's development and education. This information shall be made widely available in written form and accessible through the department's website, in English and other commonly spoken languages in the commonwealth. \n", "\n", "(s) plan for and address the unique needs of families with infants and toddlers, including providing parent education, early literacy services and meaningful opportunities for families not enrolled in early education and care to support their children's development. \n", "\n", "(t) subject to appropriation, provide consultation services and workforce development to meet the behavioral health needs of children in early education and care programs, giving preference to those services designed to prevent expulsions and suspensions. \n", "\n", "(u) subject to appropriation and notwithstanding any general or special law to the contrary, assure quality early education and care provided to children through family child care providers by working cooperatively with family child care providers to build upon the existing system and continuously improve the delivery of high quality early education and care services for eligible low income families through providers who have the requisite skills and training. \n", "\n", "Section 2. The department shall provide and administer a comprehensive child welfare program for children and families, including the following services:— \n", "\n", "(1) casework or counseling, including services to families, foster families or individuals; \n", "\n", "(2) protective services for children; \n", "\n", "(3) legal services for families, children or individuals who are clients of the department; \n", "\n", "(4) adoption services; \n", "\n", "(5) information and referral services; \n", "\n", "(6) foster family care for children and specialized foster family care for children with special needs; \n", "\n", "(7) residential care for children with special needs who are not suited for foster family care or specialized foster family care; \n", "\n", "(8) informal education and group activities; \n", "\n", "(9) training in parenthood and home management for parents, foster parents and prospective parents; \n", "\n", "(10) family services intended to prevent the need for foster care and services to children in foster care; \n", "\n", "(11) temporary residential programs providing counseling and supportive assistance for families in transition and their children who, because of domestic violence, homelessness, or other situations, require temporary shelter and assistance; \n", "\n", "(12) camping services; \n", "\n", "(13) information and referral services; \n", "\n", "(14) services for families and individuals in emergency and transitional housing; \n", "\n", "(15) comprehensive youth development services; \n", "\n", "(16) access to and coordination of medical, dental and mental health services for children in foster care whose families are receiving services from other state agencies; and \n", "\n", "(17) child care placements for children whose families have an open case with the department. \n", "\n", "Section 11. The board, after holding a public hearing, shall adopt, and develop a schedule for revising, program quality standards and requirements that any early education and care program or provider shall meet. The department shall develop separate but related standards for children in the following developmental stages: infant and toddler, pre-school, early elementary and older school-age; and for additional developmental stages that the department may determine relevant based on research and best practices. These standards and requirements shall incorporate essential elements of high-quality early education and care that promote healthy, cognitive, linguistic, social, emotional and physical outcomes, and school readiness based on curriculum frameworks. Standards and requirements shall build upon the licensure regulations promulgated under section 8. \n", "\n", "(a) The standards for all developmental stages and any succeeding developmental stages adopted by the department shall be incorporated into a single document and linked by a common philosophy and consistent goals and guiding principles. This document shall also include the policy developed jointly with the department and board of elementary and secondary education required under section 13 to ensure smooth transitions between infant and toddler programs, preschool and kindergarten. The standards shall be regularly updated to reflect applicable research and best practices. The board shall submit standards and requirements, or revisions of them, to the joint committee on education and the house and senate committees on ways and means at least 60 days before adoption. The joint committee on education shall review and comment on the rules and regulations during that time period. \n", "\n", "(b) The board shall include, in its adoption and revision of program quality standards, a specific focus on the unique requirements and needs of preschool-aged children including, but not limited to, rigorous guidelines for preschool learning experiences. Every early education and care program or provider shall be required to meet these standards in order to participate in the Massachusetts universal pre-kindergarten program, established in section 13. \n", "\n", "(c) The department, with approval of the board, shall develop a consistent set of learning standards for all preschool programs in the commonwealth, to be included in the program quality standards. The standards shall be consistent with the curriculum frameworks developed by the department of elementary and secondary education, shall be research-based and shall be updated regularly to reflect best practices in the field of early education and care. The standards shall guarantee, at a minimum, that every program participating in the Massachusetts universal pre-kindergarten program shall include consultation and intervention services for children at risk for expulsion. \n", "\n", "(d) With the approval of the board, the department shall develop and establish a schedule for revising a comprehensive set of developmental benchmarks which may be incorporated into the quality standards, and which may be used by all early education and care programs in measuring children's developmental progress utilizing the healthy, cognitive, linguistic, social, emotional and physical outcomes for developing the quality standards. In developing the benchmarks, the department shall collaborate with pediatricians, child psychologists, and researchers within the field of child development and developmental psychology, in order to ensure that the document reflects best practices in the field and the most recent evidence provided by science relative to early childhood development. \n", "\n", "Section 19. (a) When designing or acquiring an electronic record keeping system or database, records access officers shall, consistent with section 17 of chapter 110G, consult with their chief executive officer, chief administrative officer or the Massachusetts office of information technology pursuant to chapter 7D to ensure, to the extent feasible, that the system or database is capable of providing data in a commonly available electronic, machine readable format. Such database designs or acquisitions shall allow for, to the extent feasible, information storage and retrieval methods that permit the segregation and retrieval of public records and redacting of exempt information in order to provide maximum public access. No agency or municipality shall enter into a contract for the storage of electronic records containing public records if the contract prevents or unduly restricts the records access officer from providing the public records in accordance with this chapter. \n", "\n", "(b) Every agency shall provide on a searchable website electronic copies, accessible in a commonly available electronic format, of the following types of records, provided that any agency may withhold any record or portion thereof in accordance with state or federal law: \n", "\n", "(i) final opinions, decisions, orders, or votes from agency proceedings; \n", "\n", "(ii) annual reports; \n", "\n", "(iii) notices of regulations proposed under chapter 30A; \n", "\n", "(iv) notices of hearings; \n", "\n", "(v) winning bids for public contracts; \n", "\n", "(vi) awards of federal, state and municipal government grants; \n", "\n", "(vii) minutes of open meetings; \n", "\n", "(viii) agency budgets; and \n", "\n", "(ix) any public record information of significant interest that the agency deems appropriate to post. \n", "\n", "\n", "14007\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n" ] } ], "source": [ "sample_1 = new_df['List References'].values[3]\n", "\n", "result = \"\"\"\"\"\"\n", "# Storing and printing each pair\n", "formatted_data = []\n", "for pair in sample_1:\n", " string = make_api_call(pair)\n", " result += string\n", " \n", "\n", "print(result)\n", "print(len(result))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this is in the format of section, chapter" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n", "c:\\Users\\16178\\anaconda3\\envs\\maple\\Lib\\site-packages\\urllib3\\connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host 'malegislature.gov'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n", " warnings.warn(\n" ] } ], "source": [ "new_df['MGL'] = new_df['List References'].apply(lambda pairs: [make_api_call(item) for item in pairs if item is not None])" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Title An Act providing affordable and accessible hig...\n", "BillNumber H489\n", "DocketNumber HD2794\n", "DocumentText \\tSECTION 1. The seventh paragraph of section ...\n", "List References [[2, 15D], [2, 18B], [11, 15D], [19, 66]]\n", "MGL [Section 2. There shall be in the executive of...\n", "Name: 3, dtype: object" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df.iloc[3]" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[\"Section 2. There shall be in the executive office of education a department of early education and care, in this chapter called the department, which shall be the state agency responsible for compliance with early education and care services under the Personal Responsibility and Work Opportunity Reconciliation Act of 1996 (Pub. L. 104–193), or any successor federal statute. The department shall be the state education agency for the purposes of early education and care services under federal law. The department shall seek, apply for and encourage the use of any federal funds for early education and care services, and shall facilitate the coordination of federal, state, and local policies concerning early education and care. The department shall be under the supervision and management of the commissioner of early education and care, in this chapter called the commissioner. \\r\\n\\r\\nThe department shall:— \\r\\n\\r\\n(a) be the lead agency of the commonwealth for administering and providing early education and care programs and services to children; \\r\\n\\r\\n(b) provide early education and care programs and mental health consultation and other support services for children in the commonwealth through grants, contracting for those programs and services, and providing vouchers to participants, and promote the coordination of all such programs and services; \\r\\n\\r\\n(c) license or approve child care centers, school-aged child care programs, family child care homes and large family child care homes, family foster care which is not supervised and approved by a placement agency, placement agencies, group care facilities, or temporary shelter facilities; \\r\\n\\r\\n(d) develop and maintain a current consolidated waiting list for all subsidized early education and care programs, and services in the commonwealth; \\r\\n\\r\\n(e) establish and develop a schedule for revising: (1) a rate structure for voucher and contracted payments to providers of subsidized early education and care programs and services on behalf of low-income and other at-risk children; and (2) a sliding fee scale for participants in those programs. A public hearing under chapter 30A and the approval of the board shall be required before the establishment or revision of the rate structure and sliding fee scale; \\r\\n\\r\\n(f) manage and implement the Massachusetts universal pre-kindergarten program, established in section 13, that may be phased in over a period of time as determined by the board, and ensure the universal accessibility to the program by using the sliding fee scale developed for early education and care programs; \\r\\n\\r\\n(g) after a public hearing, adopt criteria including income eligibility requirements, for determining eligibility for an early education and care program or service, including the universal pre-kindergarten program under this chapter and develop a schedule for revising such criteria. Income eligibility requirements shall include a maximum allowable income for working families; \\r\\n\\r\\n(h) monitor and evaluate on an ongoing basis all early education and care programs and services, including program outcomes in meeting the developmental and educational needs of all children; \\r\\n\\r\\n(i) analyze and evaluate all budget requests for early education and care programs and services, including requests from secretaries, departments, agencies, or other offices within the commonwealth and make recommendations to the secretary of education, general court, appropriate secretaries, departments, agencies, or other offices regarding coordination and approval of those budget requests; \\r\\n\\r\\n(j) lease, purchase, hold and dispose of personal and real property it considers necessary to carry out this chapter; \\r\\n\\r\\n(k) seek to increase the availability of early education and care programs and services and encourage all providers of those programs and services to work together to create an array of options allowing families to select programs that fit with their schedules; \\r\\n\\r\\n(l) provide information and referral to persons seeking early education and care programs and services; \\r\\n\\r\\n(m) work in conjunction with the department of transitional assistance to obtain federal reimbursement under the federal Social Security Act for all participants in publicly-funded early education and care programs and services who are eligible; \\r\\n\\r\\n(n) promote the development of early education and care services for children by seeking and accepting federal grants as well as assisting other agencies of the commonwealth and local agencies to take full advantage of all federal funds available for those services; \\r\\n\\r\\n(o) provide technical assistance and consultation to providers and potential providers of early education and care services; \\r\\n\\r\\n(p) facilitate the development of the early education and care workforce, and, when appropriate, provide for training programs and professional development for persons offering early education and care programs and services; \\r\\n\\r\\n(q) establish and regularly update: (1) a comprehensive database of early childhood educators and providers, hereinafter referred to as the educator database, for the purpose of enhancing the workforce development system; and (2) a comprehensive database of children both waiting for and receiving early education and care services, in this chapter called the student database, that is compatible with relevant databases at the department of elementary and secondary education and the executive office of health and human services; and \\r\\n\\r\\n(r) collect and disseminate information to assist parents in nurturing their children's development and education. This information shall be made widely available in written form and accessible through the department's website, in English and other commonly spoken languages in the commonwealth. \\r\\n\\r\\n(s) plan for and address the unique needs of families with infants and toddlers, including providing parent education, early literacy services and meaningful opportunities for families not enrolled in early education and care to support their children's development. \\r\\n\\r\\n(t) subject to appropriation, provide consultation services and workforce development to meet the behavioral health needs of children in early education and care programs, giving preference to those services designed to prevent expulsions and suspensions. \\r\\n\\r\\n(u) subject to appropriation and notwithstanding any general or special law to the contrary, assure quality early education and care provided to children through family child care providers by working cooperatively with family child care providers to build upon the existing system and continuously improve the delivery of high quality early education and care services for eligible low income families through providers who have the requisite skills and training. \\r\\n\\r\\n\",\n", " 'Section 2. The department shall provide and administer a comprehensive child welfare program for children and families, including the following services:— \\r\\n\\r\\n(1) casework or counseling, including services to families, foster families or individuals; \\r\\n\\r\\n(2) protective services for children; \\r\\n\\r\\n(3) legal services for families, children or individuals who are clients of the department; \\r\\n\\r\\n(4) adoption services; \\r\\n\\r\\n(5) information and referral services; \\r\\n\\r\\n(6) foster family care for children and specialized foster family care for children with special needs; \\r\\n\\r\\n(7) residential care for children with special needs who are not suited for foster family care or specialized foster family care; \\r\\n\\r\\n(8) informal education and group activities; \\r\\n\\r\\n(9) training in parenthood and home management for parents, foster parents and prospective parents; \\r\\n\\r\\n(10) family services intended to prevent the need for foster care and services to children in foster care; \\r\\n\\r\\n(11) temporary residential programs providing counseling and supportive assistance for families in transition and their children who, because of domestic violence, homelessness, or other situations, require temporary shelter and assistance; \\r\\n\\r\\n(12) camping services; \\r\\n\\r\\n(13) information and referral services; \\r\\n\\r\\n(14) services for families and individuals in emergency and transitional housing; \\r\\n\\r\\n(15) comprehensive youth development services; \\r\\n\\r\\n(16) access to and coordination of medical, dental and mental health services for children in foster care whose families are receiving services from other state agencies; and \\r\\n\\r\\n(17) child care placements for children whose families have an open case with the department. \\r\\n\\r\\n',\n", " \"Section 11. The board, after holding a public hearing, shall adopt, and develop a schedule for revising, program quality standards and requirements that any early education and care program or provider shall meet. The department shall develop separate but related standards for children in the following developmental stages: infant and toddler, pre-school, early elementary and older school-age; and for additional developmental stages that the department may determine relevant based on research and best practices. These standards and requirements shall incorporate essential elements of high-quality early education and care that promote healthy, cognitive, linguistic, social, emotional and physical outcomes, and school readiness based on curriculum frameworks. Standards and requirements shall build upon the licensure regulations promulgated under section 8. \\r\\n\\r\\n(a) The standards for all developmental stages and any succeeding developmental stages adopted by the department shall be incorporated into a single document and linked by a common philosophy and consistent goals and guiding principles. This document shall also include the policy developed jointly with the department and board of elementary and secondary education required under section 13 to ensure smooth transitions between infant and toddler programs, preschool and kindergarten. The standards shall be regularly updated to reflect applicable research and best practices. The board shall submit standards and requirements, or revisions of them, to the joint committee on education and the house and senate committees on ways and means at least 60 days before adoption. The joint committee on education shall review and comment on the rules and regulations during that time period. \\r\\n\\r\\n(b) The board shall include, in its adoption and revision of program quality standards, a specific focus on the unique requirements and needs of preschool-aged children including, but not limited to, rigorous guidelines for preschool learning experiences. Every early education and care program or provider shall be required to meet these standards in order to participate in the Massachusetts universal pre-kindergarten program, established in section 13. \\r\\n\\r\\n(c) The department, with approval of the board, shall develop a consistent set of learning standards for all preschool programs in the commonwealth, to be included in the program quality standards. The standards shall be consistent with the curriculum frameworks developed by the department of elementary and secondary education, shall be research-based and shall be updated regularly to reflect best practices in the field of early education and care. The standards shall guarantee, at a minimum, that every program participating in the Massachusetts universal pre-kindergarten program shall include consultation and intervention services for children at risk for expulsion. \\r\\n\\r\\n(d) With the approval of the board, the department shall develop and establish a schedule for revising a comprehensive set of developmental benchmarks which may be incorporated into the quality standards, and which may be used by all early education and care programs in measuring children's developmental progress utilizing the healthy, cognitive, linguistic, social, emotional and physical outcomes for developing the quality standards. In developing the benchmarks, the department shall collaborate with pediatricians, child psychologists, and researchers within the field of child development and developmental psychology, in order to ensure that the document reflects best practices in the field and the most recent evidence provided by science relative to early childhood development. \\r\\n\\r\\n\",\n", " 'Section 19. (a) When designing or acquiring an electronic record keeping system or database, records access officers shall, consistent with section 17 of chapter 110G, consult with their chief executive officer, chief administrative officer or the Massachusetts office of information technology pursuant to chapter 7D to ensure, to the extent feasible, that the system or database is capable of providing data in a commonly available electronic, machine readable format. Such database designs or acquisitions shall allow for, to the extent feasible, information storage and retrieval methods that permit the segregation and retrieval of public records and redacting of exempt information in order to provide maximum public access. No agency or municipality shall enter into a contract for the storage of electronic records containing public records if the contract prevents or unduly restricts the records access officer from providing the public records in accordance with this chapter. \\r\\n\\r\\n(b) Every agency shall provide on a searchable website electronic copies, accessible in a commonly available electronic format, of the following types of records, provided that any agency may withhold any record or portion thereof in accordance with state or federal law: \\r\\n\\r\\n(i) final opinions, decisions, orders, or votes from agency proceedings; \\r\\n\\r\\n(ii) annual reports; \\r\\n\\r\\n(iii) notices of regulations proposed under chapter 30A; \\r\\n\\r\\n(iv) notices of hearings; \\r\\n\\r\\n(v) winning bids for public contracts; \\r\\n\\r\\n(vi) awards of federal, state and municipal government grants; \\r\\n\\r\\n(vii) minutes of open meetings; \\r\\n\\r\\n(viii) agency budgets; and \\r\\n\\r\\n(ix) any public record information of significant interest that the agency deems appropriate to post. \\r\\n\\r\\n']" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df['MGL'].values[3]" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [], "source": [ "new_df['combined_MGL'] = new_df['MGL'].apply(lambda lst: ' '.join([str(item) for item in lst if item is not None]))" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [ "new_df['length_MGL'] = new_df['combined_MGL'].apply(lambda x: len(x) if x else None)" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 12170.0\n", "1 4047.0\n", "2 NaN\n", "3 14010.0\n", "4 5565.0\n", "5 680.0\n", "6 2813.0\n", "7 12170.0\n", "8 78184.0\n", "9 NaN\n", "10 14010.0\n", "11 680.0\n", "Name: length_MGL, dtype: float64" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df['length_MGL']" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [], "source": [ "new_df.to_csv(\"12billswith.csv\")" ] } ], "metadata": { "kernelspec": { "display_name": "maple", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 2 }