Skip to content

Commit

Permalink
Resolved conflicts
Browse files Browse the repository at this point in the history
Merge branch 'master' into develop

Conflicts:
	R/Achilles.R
	R/TestAchillesCode.R
	R/TestExportCode.R
	R/exportToJson.R
	inst/sql/sql_server/export_v4/conditionera/sqlConditionEraTreemap.sql
  • Loading branch information
schuemie committed Dec 3, 2014
2 parents d7fa6bd + 6723f50 commit bfb5d2f
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 111 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Achilles
========

Automated Characterization of Health Information at Large-scale Longitudinal Evidence Systems (ACHILLES) - descriptive statistics about a OMOP CDM v4 database

Getting Started
Expand All @@ -9,11 +9,9 @@ Getting Started

1. Make sure you have your data in the [OMOP CDM v4 format](http://omop.org/cdm).

2. Make sure that you have Java installed. If you don't have Java already intalled on your computed (on most computers it already is installed), go to [java.com](http://java.com) to get the latest version.

3. If you're using Windows, make sure you install [RTools](http://cran.r-project.org/bin/windows/Rtools/).
2. Make sure that you have Java installed. If you don't have Java already intalled on your computed (on most computers it already is installed), go to [java.com](http://java.com) to get the latest version. (If you have trouble building with rJava below, be sure on Windows that your Path variable includes the path to jvm.dll (Windows Button --> type "path" --> Edit Environmental Variables --> Edit PATH variable, add to end ;C:/Program Files/Java/jre/bin/server) or wherever it is on your system.)

4. in R, use the following commands to install Achilles:
3. in R, use the following commands to install Achilles:

```r
install.packages("devtools")
Expand All @@ -23,7 +21,7 @@ Getting Started
install_github("ohdsi/Achilles")
```

5. To run the Achilles analysis, use the following commands in R:
4. To run the Achilles analysis, use the following commands in R:

```r
library(Achilles)
Expand All @@ -36,7 +34,7 @@ Getting Started
```
Currently "sql server", "oracle", "postgresql", and "redshift" are supported as dbms.

6. To use [AchillesWeb](https://github.com/OHDSI/AchillesWeb) to explore the Achilles statistics, you must first export the statistics to JSON files:
5. To use [AchillesWeb](https://github.com/OHDSI/AchillesWeb) to explore the Achilles statistics, you must first export the statistics to JSON files:
```r
exportToJson(connectionDetails, "cdm4_inst", "results", "c:/myPath/AchillesExport")
```
Expand Down
209 changes: 105 additions & 104 deletions inst/sql/sql_server/export_v4/condition/sqlConditionTreemap.sql
Original file line number Diff line number Diff line change
@@ -1,104 +1,105 @@
select concept_hierarchy.concept_id,
isNull(concept_hierarchy.soc_concept_name,'NA') + '||' + isNull(concept_hierarchy.hlgt_concept_name,'NA') + '||' + isNull(concept_hierarchy.hlt_concept_name,'NA') + '||' + isNull(concept_hierarchy.pt_concept_name,'NA') + '||' + isNull(concept_hierarchy.snomed_concept_name,'NA') concept_path, ar1.count_value as num_persons,
round(1.0*ar1.count_value / denom.count_value,5) as percent_persons,
round(1.0*ar2.count_value / ar1.count_value,5) as records_per_person
from (select * from ACHILLES_results where analysis_id = 400) ar1
inner join
(select * from ACHILLES_results where analysis_id = 401) ar2
on ar1.stratum_1 = ar2.stratum_1
inner join
(
select snomed.concept_id,
snomed.concept_name as snomed_concept_name,
pt_to_hlt.pt_concept_name,
hlt_to_hlgt.hlt_concept_name,
hlgt_to_soc.hlgt_concept_name,
soc.concept_name as soc_concept_name
from
(
select concept_id, concept_name
from @cdmSchema.dbo.concept
where vocabulary_id = 1
) snomed
left join
(select c1.concept_id as snomed_concept_id, max(c2.concept_id) as pt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 1
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'Preferred Term'
group by c1.concept_id
) snomed_to_pt
on snomed.concept_id = snomed_to_pt.snomed_concept_id

left join
(select c1.concept_id as pt_concept_id, c1.concept_name as pt_concept_name, max(c2.concept_id) as hlt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'Preferred Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'High Level Term'
group by c1.concept_id, c1.concept_name
) pt_to_hlt
on snomed_to_pt.pt_concept_id = pt_to_hlt.pt_concept_id

left join
(select c1.concept_id as hlt_concept_id, c1.concept_name as hlt_concept_name, max(c2.concept_id) as hlgt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'High Level Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'High Level Group Term'
group by c1.concept_id, c1.concept_name
) hlt_to_hlgt
on pt_to_hlt.hlt_concept_id = hlt_to_hlgt.hlt_concept_id

left join
(select c1.concept_id as hlgt_concept_id, c1.concept_name as hlgt_concept_name, max(c2.concept_id) as soc_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'High Level Group Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'System Organ Class'
group by c1.concept_id, c1.concept_name
) hlgt_to_soc
on hlt_to_hlgt.hlgt_concept_id = hlgt_to_soc.hlgt_concept_id

left join @cdmSchema.dbo.concept soc
on hlgt_to_soc.soc_concept_id = soc.concept_id



) concept_hierarchy
on CAST(ar1.stratum_1 AS INT) = concept_hierarchy.concept_id
,
(select count_value from ACHILLES_results where analysis_id = 1) denom

order by ar1.count_value desc
select concept_hierarchy.concept_id,
isNull(concept_hierarchy.soc_concept_name,'NA') + '||' + isNull(concept_hierarchy.hlgt_concept_name,'NA') + '||' + isNull(concept_hierarchy.hlt_concept_name,'NA') + '||' + isNull(concept_hierarchy.pt_concept_name,'NA') + '||' + isNull(concept_hierarchy.snomed_concept_name,'NA') concept_path,
ar1.count_value as num_persons,
round(1.0*ar1.count_value / denom.count_value,5) as percent_persons,
round(1.0*ar2.count_value / ar1.count_value,5) as records_per_person
from (select * from ACHILLES_results where analysis_id = 400) ar1
inner join
(select * from ACHILLES_results where analysis_id = 401) ar2
on ar1.stratum_1 = ar2.stratum_1
inner join
(
select snomed.concept_id,
snomed.concept_name as snomed_concept_name,
pt_to_hlt.pt_concept_name,
hlt_to_hlgt.hlt_concept_name,
hlgt_to_soc.hlgt_concept_name,
soc.concept_name as soc_concept_name
from
(
select concept_id, concept_name
from @cdmSchema.dbo.concept
where vocabulary_id = 1
) snomed
left join
(select c1.concept_id as snomed_concept_id, max(c2.concept_id) as pt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 1
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'Preferred Term'
group by c1.concept_id
) snomed_to_pt
on snomed.concept_id = snomed_to_pt.snomed_concept_id

left join
(select c1.concept_id as pt_concept_id, c1.concept_name as pt_concept_name, max(c2.concept_id) as hlt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'Preferred Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'High Level Term'
group by c1.concept_id, c1.concept_name
) pt_to_hlt
on snomed_to_pt.pt_concept_id = pt_to_hlt.pt_concept_id

left join
(select c1.concept_id as hlt_concept_id, c1.concept_name as hlt_concept_name, max(c2.concept_id) as hlgt_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'High Level Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'High Level Group Term'
group by c1.concept_id, c1.concept_name
) hlt_to_hlgt
on pt_to_hlt.hlt_concept_id = hlt_to_hlgt.hlt_concept_id

left join
(select c1.concept_id as hlgt_concept_id, c1.concept_name as hlgt_concept_name, max(c2.concept_id) as soc_concept_id
from
@cdmSchema.dbo.concept c1
inner join
@cdmSchema.dbo.concept_ancestor ca1
on c1.concept_id = ca1.descendant_concept_id
and c1.vocabulary_id = 15
and c1.concept_class = 'High Level Group Term'
inner join
@cdmSchema.dbo.concept c2
on ca1.ancestor_concept_id = c2.concept_id
and c2.vocabulary_id = 15
and c2.concept_class = 'System Organ Class'
group by c1.concept_id, c1.concept_name
) hlgt_to_soc
on hlt_to_hlgt.hlgt_concept_id = hlgt_to_soc.hlgt_concept_id

left join @cdmSchema.dbo.concept soc
on hlgt_to_soc.soc_concept_id = soc.concept_id



) concept_hierarchy
on CAST(ar1.stratum_1 AS INT) = concept_hierarchy.concept_id
,
(select count_value from ACHILLES_results where analysis_id = 1) denom

order by ar1.count_value desc

0 comments on commit bfb5d2f

Please sign in to comment.