<jupyter_start><jupyter_text>Running Post-hoc AnalysesConFlowGen comes with a set of post-hoc analyses that relate to their preview counterparts.This means, that e.g.  `InboundAndOutboundVehicleCapacityPreviewReport`and`InboundAndOutboundVehicleCapacityAnalysisReport`come as a pair.Based on your input data, first the preview is generated.In case your operational restrictions (e.g., minimum and maximum container dwell times in combination with the presented schedules) are often not satisfiable, during the container flow generation some of them are relaxed (e.g., the vehicle type for onward transportation).Thus, you should examine the logs and these visuals(i.e., the visuals created by `XXXAnalysisReport`)to ensure that the generated container flows represent the properties you initially desired.If this is not the case, you need to change the input data according to your needs.<jupyter_code>import matplotlib.pyplot as plt

from conflowgen import DatabaseChooser
from conflowgen import ContainerFlowGenerationManager
from conflowgen import InboundAndOutboundVehicleCapacityAnalysisReport
from conflowgen import ContainerFlowByVehicleTypeAnalysisReport
from conflowgen import ModalSplitAnalysisReport
from conflowgen import ContainerFlowAdjustmentByVehicleTypeAnalysisReport
from conflowgen import ContainerFlowAdjustmentByVehicleTypeAnalysisSummaryReport
from conflowgen import YardCapacityAnalysisReport
from conflowgen import QuaySideThroughputAnalysisReport
from conflowgen import TruckGateThroughputAnalysisReport
from conflowgen import StorageRequirement<jupyter_output><empty_output><jupyter_text>Load database Load information from database.<jupyter_code>database_chooser = DatabaseChooser()
demo_file_name = "demo_deham_cta.sqlite"
if demo_file_name in database_chooser.list_all_sqlite_databases():
    database_chooser.load_existing_sqlite_database(demo_file_name)
else:
    print("Database is missing, nothing to do here")<jupyter_output><empty_output><jupyter_text>Get information regarding the container flow.<jupyter_code>container_flow_generation_manager = ContainerFlowGenerationManager()
container_flow_properties = container_flow_generation_manager.get_properties()
for key, value in container_flow_properties.items():
    print(f"{key:<60}: {value}")<jupyter_output><empty_output><jupyter_text>Load text reportsGenerate text reports.These have been tested with unit tests and serve as guidance for the visualizations.<jupyter_code>inbound_and_outbound_vehicle_capacity_analysis_report = InboundAndOutboundVehicleCapacityAnalysisReport()
report = inbound_and_outbound_vehicle_capacity_analysis_report.get_report_as_text()
print("Inbound and outbound traffic: ")
print(report)
print()

container_flow_by_vehicle_type_analysis_report = ContainerFlowByVehicleTypeAnalysisReport()
report = container_flow_by_vehicle_type_analysis_report.get_report_as_text()
print("Container flow between vehicle types as generated: ")
print(report)
print()

modal_split_analysis_report = ModalSplitAnalysisReport()
report = modal_split_analysis_report.get_report_as_text()
print("The same container flow expressed in terms of transshipment and modal split for the hinterland: ")
print(report)
print()

container_flow_adjustment_by_vehicle_type_analysis_report = ContainerFlowAdjustmentByVehicleTypeAnalysisReport()
report = container_flow_adjustment_by_vehicle_type_analysis_report.get_report_as_text()
print("Consequences of container flow for outgoing vehicles: ")
print(report)

container_flow_adjustment_by_vehicle_type_analysis_summary_report = ContainerFlowAdjustmentByVehicleTypeAnalysisSummaryReport()
report = container_flow_adjustment_by_vehicle_type_analysis_summary_report.get_report_as_text()
print("The summary of the previous report: ")
print(report)

yard_capacity_analysis_report = YardCapacityAnalysisReport()
report = yard_capacity_analysis_report.get_report_as_text()
print("Analyse the used capacity in the yard")
print(report)

quay_side_throughput_analysis_report = QuaySideThroughputAnalysisReport()
report = quay_side_throughput_analysis_report.get_report_as_text()
print("Analyse the throughput at the quay side")
print(report)

truck_gate_throughput_analysis_report = TruckGateThroughputAnalysisReport()
report = truck_gate_throughput_analysis_report.get_report_as_text()
print("Analyse the throughput at the truck gate")
print(report)<jupyter_output><empty_output><jupyter_text>Plot inbound and outbound capacities<jupyter_code>ax = inbound_and_outbound_vehicle_capacity_analysis_report.get_report_as_graph()
plt.show()<jupyter_output><empty_output><jupyter_text>If the actual and maximum capacity are equal, most likely some of the containers needed to be redirected to other vehicle types as not sufficient resources were available.<jupyter_code>fig = container_flow_by_vehicle_type_analysis_report.get_report_as_graph()
fig.show()<jupyter_output><empty_output><jupyter_text>Please check whether you have expected this container flow as depicted.<jupyter_code>ax = modal_split_analysis_report.get_report_as_graph()
plt.show()<jupyter_output><empty_output><jupyter_text>This shows the modal split as it is reflected in the actually generated data.<jupyter_code>fig = container_flow_adjustment_by_vehicle_type_analysis_report.get_report_as_graph()
fig.show()<jupyter_output><empty_output><jupyter_text>This is the flow from the initially selected vehicle type selected for pick up to the vehicle type that it was changed to in order not to harm the operational constraints.If the left and right side are the same, this means that nothing has changed.<jupyter_code>ax = container_flow_adjustment_by_vehicle_type_analysis_summary_report.get_report_as_graph()
plt.show()<jupyter_output><empty_output><jupyter_text>This is a summary of the previously presented flow.A large fraction of unchanged vehicle types reflects that operational constraints were rarely harmed.If the fraction of unchanged vehicles is not the majority, some of your assumptions regarding the prevailing container flows through the terminal might require reconsideration.<jupyter_code>ax = yard_capacity_analysis_report.get_report_as_graph()
plt.show()
ax = yard_capacity_analysis_report.get_report_as_graph(storage_requirement=StorageRequirement.standard)
plt.show()
ax = yard_capacity_analysis_report.get_report_as_graph(storage_requirement={StorageRequirement.reefer, StorageRequirement.dangerous_goods})
plt.show()<jupyter_output><empty_output><jupyter_text>This shows the used capacity in the yard. Now let's see how many containers cross the quay side each week.<jupyter_code>ax = quay_side_throughput_analysis_report.get_report_as_graph()
plt.show()<jupyter_output><empty_output><jupyter_text>...and how many containers pass the truck gate?<jupyter_code>ax = truck_gate_throughput_analysis_report.get_report_as_graph()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05720524017467249, 'fraction_numerical': 0.0002911208151382824, 'mean_word_length': 9.889064976228209, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '448603', 'license': 'MIT', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1891, 'n_words': 505, 'path': 'example-usage/Jupyter Notebook/output data inspection/running posthoc analyses.ipynb', 'repo_name': '1grasse/conflowgen', 'size': '6870'}