crawlab_ruby_sdk 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ab07d443a57759aabbf8fd96fd7f8d50fd8b540dcc3c21762cb775eb43b702d
4
- data.tar.gz: c00cbf3d27a1121b83a24eb22cb62d477529d7ab4cb9c331653d9bd77ab50e3d
3
+ metadata.gz: 8a8a13a3f737d83e2547ec4af2b37e9aa8d13617706a3e64e824cfd6566479c7
4
+ data.tar.gz: 3af07a54a492c7d7c1028b2a73bf1602249c8bd44e3a59846fdaa6b1f2e645e6
5
5
  SHA512:
6
- metadata.gz: 3cef20ce95c9d77c6288f4c8b5a371d7204d0d701a5249626b40ab77ac04c90b90184240de55c4aff8a395d50f462054c0682f8306cec19578a04e3cbdcd77bf
7
- data.tar.gz: f60a2a02e8b81258ed58dd32d129688006af5b8cb14666458bf322dd24ec7547d479de496d16e24fc8c80ad477b085b78921abb515ce21c10428374e1f3107d5
6
+ metadata.gz: ba149da4c964d7ae66831af19210aee7b875afbbe6a15dee902e2c99aabcd184a48d612e39719c804d09e23a412f0583b62860a710073d7693888bc238e7d5f9
7
+ data.tar.gz: 327747c5ddec02a6670db0b89de1eeb14c64561ac214a74733a28a9b8810cdb89b90f234e45cf92b9d6b65b9d6a10b70b3f4e6e60cf598a58b8038b71ff98736
data/README.md CHANGED
@@ -22,7 +22,22 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- CrawlabRubySdk.save_item(item={})
25
+ ```
26
+ CrawlabRubySdk.save_item({name: "haha",age:12})
27
+
28
+ CrawlabRubySdk.save_items([{name: "haha",age:12},{name:"456",age:34}])
29
+
30
+ oss_path = "thinkthank_files/files/1123123123.pdf"
31
+ file_path = "/home/min/Downloads/RAND_RRA1218-2.pdf"
32
+ bucket_url = CrawlabRubySdk.save_file_to_oss(oss_path,file_path)
33
+ puts bucket_url
34
+
35
+ oss_path = "thinkthank_files/files/456.pdf"
36
+ res = RestClient.get("https://www.rand.org/content/dam/rand/pubs/research_reports/RRA1200/RRA1218-2/RAND_RRA1218-2.pdf")
37
+ stream = res.body
38
+ bucket_url = CrawlabRubySdk.save_file_stream_to_oss(oss_path,stream)
39
+ puts bucket_url
40
+ ```
26
41
 
27
42
  ## Development
28
43
 
@@ -1,3 +1,3 @@
1
1
  module CrawlabRubySdk
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -91,6 +91,9 @@ module CrawlabRubySdk
91
91
 
92
92
  data = {task_id: task_id,data:records}.to_json
93
93
 
94
+ data = data.encode('ASCII-8BIT', invalid: :replace, undef: :replace, replace: '?')
95
+ # puts data
96
+
94
97
  msg = Grpc::StreamMessage.new(code:3,data:data)
95
98
 
96
99
  sub_client.Send([msg])
data/ruby_sdk_test.rb ADDED
@@ -0,0 +1,56 @@
1
+
2
+
3
+ require 'crawlab_ruby_sdk'
4
+ def main
5
+
6
+ a = {
7
+ "name": "haha",
8
+ "age": 12,
9
+ }
10
+
11
+ CrawlabRubySdk.save_item(a)
12
+
13
+ item = {
14
+ "id": "dec9d5415409cc9275f5590c145c3ccf",
15
+ "title": "Association of Selected State Policies and Requirements for Buprenorphine Treatment With Per Capita Months of Treatment",
16
+ "thinktank_en_name": "RAND Corporation",
17
+ "thinktank_cn_name": "兰德公司",
18
+ "abstract": "",
19
+ "content": "Importance\nExpanding the use of buprenorphine for treating opioid use disorder is a critical component of the US response to the opioid crisis, but few studies have examined how state policies are associated with buprenorphine dispensing.\nObjective\nTo examine the association of 6 selected state policies with the rate of individuals receiving buprenorphine per 1000 county residents.\nDesign, Setting, and Participants\nThis cross-sectional study used 2006 to 2018 US retail pharmacy claims data for individuals dispensed buprenorphine formulations indicated for treating opioid use disorder.\nExposures\nState implementation of policies requiring additional education for buprenorphine prescribers beyond waiver training, continuing medical education related to substance misuse and addiction, Medicaid coverage of buprenorphine, Medicaid expansion, mandatory prescriber use of prescription drug monitoring programs, and pain management clinic laws were examined.\nMain Outcomes and Measures\nThe main outcome was buprenorphine treatment months per 1000 county residents as measured using multivariable longitudinal models. Statistical analyses were conducted from September 1, 2021, through April 30, 2022, with revised analyses conducted through February 28, 2023.\nResults\nThe mean (SD) number of months of buprenorphine treatment per 1000 persons nationally increased steadily from 1.47 (0.04) in 2006 to 22.80 (0.55) in 2018. Requiring that buprenorphine prescribers receive additional education beyond that required to obtain the federal X-waiver was associated with significant increases in the number of months of buprenorphine treatment per 1000 population in the 5 years following implementation of the requirement (from 8.51 [95% CI, 2.36-14.64] months in year 1 to 14.43 [95% CI, 2.61-26.26] months in year 5). Requiring continuing medical education for physician licensure related to substance misuse or addiction was associated with significant increases in buprenorphine treatment per 1000 population in each of the 5 years following policy implementation (from 7.01 [95% CI, 3.17-10.86] months in the first year to 11.43 [95% CI, 0.61-22.25] months in the fifth year). None of the other policies examined was associated with a significant change in buprenorphine months of treatment per 1000 county residents.\nResults\nIn this cross-sectional study of US pharmacy claims, state-mandated educational requirements beyond the initial training required to prescribe buprenorphine were associated with increased buprenorphine use over time. The findings suggest requiring education for buprenorphine prescribers and training in substance use disorder treatment for all controlled substance prescribers as an actionable proposal for increasing buprenorphine use, ultimately serving more patients. No single policy lever can ensure adequate buprenorphine supply; however, policy maker attention to the benefits of enhancing clinician education and knowledge may help to expand buprenorphine access.",
20
+ "authors": "Bradley D. Stein,Brendan Saloner,Olivia Golan,Barbara Andraka-Christou,Christina Andrews,Andrew W. Dick,Corey S. Davis,Yaou Flora Sheng,Adam J. Gordon",
21
+ "url": "https://www.rand.org/pubs/external_publications/EP70097.html",
22
+ "file_url": "",
23
+ "images": "[\"https://www.rand.org/content/dam/rand/pubs/external_publications/external_publications.gif\"]",
24
+ "links": "",
25
+ "domain": "rand.org",
26
+ "sub_domain": "www.rand.org",
27
+ "keywords": "[]",
28
+ "html_content": "<div class=\"product-main\">\n <div class=\"abstract product-page-abstract\">\n<h2>Importance</h2>\n<p>Expanding the use of buprenorphine for treating opioid use disorder is a critical component of the US response to the opioid crisis, but few studies have examined how state policies are associated with buprenorphine dispensing.</p>\n<h2>Objective</h2>\n<p>To examine the association of 6 selected state policies with the rate of individuals receiving buprenorphine per 1000 county residents.</p>\n<h2>Design, Setting, and Participants</h2>\n<p>This cross-sectional study used 2006 to 2018 US retail pharmacy claims data for individuals dispensed buprenorphine formulations indicated for treating opioid use disorder.</p>\n<h2>Exposures</h2>\n<p>State implementation of policies requiring additional education for buprenorphine prescribers beyond waiver training, continuing medical education related to substance misuse and addiction, Medicaid coverage of buprenorphine, Medicaid expansion, mandatory prescriber use of prescription drug monitoring programs, and pain management clinic laws were examined.</p>\n<h2>Main Outcomes and Measures</h2>\n<p>The main outcome was buprenorphine treatment months per 1000 county residents as measured using multivariable longitudinal models. Statistical analyses were conducted from September 1, 2021, through April 30, 2022, with revised analyses conducted through February 28, 2023.</p>\n<h2>Results</h2>\n<p>The mean (SD) number of months of buprenorphine treatment per 1000 persons nationally increased steadily from 1.47 (0.04) in 2006 to 22.80 (0.55) in 2018. Requiring that buprenorphine prescribers receive additional education beyond that required to obtain the federal X-waiver was associated with significant increases in the number of months of buprenorphine treatment per 1000 population in the 5 years following implementation of the requirement (from 8.51 [95% CI, 2.36-14.64] months in year 1 to 14.43 [95% CI, 2.61-26.26] months in year 5). Requiring continuing medical education for physician licensure related to substance misuse or addiction was associated with significant increases in buprenorphine treatment per 1000 population in each of the 5 years following policy implementation (from 7.01 [95% CI, 3.17-10.86] months in the first year to 11.43 [95% CI, 0.61-22.25] months in the fifth year). None of the other policies examined was associated with a significant change in buprenorphine months of treatment per 1000 county residents.</p>\n<h2>Results</h2>\n<p>In this cross-sectional study of US pharmacy claims, state-mandated educational requirements beyond the initial training required to prescribe buprenorphine were associated with increased buprenorphine use over time. The findings suggest requiring education for buprenorphine prescribers and training in substance use disorder treatment for all controlled substance prescribers as an actionable proposal for increasing buprenorphine use, ultimately serving more patients. No single policy lever can ensure adequate buprenorphine supply; however, policy maker attention to the benefits of enhancing clinician education and knowledge may help to expand buprenorphine access.</p>\n</div>\n\n\t\n\t\n\n\n\n\t\n\t\n\n<!--indicia-->\n\n</div>",
29
+ "lang": "en",
30
+ "country": "美国",
31
+ "created_at": 1686240102,
32
+ "updated_at": 1686240102,
33
+ "created_time": 1686200400,
34
+ "time_zone": "GMT",
35
+ "files": "",
36
+ "image_url": "",
37
+ "link_url": "",
38
+ "category": "External Publications",
39
+ "topics": "[\"Health Care Delivery Approaches\",\"Opioids\",\"Substance Use Harm Reduction\"]",
40
+ "tags": "[]",
41
+ "views": 0,
42
+ "comments": 0,
43
+ "reference": "[]",
44
+ "mention_country": "",
45
+ "author_hash": "[{\"author_id\":\"30aaa313a71dc5436a9e3ab469161a7e\",\"author_name\":\"Bradley D. Stein\",\"author_url\":\"https://www.rand.org/about/people/s/stein_bradley.html\"},{\"author_id\":\"d9ebdb0fdfd05cf4c0f22c5ba5451ed2\",\"author_name\":\"Brendan Saloner\",\"author_url\":\"https://www.rand.org/pubs/authors/s/saloner_brendan.html\"},{\"author_id\":\"fbcf61c351d37b7a58a049c775d989db\",\"author_name\":\"Olivia Golan\",\"author_url\":\"https://www.rand.org/pubs/authors/g/golan_olivia_.html\"},{\"author_id\":\"e80169af03f5f386f64de453313a98f5\",\"author_name\":\"Barbara Andraka-Christou\",\"author_url\":\"https://www.rand.org/pubs/authors/a/andraka-christou_barbara.html\"},{\"author_id\":\"bbe5d7288bc1b2dcca636fa63dad7661\",\"author_name\":\"Christina Andrews\",\"author_url\":\"https://www.rand.org/pubs/authors/a/andrews_christina.html\"},{\"author_id\":\"45b98f50891032ad05fc642dd663a759\",\"author_name\":\"Andrew W. Dick\",\"author_url\":\"https://www.rand.org/about/people/d/dick_andrew.html\"},{\"author_id\":\"6c7daa9e6a27ed721691f4e3a5df9039\",\"author_name\":\"Corey S. Davis\",\"author_url\":\"https://www.rand.org/pubs/authors/d/davis_corey_s.html\"},{\"author_id\":\"19ef02f964b7c7f44ba0007c3488ce2e\",\"author_name\":\"Yaou Flora Sheng\",\"author_url\":\"https://www.rand.org/about/people/s/sheng_yaou_flora.html\"},{\"author_id\":\"f41e7da2ef20cd8ac7a2e6b2c3c7ae89\",\"author_name\":\"Adam J. Gordon\",\"author_url\":\"https://www.rand.org/pubs/authors/g/gordon_adam_j.html\"}]",
46
+ "sub_title": "",
47
+ "timezone_location": "Etc/GMT",
48
+ "videos": "[]",
49
+ "audios": "",
50
+ }
51
+ CrawlabRubySdk.save_item(item)
52
+
53
+
54
+ end
55
+
56
+ main
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crawlab_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - min
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2023-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -96,7 +96,7 @@ files:
96
96
  - lib/entity/stream_message_pb.rb
97
97
  - lib/models/node_pb.rb
98
98
  - lib/models/task_pb.rb
99
- - test_grpc_client.rb
99
+ - ruby_sdk_test.rb
100
100
  homepage: https://github.com/rich-bro/crawlab_ruby_sdk
101
101
  licenses: []
102
102
  metadata:
data/test_grpc_client.rb DELETED
@@ -1,41 +0,0 @@
1
-
2
-
3
- require 'crawlab_ruby_sdk'
4
- require 'rest-client'
5
- def main
6
- # CrawlabRubySdk.save_item({name: "haha",age:12})
7
-
8
- # CrawlabRubySdk.save_items([{name: "haha",age:12},{name:"456",age:34}])
9
- # ENV.each do |k,v|
10
- # puts "#{k}=#{v}"
11
- # end
12
-
13
- # oss_path = "thinkthank_files/files/1123123123.pdf"
14
- # file_path = "/home/min/Downloads/RAND_RRA1218-2.pdf"
15
- # bucket_url = CrawlabRubySdk.save_file_to_oss(oss_path,file_path)
16
- # puts bucket_url
17
-
18
- # oss_path = "thinkthank_files/files/456.pdf"
19
- # res = RestClient.get("https://www.rand.org/content/dam/rand/pubs/research_reports/RRA1200/RRA1218-2/RAND_RRA1218-2.pdf")
20
- # stream = res.body
21
-
22
- # file = File.open("/home/min/Downloads/aa.pdf","w")
23
-
24
- # file.write(stream)
25
- # file.close
26
- # bucket_url = CrawlabRubySdk.save_file_stream_to_oss(oss_path,stream)
27
- # puts bucket_url
28
-
29
-
30
- endpoint = ENV["CRAWLAB_OSS_ENDPOINT"] = ""
31
- access_key_id = ENV["CRAWLAB_OSS_ACCESS_KEY"] = ""
32
- access_key_secret = ENV["CRAWLAB_OSS_SECRET"] = ""
33
- bucket = ENV["CRAWLAB_OSS_BUCKET"] = ""
34
-
35
- a = OssServerClient.new
36
-
37
- a.bucket.get_object("thinkthank_files/files/789.pdf", :file => "/home/min/Downloads/2-2.pdf")
38
-
39
- end
40
-
41
- main