| | 68 | === SitRep Aggregation === |
| | 69 | SitRep Aggregation |
| | 70 | |
| | 71 | We currently have a very basic SitRep module in Eden where we can write a RichText report &/or add a file attachment. There are cases where the SitReps for different Districts should be aggregated at the next higher level (e.g. Province or Division). |
| | 72 | |
| | 73 | For the Rich-Text, I see this as creating a section for each District with a Section Header added and all the Heading levels taken down a notch: H1s -> H2s, etc |
| | 74 | |
| | 75 | SitReps can also include hard numbers though, like #affected, #dead, #wounded, #missing, #displaced, # staff, #volunteers, # vehicles, #shelters, etc then obviously these should be totalled in the aggregated report. |
| | 76 | |
| | 77 | So, we need a way to store these in the SitRep: I would suggest a KeyValue system: doc_sitrep_tag. |
| | 78 | |
| | 79 | This would be like the ones for gis_location (amongst others): https://github.com/flavour/eden/blob/master/modules/s3db/gis.py#L1254 |
| | 80 | Note how these are added to the parent resource as a 'Component': https://github.com/flavour/eden/blob/master/modules/s3db/gis.py#L386 |
| | 81 | |
| | 82 | This model should be added to the SitRep class (I don't think we need a separate class here): https://github.com/flavour/eden/blob/master/modules/s3db/doc.py#L664 |
| | 83 | |
| | 84 | For UI, this could be a Tab, as it is for gis_location, or could be an Inline form. I think the Inline form is better, generally better UX & works better for when the sitrep is itself on a tab (e.g. of the Event or Org) |
| | 85 | Inline form: https://github.com/flavour/eden/blob/master/modules/s3db/doc.py#L715 (Can add KV like Files) |
| | 86 | |
| | 87 | Tabs: https://github.com/flavour/eden/blob/master/modules/s3db/gis.py#L5427 (Need to add an rheader like this to SitReps) |
| | 88 | |
| | 89 | Ideally XSLT would be provided to import the Tags: https://github.com/flavour/eden/blob/master/static/formats/s3csv/event/event.xsl |
| | 90 | [Example of a KV in an XSLT file] https://github.com/flavour/eden/blob/master/static/formats/s3csv/doc/sitrep.xsl |
| | 91 | [File which needs modifying] |
| | 92 | |
| | 93 | I have provided an initial UI for the aggregation: https://github.com/flavour/eden/blob/master/private/templates/ARC/config.py#L841 i.e. there is a hook for a new 'consolidate' method which is called |
| | 94 | with the selected sitreps. The consolidate method needs writing. It would look something like this: https://github.com/flavour/eden/blob/master/modules/s3db/hrm.py#L3995 |
| | 95 | |
| | 96 | |
| | 97 | |
| | 98 | |