Changelog for hasklepias
0.4.3
- Exports
Feature constructor.
- Adds
defineFEF2 function for creating a feature definition where the provided function returns a Feature d rather than just a d.
- Generalizes
allPairs from type [a] -> [a] -> [(a, a)] to [a] -> [b] -> [(a, b)].
- Reexports a few functions and types from
Data.Time.Calendar. Also reexports const from Data.Function.
0.4.2
- Updates
interval-algebra to 0.8.0
0.4.1
- Modifies the example in
example/ExampleFeatures3 to use the pipe |> operator.
- Adds the
hasAllConcepts function to the HasConcepts class.
- Adds a
Reexports module with the goal to re-export everything one might need from other Haskell libraries to build a cohort.
- Removes a number of unneeded/unused functions from the
Functions module.
- Adds the
Safe language extension to modules where possible.
0.4.0
- Adds the
FeatureDefinition to represent common patterns for building Features:
data FeatureDefinition e a d =
EF (Events a -> Feature d)
| FEF (Feature e -> Events a -> Feature d)
- Provides an initial set of functions designed to make defining
Features easier, namely defineEF and defineFEF. These functions construct FeatureDefinitions of using EF and FEF constructors, respectively. The example features in examples/ExampleFeatures1 demonstrate their use.
- Adds the
allPairs function to form all pairs of elements of two lists.
- Adds the
splitByConcepts to split a container of events into a pair such that first element contains
events have any of the first argument's concepts, and similarly for the second element.
- Demonstrates how
allPairs and splitByConcepts might be used in the examples/ExampleFeatures3 module.
- Adds a rudimentary
ToJSON instance for Features so that data can be encoded and output from the software. This is pretty rough; e.g. encoding an Interval Int feature produces: "{\"end\":10,\"begin\":0}".
- Removes the
Transformations module and transformToMeetingSequence function. The same functionality is available by using the formMeetingSequence function from interval-algebra. See examples/ExampleFeatures2 for the updated example.
- Adds the
toConceptEventOf function which creates a ConceptEvent but takes the intersection of Concepts in the first argument and concepts in the context of the Event in the second argument to form the new ConceptEvent. This is a way to keep only those concepts you need in the event.
0.3.0
- Updates code as needed to work with interval-algebra v0.6.2. In particular, the
Event a is now a synonym for PairedInterval Context a, hence any methods that work on the PairedInterval also work for the Event type.
- Adds the
ConceptEvent a type which is a synonym for PairedInterval Concept a; i.e, this is an event without facts or a source.
- Adds the
toConceptEvent function for dropping from an Event a to a ConceptEvent a, and mkConceptEvent function for directly making a ConceptEvent from concepts and an interval.
- Adds generators for lists of arbitrary events. The generator for
Concepts is limited at this point; it simply takes a subsample of the first 10 letters of the alphabet. Currently, only generators for Event Int are provided by the generateEventsInt. For example, in the repl generateEventsInt 2 produces two randomly generated events:
*Hasklepias> generateEventsInt 2
[{(-33, -16), Context {getConcepts = fromList ["G","I"], getFacts = Nothing, getSource = Nothing}},{(12, 13), Context {getConcepts = fromList ["A","C","D","E","G","I"], getFacts = Nothing, getSource = Nothing}}]
- Adds the
transformToMeetingSequence function which takes a set of concepts and a list of possibly non-disjoint ConceptEventss and returns a list of ConceptEvents, where each consecutive event meets the next. Moreover, only those concepts selected (in the first argument) are kept in the output list of events. In the case that none of the events have the chosen concepts during an interval, an ConceptEvent with an empty set of concept is returned. A few examples might make this more clear.
*Hasklepias> :set -XOverloadedStrings
*Hasklepias> x <- fmap (map toConceptEvent) (generateEventsInt 1)
*Hasklepias> x
[{(3, 4), fromList ["B","C"]}]
*Hasklepias> transformToMeetingSequence (map packConcept ["A"]) x
[{(3, 4), fromList []}]
*Hasklepias> transformToMeetingSequence (map packConcept ["B"]) x
[{(3, 4), fromList ["B"]}]
*Hasklepias> x <- fmap (map toConceptEvent) (generateEventsInt 10)
*Hasklepias> x
[{(-44, 7), fromList ["C","D","E","F","H","J"]},{(-30, -29), fromList ["A","B","F","G","H","I","J"]},{(-25, 5), fromList ["C","D","E","I"]},{(-20, -19), fromList ["A","C","E","G","I","J"]},{(-17, -16), fromList ["B","D","F","J"]},{(-6, -5), fromList ["E","F","H","J"]},{(2, 21), fromList ["A","F","J"]},{(18, 19), fromList ["D","F","G","H","I"]},{(19, 20), fromList ["B","C","D","E","F","H"]},{(30, 31), fromList ["B","C","D","H","J"]}]
*Hasklepias> transformToMeetingSequence (map packConcept ["B", "I"]) x
[{(-44, -30), fromList []},{(-30, -29), fromList ["B","I"]},{(-29, -25), fromList []},{(-25, -17), fromList ["I"]},{(-17, -16), fromList ["B","I"]},{(-16, 5), fromList ["I"]},{(5, 18), fromList []},{(18, 19), fromList ["I"]},{(19, 20), fromList ["B"]},{(20, 30), fromList []},{(30, 31), fromList ["B"]}]
- Adds an example of
transformToMeetingSequence could be used to derive a feature that is the list of durations that a subject was both hospitalized and on antibiotics at the same time in the examples/ExampleFeatures2 module.