JSON Search Criteria project specs
Write python code that conforms to the following diagram & specs. Note that this project was originally intended to require all students to process the same data set: the PGH capital projects. For FA21, you are using your own data set and adapting the specs. If you want to line up to the specs, use the PGH projects data set on the WPRDC.
Diagram
purpose |
Implement search criteria defined in the JSON format for searching for records in your chosen CSV dataset and then writing the selected records into an output file also in JSON Unified JSON-encoded search criteria:For example, WPRDC has a capital projects dataset. We might want to only select a subset of these records. Which subset we select needs to be encoded in a nice, python-friendly format, namely JSON. So we could allow the searcher to say: "I only want records in 2019, that started in January and that are in the area of 'infrastructure'" {"fiscal_year": [-1], "start_date": [""], "area": [""], "asset_type": [""], "planning_status": [""]} Sample Search Notes:
|
program requirement 1: searching |
Write code that can read in a search criterion JSON file of your specification (meaning, you determine what the keys/values should be that will generate selected records). You'll need to be prepared to share this specification with others in the class Allow the user to specify search criteria for the records in your data set. IN the capital projects example, this included project fiscal year, start date, area, asset_type, and planning status |
cakeExtension exercises
We can turn python objects into JSON files easily that can be digested by servers all over the world. We can also turn python objects into files that can only be eaten by other python interpreters. The library for this is called pickle. Try serializing (turning a python object into data inside a file, instead of in RAM) your project objects and resurrecting them using the pickle library.