bin Package¶
bin Package¶
activate_schema Module¶
Script that 'activates' a ebpub.db.models.Schema. This sets is_public=True, and sets pub_date to today for any older NewsItems of this schema.
- ebpub.db.bin.activate_schema.activate_schema(schema)¶
Fixes the given schema's min_date, its news item pub_dates, and makes it public.
- ebpub.db.bin.activate_schema.fix_initial_pub_dates(schema)¶
Sets pub_date equal to item_date for the earliest import of the given schema.
- ebpub.db.bin.activate_schema.set_schema_min_date(schema)¶
Sets the schema's min_date to the earliest item_date found in news items.
add_location Module¶
Script that adds a single ebpub.db.models.Location by specifying its borders in WKT format. See Command Line: Add Location From WKT
Use --help to get usage instructions.
alphabetize_locations Module¶
Script that updates display_order for all ebpub.db.models.Location so that they are sorted alphabetically by name.
Optionally pass a LocationType.slug to only sort locations of that type.
delete_newsitems Module¶
Script that deletes all NewsItems of a given Schema (specified by slug).
To do a dry run and not actually delete anything, give the --dry-run option.
- ebpub.db.bin.delete_newsitems.delete(schema=None, do_delete=False)¶
Delete all NewsItems of a given Schema.
By default, does a dry run and just prints;
export_schema Module¶
Prints out a SQL statement that can recreate one Schema row.
Arguments should be the slug of the Schema(s) you want.
Does not included related SchemaFields.
geocode_newsitems Module¶
Script that finds NewsItems with null location fields, and attempts to geocode them based on their location_name.
Optionally provide a list of Schema.slug values to only geocode items of that schema.
- ebpub.db.bin.geocode_newsitems.geocode(*schemas)¶
Geocode NewsItems with null locations.
If schemas are provided, only geocode NewsItems with that particular schema slug(s).
import_hoods Module¶
Import neighborhoods from a shapefile. Try --help for usage instructions.
Assumes you have a LocationType with slug='neighborhoods'.
import_locations Module¶
Script to import Locations from a shapefile. See Command Line: Importing Locations From Shapefiles
- ebpub.db.bin.import_locations.populate_ni_loc(location)¶
Add NewsItemLocations for all NewsItems that overlap with the new Location.
import_zips Module¶
Script to import ZIP code Locations from a shapefile. See US ZIP Codes
update_aggregates Module¶
Script to populate Aggregates. Typically run without arguments. The --reset option will delete all aggregates first.
- ebpub.db.bin.update_aggregates.update_aggregates(schema_id_or_slug, dry_run=False, reset=False)¶
Updates all Aggregate* tables for the given schema_id/slug, deleting/updating the existing records if necessary.
If dry_run is True, then the records won't be updated -- only the SQL will be output.
If reset is True, then all aggregates for this schema will be deleted before updating.