Package: cqlpy
CQLpyCQLpy is a Python implementation of theClinical Quality Language (CQL). It is intended to be a complete implementation of the CQL specification and is currently in development.SeeCONTRIBUTING.mdfor information on contributing to this project.InstallationpipinstallcqlpyUsagefromcqlpy.contextimportContextfromcqlpy.providersimportRosettaValuesetProviderrosetta=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"]Seecqlpy_syntax_basicsfor more examples.Specification Implementation1. Types1.1.Any1.2.Boolean1.3.Code1.4.CodeSystem1.5.Concept1.6.Date1.7.DateTime1.8.Decimal1.9.Long1.10.Integer1.11.Quantity1.12.Ratio1.13.String1.14.Time1.15.ValueSet1.16.Vocabulary2. Logical Operators2.1.And2.2.Implies2.3.Not2.4.Or2.5.Xor3. Type Operators3.1.As3.2.Children3.3.Convert3.4.Descendents3.5.Is3.6.CanConvertQuantity3.7.ConvertQuantity3.8.ConvertsToBoolean3.9.ConvertsToDate3.10.ConvertsToDateTime3.11.ConvertsToDecimal3.12.ConvertsToLong3.13.ConvertsToInteger3.14.ConvertsToQuantity3.15.ConvertsToString3.16.ConvertsToTime3.17.ToBoolean3.18.ToConcept3.19.ToDate3.20.ToDateTime3.21.ToDecimal3.22.ToLong3.23.ToInteger3.24.ToQuantity3.25.ToString3.26.ToTime4. Nullological Operators4.1.Coalesce4.2.IsNull4.3.IsFalse4.4.IsTrue5. Comparison Operators5.1.Between5.2.Equal5.3.Equivalent5.4.Greater5.5.Greater Or Equal5.6.Less5.7.Less Or Equal5.8.Not Equal5.9.Not Equivalent6. Arithmetic Operators6.1.Abs6.2.Add6.3.Ceiling6.4.Divide6.5.Floor6.6.Exp6.7.HighBoundary6.8.Log6.9.LowBoundary6.10.Ln6.11.Maximum6.12.Minimum6.13.Modulo6.14.Multiply6.15.Negate6.16.Precision6.17.Predecessor6.18.Power6.19.Round6.20.Subtract6.21.Successor6.22.Truncate6.23.Truncated Divide7. String Operators7.1.Combine7.2.Concatenate7.3.EndsWith7.4.Indexer7.5.LastPositionOf7.6.Length7.7.Lower7.8.Matches7.9.PositionOf7.10.ReplaceMatches7.11.Split7.12.SplitOnMatches7.13.StartsWith7.14.Substring7.15.Upper8. Date and Time Operators8.1.Add8.2.After8.3.Before8.4.Date8.5.DateTime8.6.Date and Time Component From8.7.Difference8.8.Duration8.9.Now8.10.On Or After8.11.On Or Before8.12.Same As8.13.Same Or After8.14.Same Or Before8.15.Subtract8.16.Time8.17.TimeOfDay8.18.Today9. Interval Operators9.1.After9.2.Before9.3.Collapse9.4.Contains9.5.End9.6.Ends9.7.Equal9.8.Equivalent9.9.Except9.10.Expand9.11.In9.12.Includes9.13.Included In9.14.Intersect9.15.Meets9.16.Not Equal9.17.Not Equivalent9.18.On Or After9.19.On Or Before9.20.Overlaps9.21.Point From9.22.Properly Includes9.23.Properly Included In9.24.Same As9.25.Same Or After9.26.Same Or Before9.27.Size9.28.Start9.29.Starts9.30.Union9.31.Width10. List Operators10.1.Contains10.2.Distinct10.3.Equal10.4.Equivalent10.5.Except10.6.Exists10.7.Flatten10.8.First10.9.In10.10.Includes10.11.Included In10.12.Indexer10.13.IndexOf10.14.Intersect10.15.Last10.16.Length10.17.Not Equal10.18.Not Equivalent10.19.Properly Includes10.20.Properly Included In10.21.Singleton From10.22.Skip10.23.Tail10.24.Take10.25.Union11. Aggregate Functions11.1.AllTrue11.2.AnyTrue11.3.Avg11.4.Count11.5.GeometricMean11.6.Max11.7.Min11.8.Median11.9.Mode11.10.Population StdDev11.11.Population Variance11.12.Product11.13.StdDev11.14.Sum11.15.Variance12. Clinical Operators12.1.Age12.2.AgeAt12.3.CalculateAge12.4.CalculateAgeAt12.5.Equal12.6.Equivalent12.7.In (Codesystem)12.8.ExpandValueSet (ValueSet)12.9.In (Valueset)13. Errors and Messaging13.1.Message