├── .gitignore ├── data ├── README.md ├── example_forms │ ├── Patient_Intake_Form_Joe_Artificial.pdf │ ├── Patient_Intake_Form_Emily_Artificial.pdf │ ├── Patient_Intake_From_Jane_Artificial.docx │ └── Patient_Intake_Form_David_Artificial.docx └── eval_PatientIntakeExtraction_golden │ ├── documents@1NqSz-BUk55rjdcu-AoOsMX6Ho9pjc4TeqWKicl7P0fw.yaml │ ├── documents@1n2m3VHq2_kP762ECyPH9Z5Tk44eu3yRZ.yaml │ ├── documents@1jBOjhkSnXnBS8poGn_G7zcpD-qO_Ffgi.yaml │ └── documents@10cb3j_GFNHF4uCxk8K7UwuwRODzwZt04.yaml ├── pyproject.toml ├── .env.example ├── README.md ├── main.py └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Python package metadata 4 | *.egg-info/ 5 | *.egg-info/** 6 | *.egg 7 | .env 8 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | ## Note: 2 | Example files here are purely artificial and not real, for testing purposes only. 3 | Please do not use these examples for any other purpose. 4 | 5 | -------------------------------------------------------------------------------- /data/example_forms/Patient_Intake_Form_Joe_Artificial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocoindex-io/patient-intake-extraction/HEAD/data/example_forms/Patient_Intake_Form_Joe_Artificial.pdf -------------------------------------------------------------------------------- /data/example_forms/Patient_Intake_Form_Emily_Artificial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocoindex-io/patient-intake-extraction/HEAD/data/example_forms/Patient_Intake_Form_Emily_Artificial.pdf -------------------------------------------------------------------------------- /data/example_forms/Patient_Intake_From_Jane_Artificial.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocoindex-io/patient-intake-extraction/HEAD/data/example_forms/Patient_Intake_From_Jane_Artificial.docx -------------------------------------------------------------------------------- /data/example_forms/Patient_Intake_Form_David_Artificial.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocoindex-io/patient-intake-extraction/HEAD/data/example_forms/Patient_Intake_Form_David_Artificial.docx -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "patient-intake-extraction" 3 | version = "0.1.0" 4 | description = "Extract structured information from patient intake forms using LLM." 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "cocoindex>=0.1.45", 8 | "python-dotenv>=1.0.1", 9 | "markitdown>=0.1.1", 10 | "openai>=1.68.2" 11 | ] 12 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Postgres database address for cocoindex 2 | COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex 3 | 4 | # Google Drive service account credential path. 5 | #! PLEASE FILL IN 6 | GOOGLE_SERVICE_ACCOUNT_CREDENTIAL=/path/to/service_account_credential.json 7 | 8 | # Google Drive root folder IDs, comma separated. 9 | #! PLEASE FILL IN 10 | GOOGLE_DRIVE_ROOT_FOLDER_IDS=id1,id2 -------------------------------------------------------------------------------- /data/eval_PatientIntakeExtraction_golden/documents@1NqSz-BUk55rjdcu-AoOsMX6Ho9pjc4TeqWKicl7P0fw.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | key: 1NqSz-BUk55rjdcu-AoOsMX6Ho9pjc4TeqWKicl7P0fw 3 | exports: 4 | patients: 5 | - filename: Patient_Intake_From_Jane 6 | patient_info: 7 | name: Jane Doe 8 | dob: 1985-01-16 9 | gender: Female 10 | address: 11 | street: 123 Main St 12 | city: Springfield 13 | state: IL 14 | zip_code: "62701" 15 | phone: "" 16 | email: "" 17 | preferred_contact_method: "" 18 | emergency_contact: 19 | name: "" 20 | phone: "" 21 | relationship: "" 22 | insurance: ~ 23 | reason_for_visit: "" 24 | symptoms_duration: "" 25 | past_conditions: [] 26 | current_medications: [] 27 | allergies: [] 28 | surgeries: [] 29 | occupation: ~ 30 | pharmacy: ~ 31 | consent_given: false 32 | consent_date: ~ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Structured Data From Patient Intake Forms](https://github.com/user-attachments/assets/1f6afb69-d26d-4a08-8774-13982d6aec1e) 2 | 3 | This repo shows how to use OpenAI API to extract structured data from patient intake forms with different formats, like PDF, Docx, etc. from Google Drive. 4 | 5 | ❤️ Please give [Cocoindex on Github](https://github.com/cocoindex-io/cocoindex) a star ⭐ to support us if you like our work. Thank you so much with a warm coconut hug 🥥🤗. [![GitHub](https://img.shields.io/github/stars/cocoindex-io/cocoindex?color=5B5BD6)](https://github.com/cocoindex-io/cocoindex) 6 | 7 | 8 | 9 | ## Prerequisite 10 | - [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one. 11 | 12 | - Install CocoIndex 13 | ```bash 14 | pip install -U cocoindex 15 | ``` 16 | 17 | - Make sure you have specify the database URL by environment variable: 18 | ``` 19 | export COCOINDEX_DATABASE_URL="postgresql://cocoindex:cocoindex@localhost:5432/cocoindex" 20 | ``` 21 | 22 | ## Run 23 | 24 | Setup index: 25 | 26 | ```bash 27 | cocoindex setup main.py 28 | ``` 29 | 30 | Update index: 31 | 32 | ```bash 33 | cocoindex update main.py 34 | ``` 35 | 36 | Run query: 37 | 38 | ```bash 39 | python main.py 40 | ``` 41 | 42 | Run with CocoInsight: 43 | ```bash 44 | cocoindex server -ci main.py 45 | ``` 46 | 47 | View results at https://cocoindex.io/cocoinsight 48 | -------------------------------------------------------------------------------- /data/eval_PatientIntakeExtraction_golden/documents@1n2m3VHq2_kP762ECyPH9Z5Tk44eu3yRZ.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | key: 1n2m3VHq2_kP762ECyPH9Z5Tk44eu3yRZ 3 | exports: 4 | patients: 5 | - filename: Patient_Intake_Form_David_Artificial.docx 6 | patient_info: 7 | name: David Thompson 8 | dob: 1980-05-10 9 | gender: Male 10 | address: 11 | street: 789 Pine Street 12 | city: Austin 13 | state: TX 14 | zip_code: "73301" 15 | phone: (555) 321-7890 16 | email: david.thompson@email.com 17 | preferred_contact_method: Phone 18 | emergency_contact: 19 | name: Sarah Thompson 20 | phone: (555) 654-0987 21 | relationship: Wife 22 | insurance: 23 | provider: HealthFirst Insurance 24 | policy_number: "555667788" 25 | group_number: "11223" 26 | policyholder_name: David Thompson 27 | relationship_to_patient: Self 28 | reason_for_visit: Knee pain 29 | symptoms_duration: 4 months 30 | past_conditions: 31 | - name: Hypertension 32 | diagnosed: true 33 | current_medications: 34 | - name: Lisinopril 35 | dosage: 10mg daily 36 | allergies: [] 37 | surgeries: 38 | - name: ACL Surgery 39 | date: "2018" 40 | occupation: Mechanical Engineer 41 | pharmacy: 42 | name: CityMed Pharmacy 43 | phone: (555) 222-3333 44 | address: 45 | street: 456 Health Blvd 46 | city: Austin 47 | state: TX 48 | zip_code: "73301" 49 | consent_given: true 50 | consent_date: 2025-03-25 -------------------------------------------------------------------------------- /data/eval_PatientIntakeExtraction_golden/documents@1jBOjhkSnXnBS8poGn_G7zcpD-qO_Ffgi.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | key: 1jBOjhkSnXnBS8poGn_G7zcpD-qO_Ffgi 3 | exports: 4 | patients: 5 | - filename: Patient_Intake_Form_Emily_Artificial.pdf 6 | patient_info: 7 | name: Emily Carter 8 | dob: 1992-07-22 9 | gender: Female 10 | address: 11 | street: 456 Oak Avenue 12 | city: Denver 13 | state: CO 14 | zip_code: "80203" 15 | phone: (555) 678-9012 16 | email: emily.carter@email.com 17 | preferred_contact_method: Email 18 | emergency_contact: 19 | name: Michael Carter 20 | phone: (555) 234-5678 21 | relationship: Brother 22 | insurance: 23 | provider: XYZ Health Plan 24 | policy_number: "987654321" 25 | group_number: "54321" 26 | policyholder_name: Emily Carter 27 | relationship_to_patient: Self 28 | reason_for_visit: Severe migraines 29 | symptoms_duration: 6 months 30 | past_conditions: 31 | - name: Asthma 32 | diagnosed: true 33 | current_medications: 34 | - name: Albuterol inhaler 35 | dosage: "" 36 | allergies: 37 | - name: Penicillin 38 | surgeries: 39 | - name: Tonsillectomy 40 | date: "2000" 41 | occupation: Graphic Designer 42 | pharmacy: 43 | name: Greenfield Pharmacy 44 | phone: (555) 876-5432 45 | address: 46 | street: 789 Maple Road 47 | city: Denver 48 | state: CO 49 | zip_code: "80203" 50 | consent_given: true 51 | consent_date: 2025-03-25 -------------------------------------------------------------------------------- /data/eval_PatientIntakeExtraction_golden/documents@10cb3j_GFNHF4uCxk8K7UwuwRODzwZt04.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | key: 10cb3j_GFNHF4uCxk8K7UwuwRODzwZt04 3 | exports: 4 | patients: 5 | - filename: Patient_Intake_Form_Joe.pdf 6 | patient_info: 7 | name: John Doe 8 | dob: 1985-01-15 9 | gender: Male 10 | address: 11 | street: 123 Main St 12 | city: Springfield 13 | state: IL 14 | zip_code: "62701" 15 | phone: (555) 987-6543 16 | email: johndoe@email.com 17 | preferred_contact_method: Text 18 | emergency_contact: 19 | name: Jane Doe 20 | phone: "" 21 | relationship: Spouse 22 | insurance: 23 | provider: Blue Cross Blue Shield 24 | policy_number: "123456789" 25 | group_number: Group 98765 26 | policyholder_name: John Doe 27 | relationship_to_patient: Self 28 | reason_for_visit: Occasional dizziness in the morning 29 | symptoms_duration: last 3 weeks 30 | past_conditions: 31 | - name: Diabetes 32 | diagnosed: true 33 | - name: Hypertension 34 | diagnosed: true 35 | current_medications: 36 | - name: Metformin 37 | dosage: 500mg (once daily) 38 | - name: Lisinopril 39 | dosage: 10mg (once daily) 40 | allergies: 41 | - name: Penicillin 42 | surgeries: 43 | - name: Appendectomy 44 | date: "2010" 45 | occupation: software engineer 46 | pharmacy: 47 | name: CVS 48 | phone: (555) 123-8888 49 | address: 50 | street: 567 Main St 51 | city: Springfield 52 | state: IL 53 | zip_code: "62701" 54 | consent_given: true 55 | consent_date: 2025-02-15 -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import tempfile 3 | import dataclasses 4 | import os 5 | 6 | from dotenv import load_dotenv 7 | from markitdown import MarkItDown 8 | from openai import OpenAI 9 | 10 | import cocoindex 11 | 12 | @dataclasses.dataclass 13 | class Contact: 14 | name: str 15 | phone: str 16 | relationship: str 17 | 18 | @dataclasses.dataclass 19 | class Address: 20 | street: str 21 | city: str 22 | state: str 23 | zip_code: str 24 | 25 | @dataclasses.dataclass 26 | class Pharmacy: 27 | name: str 28 | phone: str 29 | address: Address 30 | 31 | @dataclasses.dataclass 32 | class Insurance: 33 | provider: str 34 | policy_number: str 35 | group_number: str | None 36 | policyholder_name: str 37 | relationship_to_patient: str 38 | 39 | @dataclasses.dataclass 40 | class Condition: 41 | name: str 42 | diagnosed: bool 43 | 44 | @dataclasses.dataclass 45 | class Medication: 46 | name: str 47 | dosage: str 48 | 49 | @dataclasses.dataclass 50 | class Allergy: 51 | name: str 52 | 53 | @dataclasses.dataclass 54 | class Surgery: 55 | name: str 56 | date: str 57 | 58 | @dataclasses.dataclass 59 | class Patient: 60 | name: str 61 | dob: datetime.date 62 | gender: str 63 | address: Address 64 | phone: str 65 | email: str 66 | preferred_contact_method: str 67 | emergency_contact: Contact 68 | insurance: Insurance | None 69 | reason_for_visit: str 70 | symptoms_duration: str 71 | past_conditions: list[Condition] 72 | current_medications: list[Medication] 73 | allergies: list[Allergy] 74 | surgeries: list[Surgery] 75 | occupation: str | None 76 | pharmacy: Pharmacy | None 77 | consent_given: bool 78 | consent_date: datetime.date | None 79 | 80 | 81 | class ToMarkdown(cocoindex.op.FunctionSpec): 82 | """Convert a document to markdown.""" 83 | 84 | @cocoindex.op.executor_class(gpu=True, cache=True, behavior_version=1) 85 | class ToMarkdownExecutor: 86 | """Executor for ToMarkdown.""" 87 | 88 | spec: ToMarkdown 89 | _converter: MarkItDown 90 | 91 | def prepare(self): 92 | client = OpenAI() 93 | self._converter = MarkItDown(llm_client=client, llm_model="gpt-4o") 94 | 95 | def __call__(self, content: bytes, filename: str) -> str: 96 | suffix = os.path.splitext(filename)[1] 97 | with tempfile.NamedTemporaryFile(delete=True, suffix=suffix) as temp_file: 98 | temp_file.write(content) 99 | temp_file.flush() 100 | text = self._converter.convert(temp_file.name).text_content 101 | return text 102 | 103 | @cocoindex.flow_def(name="PatientIntakeExtraction") 104 | def patient_intake_extraction_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope): 105 | """ 106 | Define a flow that extracts patient information from intake forms. 107 | """ 108 | credential_path = os.environ["GOOGLE_SERVICE_ACCOUNT_CREDENTIAL"] 109 | root_folder_ids = os.environ["GOOGLE_DRIVE_ROOT_FOLDER_IDS"].split(",") 110 | 111 | data_scope["documents"] = flow_builder.add_source( 112 | cocoindex.sources.GoogleDrive( 113 | service_account_credential_path=credential_path, 114 | root_folder_ids=root_folder_ids, 115 | binary=True)) 116 | 117 | patients_index = data_scope.add_collector() 118 | 119 | with data_scope["documents"].row() as doc: 120 | 121 | doc["markdown"] = doc["content"].transform(ToMarkdown(), filename = doc["filename"]) 122 | doc["patient_info"] = doc["markdown"].transform( 123 | cocoindex.functions.ExtractByLlm( 124 | llm_spec=cocoindex.LlmSpec( 125 | api_type=cocoindex.LlmApiType.OPENAI, model="gpt-4o"), 126 | output_type=Patient, 127 | instruction="Please extract patient information from the intake form.")) 128 | patients_index.collect( 129 | filename=doc["filename"], 130 | patient_info=doc["patient_info"], 131 | ) 132 | 133 | patients_index.export( 134 | "patients", 135 | cocoindex.storages.Postgres(table_name="patients_info"), 136 | primary_key_fields=["filename"], 137 | ) 138 | 139 | @cocoindex.main_fn() 140 | def _run(): 141 | pass 142 | 143 | if __name__ == "__main__": 144 | load_dotenv(override=True) 145 | _run() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------