Tooling to execute CQL-like Python against FHIR resources.
Project description
CQLpy
CQLpy is a Python implementation of the Clinical Quality Language (CQL). It is intended to be a complete implementation of the CQL specification and is currently in development.
See CONTRIBUTING.md for information on contributing to this project.
Installation
pip install cqlpy
Usage
from cqlpy.context import Context
from cqlpy.providers import RosettaValuesetProvider
rosetta = RosettaValuesetProvider("<api-key>")
context = Context(rosetta, bundle_file_name="./fhir-bundle.json")
office_visit_valueset = ValueSet("http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001")
office_visits = context["Encounter", office_visit_valueset, "type"]
See cqlpy_syntax_basics for more examples.
Specification Implementation
1. Types
- 1.1. Any
- 1.2. Boolean
- 1.3. Code
- 1.4. CodeSystem
- 1.5. Concept
- 1.6. Date
- 1.7. DateTime
- 1.8. Decimal
- 1.9. Long
- 1.10. Integer
- 1.11. Quantity
- 1.12. Ratio
- 1.13. String
- 1.14. Time
- 1.15. ValueSet
- 1.16. Vocabulary
2. Logical Operators
3. Type Operators
- 3.1. As
- 3.2. Children
- 3.3. Convert
- 3.4. Descendents
- 3.5. Is
- 3.6. CanConvertQuantity
- 3.7. ConvertQuantity
- 3.8. ConvertsToBoolean
- 3.9. ConvertsToDate
- 3.10. ConvertsToDateTime
- 3.11. ConvertsToDecimal
- 3.12. ConvertsToLong
- 3.13. ConvertsToInteger
- 3.14. ConvertsToQuantity
- 3.15. ConvertsToString
- 3.16. ConvertsToTime
- 3.17. ToBoolean
- 3.18. ToConcept
- 3.19. ToDate
- 3.20. ToDateTime
- 3.21. ToDecimal
- 3.22. ToLong
- 3.23. ToInteger
- 3.24. ToQuantity
- 3.25. ToString
- 3.26. ToTime
4. Nullological Operators
5. Comparison Operators
- 5.1. Between
- 5.2. Equal
- 5.3. Equivalent
- 5.4. Greater
- 5.5. Greater Or Equal
- 5.6. Less
- 5.7. Less Or Equal
- 5.8. Not Equal
- 5.9. Not Equivalent
6. Arithmetic Operators
- 6.1. Abs
- 6.2. Add
- 6.3. Ceiling
- 6.4. Divide
- 6.5. Floor
- 6.6. Exp
- 6.7. HighBoundary
- 6.8. Log
- 6.9. LowBoundary
- 6.10. Ln
- 6.11. Maximum
- 6.12. Minimum
- 6.13. Modulo
- 6.14. Multiply
- 6.15. Negate
- 6.16. Precision
- 6.17. Predecessor
- 6.18. Power
- 6.19. Round
- 6.20. Subtract
- 6.21. Successor
- 6.22. Truncate
- 6.23. Truncated Divide
7. String Operators
- 7.1. Combine
- 7.2. Concatenate
- 7.3. EndsWith
- 7.4. Indexer
- 7.5. LastPositionOf
- 7.6. Length
- 7.7. Lower
- 7.8. Matches
- 7.9. PositionOf
- 7.10. ReplaceMatches
- 7.11. Split
- 7.12. SplitOnMatches
- 7.13. StartsWith
- 7.14. Substring
- 7.15. Upper
8. Date and Time Operators
- 8.1. Add
- 8.2. After
- 8.3. Before
- 8.4. Date
- 8.5. DateTime
- 8.6. Date and Time Component From
- 8.7. Difference
- 8.8. Duration
- 8.9. Now
- 8.10. On Or After
- 8.11. On Or Before
- 8.12. Same As
- 8.13. Same Or After
- 8.14. Same Or Before
- 8.15. Subtract
- 8.16. Time
- 8.17. TimeOfDay
- 8.18. Today
9. Interval Operators
- 9.1. After
- 9.2. Before
- 9.3. Collapse
- 9.4. Contains
- 9.5. End
- 9.6. Ends
- 9.7. Equal
- 9.8. Equivalent
- 9.9. Except
- 9.10. Expand
- 9.11. In
- 9.12. Includes
- 9.13. Included In
- 9.14. Intersect
- 9.15. Meets
- 9.16. Not Equal
- 9.17. Not Equivalent
- 9.18. On Or After
- 9.19. On Or Before
- 9.20. Overlaps
- 9.21. Point From
- 9.22. Properly Includes
- 9.23. Properly Included In
- 9.24. Same As
- 9.25. Same Or After
- 9.26. Same Or Before
- 9.27. Size
- 9.28. Start
- 9.29. Starts
- 9.30. Union
- 9.31. Width
10. List Operators
- 10.1. Contains
- 10.2. Distinct
- 10.3. Equal
- 10.4. Equivalent
- 10.5. Except
- 10.6. Exists
- 10.7. Flatten
- 10.8. First
- 10.9. In
- 10.10. Includes
- 10.11. Included In
- 10.12. Indexer
- 10.13. IndexOf
- 10.14. Intersect
- 10.15. Last
- 10.16. Length
- 10.17. Not Equal
- 10.18. Not Equivalent
- 10.19. Properly Includes
- 10.20. Properly Included In
- 10.21. Singleton From
- 10.22. Skip
- 10.23. Tail
- 10.24. Take
- 10.25. Union
11. Aggregate Functions
- 11.1. AllTrue
- 11.2. AnyTrue
- 11.3. Avg
- 11.4. Count
- 11.5. GeometricMean
- 11.6. Max
- 11.7. Min
- 11.8. Median
- 11.9. Mode
- 11.10. Population StdDev
- 11.11. Population Variance
- 11.12. Product
- 11.13. StdDev
- 11.14. Sum
- 11.15. Variance
12. Clinical Operators
- 12.1. Age
- 12.2. AgeAt
- 12.3. CalculateAge
- 12.4. CalculateAgeAt
- 12.5. Equal
- 12.6. Equivalent
- 12.7. In (Codesystem)
- 12.8. ExpandValueSet (ValueSet)
- 12.9. In (Valueset)
13. Errors and Messaging
- 13.1. Message
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cqlpy-0.3.0.tar.gz
(80.5 kB
view hashes)
Built Distribution
cqlpy-0.3.0-py3-none-any.whl
(115.8 kB
view hashes)