导师/临床试验

临床试验 Web 服务 Guzzle 客户端

dev-master 2018-04-19 18:34 UTC

This package is not auto-updated.

Last update: 2024-09-21 08:59:54 UTC


README

提供 Guzzle 库查询临床试验 Web 服务的实现。

NCI 临床试验搜索 API 若要了解 NCI 改善患者和肿瘤学家查找信息以及了解癌症临床试验的举措,请访问:https://www.cancer.gov/syndication/api

用法

要使用临床试验 API 客户端,只需实例化客户端。

<?php

require dirname(__FILE__).'/../vendor/autoload.php';

use Tutor\ClinicalTrials\ClinicalTrialsClient;
$client = ClinicalTrialsClient::factory();

// if you want to see what is happening, add debug => true to the factory call
$client = ClinicalTrialsClient::factory(['debug' => true]);

使用 __call 方法调用命令(包括自动完成的 phpDocs)

<?php

$client = ClinicalTrialsClient::factory();
$response = $client->query([
  'brief_title_fulltext' => 'diabetes',
]);

或使用 getCommand 方法(在这种情况下,您需要处理 $response['data'] 数组)

<?php

$client = ClinicalTrialsClient::factory();

//Retrieve the Command from Guzzle
$command = $client->getCommand('Query', [
  'brief_title_fulltext' => 'diabetes',
]);
$command->prepare();

$response = $command->execute();

$data = $response['data'];

示例

您可以在示例目录中执行示例。

您可以通过查看 services.json 获取有关可用方法和调用它们的参数的详细信息。

https://clinicaltrialsapi.cancer.gov/v1/clinical-trials?eligibility.structured.gender=female&brief_summary_fulltext="diabetes"

<?php

$client = ClinicalTrialsClient::factory();
$response = $client->query([
  'eligibility.structured.gender' => 'female',
  'brief_summary_fulltext' => 'diabetes',
]);

待办事项

  • 添加所有查询字段
  • 添加更多示例
  • 添加测试
  • 添加一些响应模型

欢迎贡献

发现了一个错误,请提交问题,最好附带调试输出和您所做操作。修复错误?请提交拉取请求,我将调查。

许可证

ClinicalTrials\ClinicalTrialsClient API 客户端的使用受 MIT 许可证的约束。