Skip to content

Commit

Permalink
initial check-in of PHP codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Mar 12, 2016
1 parent bfa6fc3 commit d3ddad8
Show file tree
Hide file tree
Showing 16 changed files with 2,684 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*~
*.patch
/vendor/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 The Regents of the University of California

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# MeSH Parser

This PHP code library provides tools for extracting [Medical Subject Headings](https://www.nlm.nih.gov/mesh/) (MeSH) descriptors
and associated data from a given XML file into an object representation.

It expects its input to be provided in 2016 version of the MeSH Descriptors XML format.

## Installation

_TODO_

## Usage

_TODO_

## Example

```php
<?php

require __DIR__ . '/vendor/autoload.php';

// instantiate the parser
$parser = new \Ilios\MeSH\Parser();

// provide an URL or a local file path.
//$uri = 'ftp://nlmpubs.nlm.nih.gov/online/mesh/.xmlmesh/desc2016.xml';
$uri = __DIR__ . '/desc2016.xml';

$set = $parser->parse($uri);

// process parsed data, e.g.
$descriptor = $set->findDescriptorByUi('D000001');
echo "Descriptor ID (Name): {$descriptor->getUi()} ({$descriptor->getName()})\n";
$concepts = $descriptor->getConcepts();
foreach($concepts as $concept) {
echo "- Concept ID (Name): {$concept->getUi()} ({$concept->getName()})\n";
$terms = $concept->getTerms();
foreach ($terms as $term) {
// ...
}
}
```

## Legacy parser

_TODO_
29 changes: 29 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "ilios/mesh-parser",
"type": "library",
"description": "PHP library for extracting MeSH descriptors from XML.",
"keywords": [
"Ilios",
"MeSH"
],
"homepage": "http://iliosproject.org/",
"license": "MIT",
"authors": [
{
"name": "Stefan Topfstedt",
"email": "[email protected]",
"role": "developer"
}
],
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.7.0"
},
"autoload": {
"psr-4": {
"": "src/"
}
}
}
Loading

0 comments on commit d3ddad8

Please sign in to comment.