ohdsi / circe Goto Github PK
View Code? Open in Web Editor NEW[Under development] CIRCE is a cohort definition and syntax compiler tool for OMOP CDMv5
License: Apache License 2.0
[Under development] CIRCE is a cohort definition and syntax compiler tool for OMOP CDMv5
License: Apache License 2.0
When I click 'Add' from 'with gender of:' , the 'concept selector' opens up with the domain restricted to 'Gender', which is a very nice feature. However, the list includes all standard and non-standard concepts. It'd be nice to show the standard field to allow sorting/filtering on the value.
Many enhancements to concept selector would likely be addressed once CIRCE is fully integrated with HERMES, so perhaps these can be de-prioritized until that integration is complete.
Add the hermes-like endpoint selector to topnav.
Visible and selectable when on Definition list
Read-only view of selected endpoint when in details.
On change of endpoint, refresh definition list.
Use case:
Condition Occurrence start is On or After 2015-01-01.
Save.
Reverts to Today's date.
This happens whether I type the date manually or use the calendar selection tool.
Hi,
I set up the multihome WebAPI for the first time today using CDM and OHDSI schemas in our Oracle DBMS. Doing various tests with Circe and ran into a possible problem. When generating a cohort that uses any kind of specific date restriction, the generated SQL triggers ORA-01861: literal does not match format string. See a specific example below. I found this did run after wrapping dates with to_date() e.g.,
C.drug_exposure_start_date <= C.drug_exposure_start_date <= to_date('2016-01-01','YYYY-MM-DD')
QUERY THAT FAILED:
CREATE TABLE b804zh31Codesets
AS
SELECT
codeset_id, concept_id
FROM
(SELECT 0 as codeset_id, c.concept_id FROM (SELECT distinct I.concept_id FROM
(SELECT DISTINCT concept_id FROM DIKB_DEV.CONCEPT WHERE concept_id in (40231804) and invalid_reason is null
UNION
SELECT c.concept_id
FROM DIKB_DEV.CONCEPT c
join DIKB_DEV.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id
and ca.ancestor_concept_id in (40231804)
and c.invalid_reason is null
) I
) C
) C
; CREATE TABLE b804zh31PrimaryCriteriaEvents
AS
SELECT
row_number() over (order by P.person_id, P.start_date) as event_id, P.person_id, P.start_date, P.end_date, OP.observation_period_start_date as op_start_date, OP.observation_period_end_date as op_end_date
FROM
(SELECT P.person_id, P.start_date, P.end_date, ROW_NUMBER() OVER (PARTITION BY person_id ORDER BY start_date ASC) ordinal
FROM
(SELECT C.person_id, C.drug_exposure_start_date as start_date, COALESCE(C.drug_exposure_end_date, ( C.drug_exposure_start_date + 1)) as end_date, C.drug_concept_id as TARGET_CONCEPT_ID
FROM
(SELECT de.*, ROW_NUMBER() over (PARTITION BY de.person_id ORDER BY de.drug_exposure_start_date) as ordinal
FROM DIKB_DEV.DRUG_EXPOSURE de
WHERE de.drug_concept_id in (SELECT concept_id FROM b804zh31Codesets WHERE codeset_id = 0 )
) C
WHERE C.drug_exposure_start_date <= '2016-01-01'
) P
) P
JOIN DIKB_DEV.observation_period OP on P.person_id = OP.person_id and P.start_date between OP.observation_period_start_date and op.observation_period_end_date
WHERE (OP.OBSERVATION_PERIOD_START_DATE + 0) <= P.START_DATE AND (P.START_DATE + 0) <= OP.OBSERVATION_PERIOD_END_DATE
; DELETE FROM OHDSI.cohort where cohort_definition_id = 3; INSERT INTO OHDSI.cohort (cohort_definition_id, subject_id, cohort_start_date, cohort_end_date)
SELECT 3 as cohort_definition_id, person_id as subject_id, start_date as cohort_start_date, end_date as cohort_end_date
FROM
(SELECT RawEvents.*, row_number() over (partition by RawEvents.person_id order by RawEvents.start_date ASC) as ordinal
FROM
(SELECT pe.person_id, pe.start_date, pe.end_date
FROM b804zh31PrimaryCriteriaEvents pe
) RawEvents
) Results
currently, it's looking up on VISIT_TYPE_CONCEPT_ID, but should be looking to VISIT_CONCEPT_ID
use case I ran into: I want to define primary criteria based on existance of various observations, and apply additional criteria (as includion rules in CALYPSO) based on how much observation period time exists before the cohort start date and observation period time after cohort start date. Ex: amongst patients with Disease X, how many have at least 6mo of observation prior? how many have at least 12mo of observation after cohort start date?
Currently, each cohort expression criteria determines which field to use as the cohort end date. For example, for condition_occurrence criteria, it uses condition_end_date. For drug_era, it uses drug_era_end_date. One option that was requested was to use the observation_period_end_date that was associated with the event of interest. Another option could be to have the user provide an end date. Still another option could be the user adds a fixed number of days to the end date.
The possibilities are endless, so we need to determine how to give the user this endless flexibility in a webapp.
It might be a good idea to allow users to search within concept sets that are already defined in other cohorts, to reuse them rather than have to recreate them.
deleted
having just clicked the descendants flag 200 times, i'm thinking it'd be nice to 'select all' concepts then check/uncheck descendants flag.
Using latest release version of Firefox (regardless of OS) when you click on the Import button in the Concept Sets editor, and type or copy-paste a concept ID and click on Done either nothing happens, or the concept ID is replaced with "undefined" (see screenshot). You will be stuck in this situation; even if you clear the textbox and press Done to get back to the previous state, nothing happens.
Related to selecting the cohort end_date #34 , some cases may require that we construct eras from the primary events in order to define the cohort_end_date. Need to decide if this era logic is across all primary event criteria, within the criteria itself, of some other option, as well as how to present the user the interface to set these options.
The <title> tag in the HTML header of CIRCE is missing.
Currently, all buttons say 'Add Criterion...'. Due to prior conversations and confusion around the singular vs. plural, I would suggest revising this text to say : 'Add A Criterion...'. That way, its clear you are either adding a criterion and not a set of multiple criteria.
Currently, when setting the 'value as concept' criterion of Measurement, you have to set specific concept IDs that you are looking for. It was requested that this be driven off of a concept set expression instead.
If we split the imported concept set list on any non-numeric, we could support importing comma, tab, newline, dash, or any other type of non-numeric separator. Currently, this only supports commas as the delimiter.
the measurement ratio filters (low range ratio and high range ratio) do not check for if the range value > 0, so can hit divide-by-zero errors. Need to perfrorm error check so query doesn't fail.
Work-around for the time-being: I added extra criteria that requires value_as_number > 0 and high_range > 0.
Request for ability to generate a cohort of limited size. This is not just for slow environments, but for testing other application in development thats utilize cohorts.
The requested function is an input box under generate tab:
Limit cohort to maximum [ ] persons
Where can I find some basic help for using CIRCE.
In the demo instance here http://www.ohdsi.org/web/circe/#
the help link does not do anything
Hi,
Currently the README says:
"The application is configured to access a WebAPI instance running locally on port 8084"
But it seems that it actually configured to hit port 8080. Might be nice to point to where that configuration can be changed like the Atlas README does.
Currently, 'Select concept...' uses a case sensitive search, so 'Acute myocardial infarction' returns a different set than 'acute myocardial infarction'. In HERMES, I think we settled on making search case-insensitive. I'd apply the same convention here (not sure if this issue should be moved to WebAPI).
Please consider adding support for more meta-data. For instance, it would be ideal to be able to assign version numbers to cohort definitions, and associate them with external citations and/or URL of the place where the cohort definition comes from.
When importing concepts, we should check the existing list for duplicates. Duplicates should not be added. Currently, we only check the imported list for duplicates, but if the concept was already in the existing concpet set, the concept ID is added again.
When importing a new concept with JSON, there are 2 Import buttons. Each produce a popup window for JSON entry, but the Done button only functions when using the top Import button. The bottom Import button brings the popup, but the Done button does not appear to work--the JSON popup remains open and the concept cannot be submitted.
When importing a large concept set, it is the typical case that the imported concepts should use the descendant concepts. This means that the user needs to click each concept individually to select the descendants.
The preferred behavior is to have imported concepts use descendants by default.
I have a CIRCE cohort (id 58) (TSH tested people).
I am trying to specify all people who had this CPT code CPT-4 84443.
It is CDMV ConceptID (=CID) of 2212593.
How I define a code set consisting of one code and simply type the code.
Because I am not able to find it due to so many domains and it is not found in any of them.
CIRCE is great in generating the SQL. It would be nice if there would be a button to copy the code into clipboard.
Provide a way to export the cohort expression in a print friendly form.
The purpose of this feature is that after identifying the population and doing an analysis, you want to put into a manuscript the definition of the population along with the statistical results. With a print friendly function, the user could copy-paste the friendly form of the cohort expression into a manuscript.
The reason why you can't do this today with the existing HTML is that there are UI controls such as buttons, dropdowns and textboxes that wouldn't copy over properly to a text document. We need a completely separate view of the cohort expression that is read-only and does not contain any HTML form controls at all.
Additionally, exporting an expression should include all concept sets that have been defined for this cohort expression.
A use case that's come up a couple times for me:
I want to find patients who have concomitant medications, as defined by a drug era of drug A that 'overlaps' the drug era of a different drug B, where overlap = B.end_date > A.start_date AND B.start_date < A.end_date.
More generically, when we define 'primary events', we are producing a cohort-like construct that has COHORT_START_DATE and COHORT_END_DATE. We then allow inclusion criteria to determine qualification based on either a calendar date window, or some defined interval relative to COHORT_START_DATE. It would be useful to also allow the user to defined an interval relative to the COHORT_END_DATE. In this way, for any inclusion criteria from a table that has both a start_date and end_date (CONDITION_OCCURRENCE, CONDITION_ERA, DRUG_EXPOSURE, DRUG_ERA, VISIT_OCCURRENCE), a user could construct criteria to find 'overlapping' episodes.
There is currently no approach for progress indicators in CIRCE, and ideally we would wan to use the same approach across all OHDSI tools. However, for this issue, the development task is to implement a localized (re: in CIRCE) mechanism for displaying a indicator when work is happening, and a way to signal the indicator when the work is done (so that it clears). Once we have a general approach we can create new issues to address specific work-intensive operations that require indicators. (such as saving/loading an expression, importing concept sets, etc.
Not sure where to put this Chris, but if this is the wrong place, let me know. Also, not sure if these are SqlRender. Or, if you want me to put under WebAPI, as the core issue is probably fixed there. Anyway.
Jon and I were generating Cohort SQL from the latest Circe, and we had a couple problems with the Oracle SQL.
Here's the SQL:
CREATE GLOBAL TEMPORARY TABLE Codesets
(
codeset_id int not null,
concept_id int not null
) ON COMMIT PRESERVE ROWS
;
INSERT INTO Codesets
select codeset_id, concept_id
FROM
(
SELECT 0 as codeset_id, c.concept_id FROM (select distinct I.concept_id FROM
(
select DISTINCT concept_id from @CDM_schema.CONCEPT where concept_id in (4115276) and invalid_reason is null
UNION
select c.concept_id
from @CDM_schema.CONCEPT c
join @CDM_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id
and ca.ancestor_concept_id in (4115276)
and c.invalid_reason is null
) I
UNION
select distinct cr.concept_id_2 as concept_id
FROM
(
select distinct I.concept_id FROM
(
select DISTINCT concept_id from @CDM_schema.CONCEPT where concept_id in (4115276) and invalid_reason is null
UNION
select c.concept_id
from @CDM_schema.CONCEPT c
join @CDM_schema.CONCEPT_ANCESTOR ca on c.concept_id = ca.descendant_concept_id
and ca.ancestor_concept_id in (4115276)
and c.invalid_reason is null
) I
) C
join @CDM_schema.concept_relationship cr on C.concept_id = cr.concept_id_1 and cr.relationship_id = 'Mapped from'
) C
) C
;
CREATE GLOBAL TEMPORARY TABLE PrimaryCriteriaEvents
(
person_id NUMBER(19),
start_date datetime,
end_date datetime,
op_start_date datetime,
op_end_date datetime
) ON COMMIT PRESERVE ROWS
;
INSERT INTO PrimaryCriteriaEvents (person_id, start_date, end_date, op_start_date, op_end_date)
SELECT P.person_id, P.start_date, P.end_date, OP.observation_period_start_date, OP.observation_period_end_date
FROM
(
select P.person_id, P.start_date, P.end_date, ROW_NUMBER() OVER (PARTITION BY person_id ORDER BY start_date ASC) ordinal
FROM
(
select C.person_id, C.condition_start_date as start_date, C.condition_end_date as end_date, C.CONDITION_CONCEPT_ID as TARGET_CONCEPT_ID
from
(
select co.*, ROW_NUMBER() over (PARTITION BY co.person_id ORDER BY co.condition_start_date) as ordinal
FROM @CDM_schema.CONDITION_OCCURRENCE co
where co.condition_concept_id in (SELECT concept_id from Codesets where codeset_id = 0)
) C
) P
) P
JOIN @CDM_schema.observation_period OP on P.person_id = OP.person_id and P.start_date between OP.observation_period_start_date and op.observation_period_end_date
WHERE (OP.OBSERVATION_PERIOD_START_DATE + 0) <= P.START_DATE AND (P.START_DATE + 0) <= OP.OBSERVATION_PERIOD_END_DATE
;
DELETE FROM @targetSchema.@targetTable where cohort_definition_id = @cohortDefinitionId;
INSERT INTO @targetSchema.@targetTable (cohort_definition_id, subject_id, cohort_start_date, cohort_end_date)
select @cohortDefinitionId as cohort_definition_id, person_id as subject_id, start_date as cohort_start_date, end_date as cohort_end_date
FROM
(
select Raw.*, row_number() over (partition by Raw.person_id order by Raw.start_date ASC) as ordinal
FROM
(
select person_id, start_date, end_date
FROM PrimaryCriteriaEvents
) Raw
) Results
;
DROP TABLE Codesets;
DROP TABLE PrimaryCriteriaEvents;
The 2 issues we had were:
Hi all,
I am currently busy installing all the OHDSI tools. This is working out fine, WebAPI is running and all other tools are showing up fine in the browser.
The only tool I cannot get to work is CIRCE. I see an empty page (see attachment). I checked the config.js and the webapi is set correctly (same as in the other tools). The source_daimon settings are:
INSERT INTO ohdsi.source (source_id, source_name, source_key, source_connection, source_dialect) VALUES (1, 'cdm_ipci_dopey', 'cdm_ipci_dopey', 'jdbc:postgresql://localhost:5432/CDM-IPCI-DOPEY?user=postgres&password=####', 'postgresql');
Cdm:
INSERT INTO ohdsi.source_daimon (source_daimon_id, source_id, daimon_type, table_qualifier, priority) VALUES (1,1,0, 'cdm', 0);
Vocab:
INSERT INTO ohdsi.source_daimon (source_daimon_id, source_id, daimon_type, table_qualifier, priority) VALUES (2,1,1, 'cdm', 0);
Results
INSERT INTO ohdsi.source_daimon (source_daimon_id, source_id, daimon_type, table_qualifier, priority) VALUES (3,1,2, 'cdm', 0);
All ohdsi webapi tables are in a separate schema 'ohdsi'
Any thoughts what might be the problem?
I also tried to install via OLYMPUS and got it working there (after figuring out the the cdm, cohort and results cannot be the same schema..). However, there is no daimon_type for cohort in the instructions on the forum is this not needed when installing standalone. Could this be the problem??
Thanks
When you click on "New Concept Set" in the Concept Sets editor, the focus should be automatically set to the Name textbox, so you can assign a name to the concept set without additional clicks or keystrokes.
Depends on #38 .
When importing a large concept ID list, there could be several hundred lookups against the service. The UI is still responsive and could allow the user to perform other actions while this operation is in progress (saving while importing would be bad!). Therefore, we need to have a 'working' indicator in place to hold the user off from interacting with the tool until the work is complete.
Measurement criteiria 'has an abnormal value' is not implemented: the WHERE clause is not set with the appropriate sql logic to find abnormal values. The sql should look like this:
where m.value_as_number < m.range_low or m.value_as_number > range high
Currently, CIRCE error handling is shown as a console log. This is barely adequate for developers, but completely unusable for end users. Need to develop some framework or approach for error handling that gives the users the proper feedback when errors occur, and make a best effort in code to recover.
I am not able to add a concept to a concept set using a concept_id.
I know the concept ID that I want to be in the set. it is 378419. I know there was a tiny box to enter it and it is no longer there. I am using the public instance at http://www.ohdsi.org/web/circe/#/166
Use case: I want to define my cohort as patients who have continuous coverage from 1Jan2010 to 31Dec2012, and use that time period as my cohort definition and as the basis for my analysis. So, I want to select all observation periods with observation period start < 1Jan2010 and observation period end > 31Dec2012, but I don't want the cohort start date to become the observation period start date, i want it set to 1Jan2010. this would support analysis requiring incidence/prevalence calculations during defined intervals of time-at-risk.
Use case: a group already has a cohort, which is defined by a set of PERSON_ID. we should be able to import a comma-separated list of PERSON_IDs, and then apply zero or more additional criteria to those patients. The list of PERSON_ID should be joined to OBSERVATION_PERIOD to set cohort_start_date = OBSERVATION_PERIOD_START_DATE and cohort_end_date= OBSERVATION_PERIOD_END_DATE.
CIRCE can help me define a cohort that I can use in my manually crafted SQL code.
I need a query that produces a
select distinct person_id from (pasted-CIRCE-CODE)
But the outputed code has no comments and is hard to follow. (and there is no help)
use case: i want to say that no visit starts or ends within 2 days of index date. currently, i can only specify that visit start not within 2 days of index.
I am unable to save before / after dates for matching events on Circe. They keep resetting to All and All.
To see the error, go to this example:
http://www.ohdsi.org/web/circe/#/976
Try to change the "occurring between" days to any two numbers.
I am unable to get it to stick either locally or on ohdsi.org version of Circe.
When opening up the Concept Picker and you select concepts from page 1 and then switch to another page, only the selected concepts on the page get added to the Concept Set/Concept List.
Steps to Reproduce:
Expected Results:
6 Concepts should be added to the concept set.
Actual Results:
Only the selected, visible concepts (on page 2) are added.
Enhancement Request:
A very helpful feature in CIRCE would be tags, so that cohort definitions could be organized and categorized for specific efforts. In my use case, I am interesting in keeping track of a number of phenotypes for the PENELOPE project. The alphabetical list could be hacked (e.g., PENELOPE- Whatever Cohort) but it's not ideal.
Now I'm trying to parse the raw-text clinical trial eligibility criteria into a structured format. I wonder is is possible to structure the eligibility criteria into a format that can be the input of CIRCE so the free-text criteria can be used to define cohort. Some examples of the parsing results are:
Input Eligibility criteria text:
1. Age: 18-60 years.
2. Patients with CNS disease or testicular disease are eligible.
Output after parsing:
Concept, Semantic group, Constraints
age, Person, 18-60 yo
CNS disease, Condition, /
testicular disease, Condition, /
The problem is that some concepts in criteria are not covered in existing terminologies and can’t be mapped to a concept id. So I wonder is there anyway to structure my parsing results (e.g. a SQL format) so that they can be directly used by CIRCE?
Thanks.
Currently, interface says 'codeset' but in fact, it is creating an expression that returns a set of concepts. I'd recommend relabeling this is 'conceptset'.
Since unique choices and circumstances are often involved in creating a concept set, it may be helpful to be able to include a description and, perhaps even better, attach a document that describes how this concept set was defined.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.