The current analysis (425 for condition_occurrence) is just calculating record counts, not person counts. Standard or non-standard concepts is not relevant here, it just takes the condition_source_concept_id
from condition occurrence and writes it to the achilles results as analysis_id = 425
. This analysis is referenced in the achilles_result_concept_count script.
However, if you check the section on the counts_person
CTE, it is picking a much smaller list of analysis_ids, and those related to distinct persons with at least one concept_id from the given domain. (example: Analysis 400 is condition, 600 is procedure, 700 is drug, etc).
The change would be to add a new analysis to calculate person counts (like 400) but using the condition_source_concept column. You can take the analysis 400 sql, and just change it to use condition_source concept. You’ll need to define a new analysis id, I think 440 works and you can do this for the other domains (600-> 640, … 700->740…etc). this will make the analysis that end in *40.sql the analysis for distinct people by source_concept.
The next step is to make Achilles execute those analyses during the call to achilles()
, and this is controlled in the achilles_analysis_details.csv file.
So, the order of changes are:
- Copy the existing person count analysis into a new file, and name that file the new analysis ID. Example: condition_occurrence condition_concept_id (400.sql) copied to 440.sql, and modify the script to use the condition_source_concept_id column.
- Update achilles_analysis_details.csv bo copying the row of the analysis you are copying from, and add a new row but specify the
{domain}_source_concept
as the stratum_1 value. Also make the name of the analysis 'Number of persons with at least one {domain} by {domain}_source_concept
Once you have the results generated, we’ll need to modify the WebAPI achilles_result_concept_count
script to incorporate the new analysis_ids you’ve defined (440, 640, 740, etc).
Hope that makes sense! Happy to help if you have any other questions.