数据集:
这个数据集是由 CoADoc 解析的公共大麻实验室测试结果的集合, CoADoc 是一个证书分析(COA)解析工具。
数据集被分成各种实验室结果的来源。
| Subset | Source | Observations |
|---|---|---|
| rawgarden | Raw Gardens | 2,667 |
| mcrlabs | MCR Labs | Coming soon! |
| psilabs | PSI Labs | Coming soon! |
| sclabs | SC Labs | Coming soon! |
| washington | Washington State | Coming soon! |
你可以加载每个数据集文件的详细信息。例如:
from datasets import load_dataset
# Download Raw Garden lab result details.
dataset = load_dataset('cannlytics/cannabis_tests', 'rawgarden')
details = dataset['details']
assert len(details) > 0
print('Downloaded %i observations.' % len(details))
注意:结果和值的配置计划中。目前,您可以使用CoADoc().save(details, out_file)创建这些数据。
以下是非详尽列表,用于规范遇到的各种数据的字段,您可以期望在解析的COA数据中遇到这些字段。
| Field | Example | Description |
|---|---|---|
| analyses | ["cannabinoids"] | A list of analyses performed on a given sample. |
| {analysis}_method | "HPLC" | The method used for each analysis. |
| {analysis}_status | "pass" | The pass, fail, or N/A status for pass / fail analyses. |
| coa_urls | [{"url": "", "filename": ""}] | A list of certificate of analysis (CoA) URLs. |
| date_collected | 2022-04-20T04:20 | An ISO-formatted time when the sample was collected. |
| date_tested | 2022-04-20T16:20 | An ISO-formatted time when the sample was tested. |
| date_received | 2022-04-20T12:20 | An ISO-formatted time when the sample was received. |
| distributor | "Your Favorite Dispo" | The name of the product distributor, if applicable. |
| distributor_address | "Under the Bridge, SF, CA 55555" | The distributor address, if applicable. |
| distributor_street | "Under the Bridge" | The distributor street, if applicable. |
| distributor_city | "SF" | The distributor city, if applicable. |
| distributor_state | "CA" | The distributor state, if applicable. |
| distributor_zipcode | "55555" | The distributor zip code, if applicable. |
| distributor_license_number | "L2Stat" | The distributor license number, if applicable. |
| images | [{"url": "", "filename": ""}] | A list of image URLs for the sample. |
| lab_results_url | " 1239321 | A URL to the sample results online. |
| producer | "Grow Tent" | The producer of the sampled product. |
| producer_address | "3rd & Army, SF, CA 55555" | The producer's address. |
| producer_street | "3rd & Army" | The producer's street. |
| producer_city | "SF" | The producer's city. |
| producer_state | "CA" | The producer's state. |
| producer_zipcode | "55555" | The producer's zipcode. |
| producer_license_number | "L2Calc" | The producer's license number. |
| product_name | "Blue Rhino Pre-Roll" | The name of the product. |
| lab_id | "Sample-0001" | A lab-specific ID for the sample. |
| product_type | "flower" | The type of product. |
| batch_number | "Order-0001" | A batch number for the sample or product. |
| metrc_ids | ["1A4060300002199000003445"] | A list of relevant Metrc IDs. |
| metrc_lab_id | "1A4060300002199000003445" | The Metrc ID associated with the lab sample. |
| metrc_source_id | "1A4060300002199000003445" | The Metrc ID associated with the sampled product. |
| product_size | 2000 | The size of the product in milligrams. |
| serving_size | 1000 | An estimated serving size in milligrams. |
| servings_per_package | 2 | The number of servings per package. |
| sample_weight | 1 | The weight of the product sample in grams. |
| results | [{...},...] | A list of results, see below for result-specific fields. |
| status | "pass" | The overall pass / fail status for all contaminant screening analyses. |
| total_cannabinoids | 14.20 | The analytical total of all cannabinoids measured. |
| total_thc | 14.00 | The analytical total of THC and THCA. |
| total_cbd | 0.20 | The analytical total of CBD and CBDA. |
| total_terpenes | 0.42 | The sum of all terpenes measured. |
| results_hash | "{sha256-hash}" | An HMAC of the sample's results JSON signed with Cannlytics' public key, "cannlytics.eth" . |
| sample_id | "{sha256-hash}" | A generated ID to uniquely identify the producer , product_name , and results . |
| sample_hash | "{sha256-hash}" | An HMAC of the entire sample JSON signed with Cannlytics' public key, "cannlytics.eth" . |
每个结果可以包含以下字段。
| Field | Example | Description |
|---|---|---|
| analysis | "pesticides" | The analysis used to obtain the result. |
| key | "pyrethrins" | A standardized key for the result analyte. |
| name | "Pyrethrins" | The lab's internal name for the result analyte |
| value | 0.42 | The value of the result. |
| mg_g | 0.00000042 | The value of the result in milligrams per gram. |
| units | "ug/g" | The units for the result value , limit , lod , and loq . |
| limit | 0.5 | A pass / fail threshold for contaminant screening analyses. |
| lod | 0.01 | The limit of detection for the result analyte. Values below the lod are typically reported as ND . |
| loq | 0.1 | The limit of quantification for the result analyte. Values above the lod but below the loq are typically reported as <LOQ . |
| status | "pass" | The pass / fail status for contaminant screening analyses. |
数据分为详细信息、结果和值数据。结果和值的配置计划中。目前,您可以使用以下方式创建这些数据:
from cannlytics.data.coas import CoADoc from datasets import load_dataset import pandas as pd # Download Raw Garden lab result details. repo = 'cannlytics/cannabis_tests' dataset = load_dataset(repo, 'rawgarden') details = dataset['details'] # Save the data locally with "Details", "Results", and "Values" worksheets. outfile = 'details.xlsx' parser = CoADoc() parser.save(details.to_pandas(), outfile) # Read the values. values = pd.read_excel(outfile, sheet_name='Values') # Read the results. results = pd.read_excel(outfile, sheet_name='Results')
对于大麻种植者、加工者、零售商和消费者来说,分析证书(CoAs)是充裕的,但数据常常被锁定。富有价值的实验室数据如此接近,却又如此遥远!通过解析PDF和URL,找到所有数据,标准化数据,并将数据清晰地返回给您,CoADoc将这些重要数据点放在您的手中。
| Data Source | URL |
|---|---|
| MCR Labs Test Results | 12310321 |
| PSI Labs Test Results | 12311321 |
| Raw Garden Test Results | 12312321 |
| SC Labs Test Results | 12313321 |
| Washington State Lab Test Results | 12314321 |
您可以使用存储库中的开源算法重新创建数据集。
git clone https://huggingface.co/datasets/cannlytics/cannabis_tests
然后,您可以安装算法Python(3.9+)的要求:
cd cannabis_tests pip install -r requirements.txt
之后,您可以运行所有数据收集算法:
python algorithms/main.py
或者您可以逐个运行每个算法。例如:
python algorithms/get_results_mcrlabs.py
在“algorithms”目录中,您可以找到表中描述的数据收集脚本。
| Algorithm | Organization | Description |
|---|---|---|
| get_results_mcrlabs.py | MCR Labs | Get lab results published by MCR Labs. |
| get_results_psilabs.py | PSI Labs | Get historic lab results published by MCR Labs. |
| get_results_rawgarden.py | Raw Garden | Get lab results Raw Garden publishes for their products. |
| get_results_sclabs.py | SC Labs | Get lab results published by SC Labs. |
| get_results_washington.py | Washington State | Get historic lab results obtained through a FOIA request in Washington State. |
该数据集包括相关大麻持牌人的公共地址和联系信息。使用这些数据点时,要注意合法使用。
可以说,研究大麻可能会产生巨大的社会影响,因此,研究人员和数据使用者在使用此数据时应最小限度地小心。
Cannlytics是一家以盈利为目的的数据和分析公司,主要服务于大麻企业。数据不是随机收集的,因此应考虑抽样偏差。
该数据仅代表大麻实验室结果的一个子集。非标准值被编码如下。
| Actual | Coding |
|---|---|
| 'ND' | 0.000000001 |
| 'No detection in 1 gram' | 0.000000001 |
| 'Negative/1g' | 0.000000001 |
| ' PASS' | 0.000000001 |
| '<LOD' | 0.00000001 |
| '< LOD' | 0.00000001 |
| '<LOQ' | 0.0000001 |
| '< LOQ' | 0.0000001 |
| '<LLOQ' | 0.0000001 |
| '≥ LOD' | 10001 |
| 'NR' | None |
| 'N/A' | None |
| 'na' | None |
| 'NT' | None |
由 🔥Cannlytics dev@cannlytics.com策划
Copyright (c) 2022 Cannlytics and the Cannabis Data Science Team The files associated with this dataset are licensed under a Creative Commons Attribution 4.0 International license. You can share, copy and modify this dataset so long as you give appropriate credit, provide a link to the CC BY license, and indicate if changes were made, but you may not do so in a way that suggests the rights holder has endorsed you or your use of the dataset. Note that further permission may be required for any content within the dataset that is identified as belonging to a third party.
如果您在研究中使用代码示例,请引用以下内容:
@misc{cannlytics2022,
title={Cannabis Data Science},
author={Skeate, Keegan and O'Sullivan-Sutherland, Candace},
journal={https://github.com/cannlytics/cannabis-data-science},
year={2022}
}
感谢 🔥Cannlytics 、 @candy-o 、 @hcadeaux 、 @keeganskeate 、 The CESC 和整个 Cannabis Data Science Team 为他们的贡献。